Class QueryTermExtractor.BoostedTermExtractor
- java.lang.Object
-
- org.apache.lucene.search.QueryVisitor
-
- org.apache.lucene.search.highlight.QueryTermExtractor.BoostedTermExtractor
-
- Enclosing class:
- QueryTermExtractor
private static class QueryTermExtractor.BoostedTermExtractor extends QueryVisitor
-
-
Field Summary
Fields Modifier and Type Field Description (package private) float
boost
(package private) java.util.function.Predicate<java.lang.String>
fieldSelector
(package private) boolean
includeProhibited
(package private) java.util.Set<WeightedTerm>
terms
-
Fields inherited from class org.apache.lucene.search.QueryVisitor
EMPTY_VISITOR
-
-
Constructor Summary
Constructors Modifier Constructor Description private
BoostedTermExtractor(float boost, java.util.Set<WeightedTerm> terms, boolean includeProhibited, java.util.function.Predicate<java.lang.String> fieldSelector)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
acceptField(java.lang.String field)
Whether or not terms from this field are of interest to the visitor Implement this to avoid collecting terms from heavy queries such asTermInSetQuery
that are not running on fields of interestvoid
consumeTerms(Query query, Term... terms)
Called by leaf queries that match on specific termsQueryVisitor
getSubVisitor(BooleanClause.Occur occur, Query parent)
Pulls a visitor instance for visiting child clauses of a query The default implementation returnsthis
, unlessoccur
is equal toBooleanClause.Occur.MUST_NOT
in which case it returnsQueryVisitor.EMPTY_VISITOR
-
Methods inherited from class org.apache.lucene.search.QueryVisitor
consumeTermsMatching, termCollector, visitLeaf
-
-
-
-
Field Detail
-
boost
final float boost
-
terms
final java.util.Set<WeightedTerm> terms
-
includeProhibited
final boolean includeProhibited
-
fieldSelector
final java.util.function.Predicate<java.lang.String> fieldSelector
-
-
Constructor Detail
-
BoostedTermExtractor
private BoostedTermExtractor(float boost, java.util.Set<WeightedTerm> terms, boolean includeProhibited, java.util.function.Predicate<java.lang.String> fieldSelector)
-
-
Method Detail
-
acceptField
public boolean acceptField(java.lang.String field)
Description copied from class:QueryVisitor
Whether or not terms from this field are of interest to the visitor Implement this to avoid collecting terms from heavy queries such asTermInSetQuery
that are not running on fields of interest- Overrides:
acceptField
in classQueryVisitor
-
consumeTerms
public void consumeTerms(Query query, Term... terms)
Description copied from class:QueryVisitor
Called by leaf queries that match on specific terms- Overrides:
consumeTerms
in classQueryVisitor
- Parameters:
query
- the leaf queryterms
- the terms the query will match on
-
getSubVisitor
public QueryVisitor getSubVisitor(BooleanClause.Occur occur, Query parent)
Description copied from class:QueryVisitor
Pulls a visitor instance for visiting child clauses of a query The default implementation returnsthis
, unlessoccur
is equal toBooleanClause.Occur.MUST_NOT
in which case it returnsQueryVisitor.EMPTY_VISITOR
- Overrides:
getSubVisitor
in classQueryVisitor
- Parameters:
occur
- the relationship between the parent and its childrenparent
- the query visited
-
-