Module org.apache.lucene.facet
Class SortedSetDocValuesFacetCounts
java.lang.Object
org.apache.lucene.facet.Facets
org.apache.lucene.facet.sortedset.AbstractSortedSetDocValueFacetCounts
org.apache.lucene.facet.sortedset.SortedSetDocValuesFacetCounts
Compute facets counts from previously indexed
SortedSetDocValuesFacetField
, without
require a separate taxonomy index. Faceting is a bit slower (~25%), and there is added cost on
every IndexReader
open to create a new SortedSetDocValuesReaderState
.
NOTE: this class should be instantiated and then used from a single thread, because it
holds a thread-private instance of SortedSetDocValues
.
NOTE: tie-break is by unicode sort order
NOTE: if you have multi-valued dims that require dim counts (see FacetsConfig
,
make sure to provide your FacetsConfig
instance when instantiating SortedSetDocValuesReaderState
, or else dim counts can be inaccurate
-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.lucene.facet.sortedset.AbstractSortedSetDocValueFacetCounts
AbstractSortedSetDocValueFacetCounts.ChildIterationCursor, AbstractSortedSetDocValueFacetCounts.DimValue
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) int[]
private final SortedSetDocValuesReaderState
Fields inherited from class org.apache.lucene.facet.sortedset.AbstractSortedSetDocValueFacetCounts
dv, field, stateConfig
-
Constructor Summary
ConstructorsConstructorDescriptionReturns all facet counts, same result as searching onMatchAllDocsQuery
but faster.Counts all facet dimensions across the provided hits. -
Method Summary
Modifier and TypeMethodDescriptionprivate void
count
(List<FacetsCollector.MatchingDocs> matchingDocs) Does all the "real work" of tallying up the counts.private void
countAll()
Does all the "real work" of tallying up the counts.private void
countOneSegment
(OrdinalMap ordinalMap, LeafReader reader, int segOrd, FacetsCollector.MatchingDocs hits, Bits liveDocs) private void
countOneSegmentNHLD
(OrdinalMap ordinalMap, LeafReader reader, int segOrd) (package private) int
getCount
(int ord) Retrieve the count for a specified ordinal.(package private) boolean
Were any counts actually computed? (They may not be if there are no hits, etc.)private void
Methods inherited from class org.apache.lucene.facet.sortedset.AbstractSortedSetDocValueFacetCounts
getAllChildren, getAllDims, getSpecificValue, getTopChildren, getTopDims
Methods inherited from class org.apache.lucene.facet.Facets
validateTopN
-
Field Details
-
state
-
counts
int[] counts
-
-
Constructor Details
-
SortedSetDocValuesFacetCounts
Returns all facet counts, same result as searching onMatchAllDocsQuery
but faster.- Throws:
IOException
-
SortedSetDocValuesFacetCounts
public SortedSetDocValuesFacetCounts(SortedSetDocValuesReaderState state, FacetsCollector hits) throws IOException Counts all facet dimensions across the provided hits.- Throws:
IOException
-
-
Method Details
-
initializeCounts
private void initializeCounts() -
hasCounts
boolean hasCounts()Description copied from class:AbstractSortedSetDocValueFacetCounts
Were any counts actually computed? (They may not be if there are no hits, etc.)- Specified by:
hasCounts
in classAbstractSortedSetDocValueFacetCounts
-
getCount
int getCount(int ord) Description copied from class:AbstractSortedSetDocValueFacetCounts
Retrieve the count for a specified ordinal.- Specified by:
getCount
in classAbstractSortedSetDocValueFacetCounts
-
countOneSegmentNHLD
private void countOneSegmentNHLD(OrdinalMap ordinalMap, LeafReader reader, int segOrd) throws IOException - Throws:
IOException
-
countOneSegment
private void countOneSegment(OrdinalMap ordinalMap, LeafReader reader, int segOrd, FacetsCollector.MatchingDocs hits, Bits liveDocs) throws IOException - Throws:
IOException
-
count
Does all the "real work" of tallying up the counts.- Throws:
IOException
-
countAll
Does all the "real work" of tallying up the counts.- Throws:
IOException
-