Package org.apache.solr.search.facet
Class SlotAcc
java.lang.Object
org.apache.solr.search.facet.SlotAcc
- All Implemented Interfaces:
Closeable,AutoCloseable
- Direct Known Subclasses:
DocValuesAcc,SlotAcc.FuncSlotAcc,SlotAcc.IntSlotAcc,UnInvertedFieldAcc,UniqueBlockAgg.UniqueBlockSlotAcc
Accumulates statistics separated by a slot number. There is a separate statistic per slot. The
slot is usually an ordinal into a set of values, e.g. tracking a count frequency per
term. Sometimes there doesn't need to be a slot distinction, in which case there is just one
nominal slot.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic classstatic classstatic classstatic classstatic classIncapsulates information about the current slot, for Accumulators that may want additional info during collection. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected intprotected org.apache.lucene.index.LeafReaderContextprotected final FacetContext -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()abstract voidcollect(int doc, int slot, IntFunction<SlotAcc.SlotContext> slotContext) All subclasses must override this method to collect documents.intcollect(DocSet docs, int slot, IntFunction<SlotAcc.SlotContext> slotContext) Bulk collection of all documents in a slot.abstract intcompare(int slotA, int slotB) abstract ObjectgetValue(int slotNum) abstract voidreset()Called to reset the acc to a fresh state, ready for reuseprotected voidTypically called from setNextReader to reset docValue iteratorsabstract voidresize(SlotAcc.Resizer resizer) voidsetNextReader(org.apache.lucene.index.LeafReaderContext readerContext) NOTE: this currently detects when it is being reused and calls resetIterators by comparing reader ords with previous calls to setNextReader.voidtoString()
-
Field Details
-
fcontext
-
currentReaderContext
protected org.apache.lucene.index.LeafReaderContext currentReaderContext -
currentDocBase
protected int currentDocBase
-
-
Constructor Details
-
SlotAcc
-
-
Method Details
-
toString
-
setNextReader
public void setNextReader(org.apache.lucene.index.LeafReaderContext readerContext) throws IOException NOTE: this currently detects when it is being reused and calls resetIterators by comparing reader ords with previous calls to setNextReader. For this reason, current users must call setNextReader in segment order. Failure to do so will cause worse performance.- Throws:
IOException
-
collect
public abstract void collect(int doc, int slot, IntFunction<SlotAcc.SlotContext> slotContext) throws IOException All subclasses must override this method to collect documents. This method is called by the default impl ofcollect(DocSet, int, IntFunction)but it's also neccessary if this accumulator is used for sorting.- Parameters:
doc- Single Segment docId (relative to the currentLeafReaderContextto collectslot- The slot number to collect this document inslotContext- A callback that can be used for Accumulators that would like additional info about the current slot -- theIntFunctionis only garunteed to be valid for the current slot, and theSlotAcc.SlotContextreturned is only valid for the duration of thecollect()call.- Throws:
IOException
-
collect
public int collect(DocSet docs, int slot, IntFunction<SlotAcc.SlotContext> slotContext) throws IOException Bulk collection of all documents in a slot. The default implementation callscollect(int, int, IntFunction)- Parameters:
docs- (global) Documents to collectslot- The slot number to collect these documents inslotContext- A callback that can be used for Accumulators that would like additional info about the current slot -- theIntFunctionis only garunteed to be valid for the current slot, and theSlotAcc.SlotContextreturned is only valid for the duration of thecollect()call.- Throws:
IOException
-
compare
public abstract int compare(int slotA, int slotB) -
getValue
- Throws:
IOException
-
setValues
public void setValues(org.apache.solr.common.util.SimpleOrderedMap<Object> bucket, int slotNum) throws IOException - Throws:
IOException
-
reset
Called to reset the acc to a fresh state, ready for reuse- Throws:
IOException
-
resetIterators
Typically called from setNextReader to reset docValue iterators- Throws:
IOException
-
resize
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException
-