Class FunctionRangeQuery
- java.lang.Object
-
- org.apache.lucene.search.Query
-
- org.apache.lucene.queries.function.FunctionRangeQuery
-
public class FunctionRangeQuery extends Query
A Query wrapping aValueSourcethat matches docs in which the values in the value source match a configured range. The score is the float value. This can be a slow query if run by itself since it must visit all docs; ideally it's combined with other queries. It's mostly a wrapper aroundFunctionValues.getRangeScorer(Weight, LeafReaderContext, String, String, boolean, boolean). A similar class isorg.apache.lucene.search.DocValuesRangeQueryin the sandbox module. That one is constant scoring.- See Also:
(constant scoring)
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private classFunctionRangeQuery.FunctionRangeWeight
-
Field Summary
Fields Modifier and Type Field Description private booleanincludeLowerprivate booleanincludeUpperprivate java.lang.StringlowerValprivate java.lang.StringupperValprivate ValueSourcevalueSource
-
Constructor Summary
Constructors Constructor Description FunctionRangeQuery(ValueSource valueSource, java.lang.Number lowerVal, java.lang.Number upperVal, boolean includeLower, boolean includeUpper)FunctionRangeQuery(ValueSource valueSource, java.lang.String lowerVal, java.lang.String upperVal, boolean includeLower, boolean includeUpper)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description WeightcreateWeight(IndexSearcher searcher, ScoreMode scoreMode, float boost)Expert: Constructs an appropriate Weight implementation for this query.booleanequals(java.lang.Object other)Override and implement query instance equivalence properly in a subclass.private booleanequalsTo(FunctionRangeQuery other)java.lang.StringgetLowerVal()java.lang.StringgetUpperVal()ValueSourcegetValueSource()inthashCode()Override and implement query hash code properly in a subclass.booleanisIncludeLower()booleanisIncludeUpper()java.lang.StringtoString(java.lang.String field)Prints a query to a string, withfieldassumed to be the default field and omitted.voidvisit(QueryVisitor visitor)Recurse through the query tree, visiting any child queries-
Methods inherited from class org.apache.lucene.search.Query
classHash, rewrite, sameClassAs, toString
-
-
-
-
Field Detail
-
valueSource
private final ValueSource valueSource
-
lowerVal
private final java.lang.String lowerVal
-
upperVal
private final java.lang.String upperVal
-
includeLower
private final boolean includeLower
-
includeUpper
private final boolean includeUpper
-
-
Constructor Detail
-
FunctionRangeQuery
public FunctionRangeQuery(ValueSource valueSource, java.lang.Number lowerVal, java.lang.Number upperVal, boolean includeLower, boolean includeUpper)
-
FunctionRangeQuery
public FunctionRangeQuery(ValueSource valueSource, java.lang.String lowerVal, java.lang.String upperVal, boolean includeLower, boolean includeUpper)
-
-
Method Detail
-
getValueSource
public ValueSource getValueSource()
-
getLowerVal
public java.lang.String getLowerVal()
-
getUpperVal
public java.lang.String getUpperVal()
-
isIncludeLower
public boolean isIncludeLower()
-
isIncludeUpper
public boolean isIncludeUpper()
-
toString
public java.lang.String toString(java.lang.String field)
Description copied from class:QueryPrints a query to a string, withfieldassumed to be the default field and omitted.
-
equals
public boolean equals(java.lang.Object other)
Description copied from class:QueryOverride and implement query instance equivalence properly in a subclass. This is required so thatQueryCacheworks properly. Typically a query will be equal to another only if it's an instance of the same class and its document-filtering properties are identical that other instance. Utility methods are provided for certain repetitive code.- Specified by:
equalsin classQuery- See Also:
Query.sameClassAs(Object),Query.classHash()
-
equalsTo
private boolean equalsTo(FunctionRangeQuery other)
-
hashCode
public int hashCode()
Description copied from class:QueryOverride and implement query hash code properly in a subclass. This is required so thatQueryCacheworks properly.- Specified by:
hashCodein classQuery- See Also:
Query.equals(Object)
-
visit
public void visit(QueryVisitor visitor)
Description copied from class:QueryRecurse through the query tree, visiting any child queries
-
createWeight
public Weight createWeight(IndexSearcher searcher, ScoreMode scoreMode, float boost) throws java.io.IOException
Description copied from class:QueryExpert: Constructs an appropriate Weight implementation for this query.Only implemented by primitive queries, which re-write to themselves.
- Overrides:
createWeightin classQueryscoreMode- How the produced scorers will be consumed.boost- The boost that is propagated by the parent queries.- Throws:
java.io.IOException
-
-