Package org.apache.solr.request
Class IntervalFacets.FacetInterval
java.lang.Object
org.apache.solr.request.IntervalFacets.FacetInterval
- Enclosing class:
IntervalFacets
Helper class to match and count of documents in specified intervals
-
Constructor Summary
ConstructorsConstructorDescriptionFacetInterval(SchemaField schemaField, String startStr, String endStr, boolean includeLower, boolean includeUpper, String key) Constructor that accepts already parsed values of start and end. -
Method Summary
Modifier and TypeMethodDescriptionintgetCount()getKey()org.apache.solr.request.IntervalFacets.IntervalCompareResultincludes(long value) Method to use to check whether a document should be counted for an interval or not.toString()voidupdateContext(org.apache.lucene.index.SortedDocValues sdv) Update the ordinals based on the current reader.voidupdateContext(org.apache.lucene.index.SortedSetDocValues sdv) Update the ordinals based on the current reader.
-
Constructor Details
-
FacetInterval
public FacetInterval(SchemaField schemaField, String startStr, String endStr, boolean includeLower, boolean includeUpper, String key) Constructor that accepts already parsed values of start and end. This constructor can only be used with numeric field types.- Parameters:
schemaField- schemaField for this rangestartStr- String representation of the start value of this interval. Can be a "*".endStr- String representation of the end value of this interval. Can be a "*".includeLower- Indicates weather this interval should include values equal to startincludeUpper- Indicates weather this interval should include values equal to endkey- String key of this interval
-
-
Method Details
-
updateContext
Update the ordinals based on the current reader. This method (orupdateContext(SortedSetDocValues)depending on the DocValues type) needs to be called for every reader beforeincludes(long)is called on any document of the reader.- Parameters:
sdv- DocValues for the current reader- Throws:
IOException
-
updateContext
Update the ordinals based on the current reader. This method (orupdateContext(SortedDocValues)depending on the DocValues type) needs to be called for every reader beforeincludes(long)is called on any document of the reader.- Parameters:
sdv- DocValues for the current reader- Throws:
IOException
-
includes
public org.apache.solr.request.IntervalFacets.IntervalCompareResult includes(long value) Method to use to check whether a document should be counted for an interval or not. Before calling this method on a multi-valued and/or non-numeric field make sure you callupdateContext(SortedDocValues)orupdateContext(SortedSetDocValues)(depending on the DV type). It is OK to call this method without other previous calls on numeric fields (withNumericDocValues)- Parameters:
value- For numeric single value fields, thisvalueshould be thelongrepresentation of the value of the document in the specified field. For multi-valued and/or non-numeric fields,valueshould be the ordinal of the term in the current segment- Returns:
IntervalFacets.IntervalCompareResult.INCLUDEDif the value is included in the intervalIntervalFacets.IntervalCompareResult.GREATER_THAN_ENDif the value is greater thanendLimitIntervalFacets.IntervalCompareResult.LOWER_THAN_STARTif the value is lower thanstartLimit
- See Also:
-
toString
-
getCount
public int getCount()- Returns:
- The count of document that matched this interval
-
getKey
- Returns:
- Human readable key for this interval
-