File tree Expand file tree Collapse file tree
graphannis/src/annis/db/aql/operators Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -49,18 +49,22 @@ impl BaseEdgeOp {
4949 . components
5050 . iter ( )
5151 . all ( |c| c. get_type ( ) == AnnotationComponentType :: PartOf ) ;
52- let max_nodes_estimate = if all_part_of_components {
52+
53+ let max_nodes_estimate = if all_part_of_components && gs. len ( ) == 1 {
5354 // PartOf components have a very skewed distribution of root nodes
5455 // vs. the actual possible targets, thus do not use all nodes as
55- // population but only the non-roots. We can guess the non-root
56- // nodes by estimating the number of nodes in the corpus grah.
57- let result = db. get_node_annos ( ) . guess_max_count (
58- Some ( & NODE_TYPE_KEY . ns ) ,
59- & NODE_TYPE_KEY . name ,
60- "corpus" ,
61- "datasource" ,
62- ) ?;
63- result
56+ // population but only the non-roots.
57+ if let Some ( stats) = gs[ 0 ] . get_statistics ( ) {
58+ stats. nodes - stats. root_nodes
59+ } else {
60+ // Fallback to guessing by using the node type
61+ db. get_node_annos ( ) . guess_max_count (
62+ Some ( & NODE_TYPE_KEY . ns ) ,
63+ & NODE_TYPE_KEY . name ,
64+ "corpus" ,
65+ "datasource" ,
66+ ) ?
67+ }
6468 } else {
6569 db. get_node_annos ( ) . guess_max_count (
6670 Some ( & NODE_TYPE_KEY . ns ) ,
You can’t perform that action at this time.
0 commit comments