java.lang.Object
org.apache.lucene.search.Query
org.apache.lucene.sandbox.search.MultiRangeQuery
- All Implemented Interfaces:
Cloneable
Abstract class for range queries involving multiple ranges against physical points such as
IntPoints All ranges are logically ORed together-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classA builder for multirange queries.private static interfaceA range represents anything with a min/max value that can compute its relation with another range and can compute if a point is inside itstatic final classRepresentation of a single clause in a MultiRangeQueryprivate static classAn interval tree of Ranges for speeding up computationsprivate static interfaceRepresents a range that can compute its relation with another range and can compute if a point is inside it -
Field Summary
FieldsModifier and TypeFieldDescription(package private) final int(package private) final String(package private) final int(package private) List<MultiRangeQuery.RangeClause> -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedMultiRangeQuery(String field, int numDims, int bytesPerDim, List<MultiRangeQuery.RangeClause> rangeClauses) Expert: create a multidimensional range query with multiple connected ranges -
Method Summary
Modifier and TypeMethodDescription(package private) static MultiRangeQuery.RangeTreecreateTree(List<MultiRangeQuery.RangeClause> clauses, int numIndexDim, int bytesPerDim, ArrayUtil.ByteArrayComparator comparator) Creates a tree from provided clausesprivate static MultiRangeQuery.RangeTreecreateTree(MultiRangeQuery.Range[] components, int low, int high, int split, int numIndexDim, int bytesPerDim, ArrayUtil.ByteArrayComparator comparator) Creates tree from sorted ranges (with range low and high inclusive)final WeightcreateWeight(IndexSearcher searcher, ScoreMode scoreMode, float boost) Expert: Constructs an appropriate Weight implementation for this query.final booleanOverride and implement query instance equivalence properly in a subclass.private booleanequalsTo(MultiRangeQuery other) intgetField()intprivate static MultiRangeQuery.RangegetRange(MultiRangeQuery.RangeClause clause, int numIndexDim, int bytesPerDim, ArrayUtil.ByteArrayComparator comparator) Builds a Range object from a range clausefinal inthashCode()Override and implement query hash code properly in a subclass.(package private) static List<MultiRangeQuery.RangeClause> mergeOverlappingRanges(List<MultiRangeQuery.RangeClause> rangeClauses, int bytesPerDim) Merges overlapping ranges and returns unconnected rangesrewrite(IndexSearcher indexSearcher) Merges the overlapping ranges and returns unconnected ranges by callingmergeOverlappingRanges(java.util.List<org.apache.lucene.sandbox.search.MultiRangeQuery.RangeClause>, int)protected abstract StringtoString(int dimension, byte[] value) Returns a string of a single value in a human-readable format for debugging.final StringPrints 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 Details
-
field
-
numDims
final int numDims -
bytesPerDim
final int bytesPerDim -
rangeClauses
List<MultiRangeQuery.RangeClause> rangeClauses
-
-
Constructor Details
-
MultiRangeQuery
protected MultiRangeQuery(String field, int numDims, int bytesPerDim, List<MultiRangeQuery.RangeClause> rangeClauses) Expert: create a multidimensional range query with multiple connected ranges- Parameters:
field- field name. must not benull.numDims- number of dimensions.rangeClauses- Range Clauses for this query
-
-
Method Details
-
visit
Description copied from class:QueryRecurse through the query tree, visiting any child queries. -
rewrite
Merges the overlapping ranges and returns unconnected ranges by callingmergeOverlappingRanges(java.util.List<org.apache.lucene.sandbox.search.MultiRangeQuery.RangeClause>, int)- Overrides:
rewritein classQuery- Throws:
IOException- See Also:
-
mergeOverlappingRanges
static List<MultiRangeQuery.RangeClause> mergeOverlappingRanges(List<MultiRangeQuery.RangeClause> rangeClauses, int bytesPerDim) Merges overlapping ranges and returns unconnected ranges- Parameters:
rangeClauses- some overlapping rangesbytesPerDim- bytes per Dimension of the point value- Returns:
- unconnected ranges
-
createWeight
public final Weight createWeight(IndexSearcher searcher, ScoreMode scoreMode, float boost) throws 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 classQuery- Parameters:
scoreMode- How the produced scorers will be consumed.boost- The boost that is propagated by the parent queries.- Throws:
IOException
-
getField
-
getNumDims
public int getNumDims() -
getBytesPerDim
public int getBytesPerDim() -
hashCode
public final int hashCode()Description copied from class:QueryOverride and implement query hash code properly in a subclass. This is required so thatQueryCacheworks properly. -
equals
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 to those of the other instance. Utility methods are provided for certain repetitive code.
-
equalsTo
-
toString
Description copied from class:QueryPrints a query to a string, withfieldassumed to be the default field and omitted. -
toString
Returns a string of a single value in a human-readable format for debugging. This is used byQuery.toString().- Parameters:
dimension- dimension of the particular valuevalue- single value, never null- Returns:
- human readable value for debugging
-
createTree
static MultiRangeQuery.RangeTree createTree(List<MultiRangeQuery.RangeClause> clauses, int numIndexDim, int bytesPerDim, ArrayUtil.ByteArrayComparator comparator) Creates a tree from provided clauses -
createTree
private static MultiRangeQuery.RangeTree createTree(MultiRangeQuery.Range[] components, int low, int high, int split, int numIndexDim, int bytesPerDim, ArrayUtil.ByteArrayComparator comparator) Creates tree from sorted ranges (with range low and high inclusive) -
getRange
private static MultiRangeQuery.Range getRange(MultiRangeQuery.RangeClause clause, int numIndexDim, int bytesPerDim, ArrayUtil.ByteArrayComparator comparator) Builds a Range object from a range clause
-