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, AbstractSortedSetDocValueFacetCounts.TopChildrenForPath -
Field Summary
FieldsModifier and TypeFieldDescription(package private) int[]private final SortedSetDocValuesReaderStateFields inherited from class org.apache.lucene.facet.sortedset.AbstractSortedSetDocValueFacetCounts
dv, field, stateConfig -
Constructor Summary
ConstructorsConstructorDescriptionReturns all facet counts, same result as searching onMatchAllDocsQuerybut faster.Counts all facet dimensions across the provided hits. -
Method Summary
Modifier and TypeMethodDescriptionprivate voidcount(List<FacetsCollector.MatchingDocs> matchingDocs) Does all the "real work" of tallying up the counts.private voidcountAll()Does all the "real work" of tallying up the counts.private voidcountOneSegment(OrdinalMap ordinalMap, LeafReader reader, int segOrd, FacetsCollector.MatchingDocs hits, Bits liveDocs) private voidcountOneSegmentNHLD(OrdinalMap ordinalMap, LeafReader reader, int segOrd) (package private) intgetCount(int ord) Retrieve the count for a specified ordinal.(package private) booleanWere any counts actually computed? (They may not be if there are no hits, etc.)private voidMethods inherited from class org.apache.lucene.facet.sortedset.AbstractSortedSetDocValueFacetCounts
getAllChildren, getAllDims, getSpecificValue, getTopChildren, getTopDimsMethods 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 onMatchAllDocsQuerybut 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:AbstractSortedSetDocValueFacetCountsWere any counts actually computed? (They may not be if there are no hits, etc.)- Specified by:
hasCountsin classAbstractSortedSetDocValueFacetCounts
-
getCount
int getCount(int ord) Description copied from class:AbstractSortedSetDocValueFacetCountsRetrieve the count for a specified ordinal.- Specified by:
getCountin 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
-