Package org.apache.lucene.monitor
Class QueryTree
java.lang.Object
org.apache.lucene.monitor.QueryTree
A representation of a node in a query tree
Queries are analyzed and converted into an abstract tree, consisting of conjunction and disjunction nodes, and leaf nodes containing terms.
Terms may be collected from a node, which will use the weights of its sub-nodes to determine
which paths are followed. The path may be changed by calling advancePhase(double)
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionabstract boolean
advancePhase
(double minWeight) Find the next-most highly-weighted path below this nodestatic QueryTree
Returns a leaf node that will match any documentabstract void
collectTerms
(BiConsumer<String, BytesRef> termCollector) Collect terms from the most highly-weighted path below this nodestatic QueryTree
conjunction
(List<Function<TermWeightor, QueryTree>> children, TermWeightor weightor) Returns a conjunction of a set of child nodesstatic QueryTree
disjunction
(List<Function<TermWeightor, QueryTree>> children, TermWeightor weightor) Returns a disjunction of a set of child nodesprotected String
space
(int width) Returns a string ofwidth
spacesstatic QueryTree
Returns a leaf node for a particular term and weightstatic QueryTree
Returns a leaf node for a particular term and weightstatic QueryTree
term
(Term term, TermWeightor weightor) Returns a leaf node for a particular termtoString()
abstract String
toString
(int depth) Returns a string representation of the nodeabstract double
weight()
The weight of this node
-
Constructor Details
-
QueryTree
public QueryTree()
-
-
Method Details
-
weight
public abstract double weight()The weight of this node -
collectTerms
Collect terms from the most highly-weighted path below this node -
advancePhase
public abstract boolean advancePhase(double minWeight) Find the next-most highly-weighted path below this node- Parameters:
minWeight
- do not advance if the next path has a weight below this value- Returns:
false
if there are no more paths above the minimum weight
-
toString
Returns a string representation of the node- Parameters:
depth
- the current depth of this node in the overall query tree
-
toString
-
space
Returns a string ofwidth
spaces -
term
Returns a leaf node for a particular term -
term
Returns a leaf node for a particular term and weightThe weight must be greater than 0
-
term
Returns a leaf node for a particular term and weightThe weight must be greater than 0
-
anyTerm
Returns a leaf node that will match any document -
conjunction
public static QueryTree conjunction(List<Function<TermWeightor, QueryTree>> children, TermWeightor weightor) Returns a conjunction of a set of child nodes -
disjunction
public static QueryTree disjunction(List<Function<TermWeightor, QueryTree>> children, TermWeightor weightor) Returns a disjunction of a set of child nodes
-