Package org.apache.solr.search.facet
Class UniqueBlockAgg.UniqueBlockSlotAcc
- java.lang.Object
-
- org.apache.solr.search.facet.SlotAcc
-
- org.apache.solr.search.facet.UniqueBlockAgg.UniqueBlockSlotAcc
-
- All Implemented Interfaces:
Closeable,AutoCloseable
- Enclosing class:
- UniqueBlockAgg
protected static class UniqueBlockAgg.UniqueBlockSlotAcc extends SlotAcc
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.apache.solr.search.facet.SlotAcc
SlotAcc.DoubleFuncSlotAcc, SlotAcc.FuncSlotAcc, SlotAcc.IntSlotAcc, SlotAcc.LongFuncSlotAcc, SlotAcc.Resizer, SlotAcc.SlotContext
-
-
Field Summary
Fields Modifier and Type Field Description protected int[]lastSeenValuesPerSlot-
Fields inherited from class org.apache.solr.search.facet.SlotAcc
currentDocBase, currentReaderContext, fcontext
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedUniqueBlockSlotAcc(FacetContext fcontext, SchemaField field, int numSlots)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcalcCounts()voidcollect(int doc, int slotNum, IntFunction<SlotAcc.SlotContext> slotContext)All subclasses must override this method to collect documents.protected voidcollectOrdToSlot(int slotNum, int ord)intcompare(int slotA, int slotB)longgetNonShardValue(int slot)Returns the current slot value as long This is used to get non-sharded valueObjectgetValue(int slot)protected org.apache.lucene.util.BytesReflookupOrd(int ord)voidreset()Called to reset the acc to a fresh state, ready for reusevoidresetIterators()Typically called from setNextReader to reset docValue iteratorsvoidresize(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.
-
-
-
Constructor Detail
-
UniqueBlockSlotAcc
protected UniqueBlockSlotAcc(FacetContext fcontext, SchemaField field, int numSlots) throws IOException
- Throws:
IOException
-
-
Method Detail
-
collectOrdToSlot
protected void collectOrdToSlot(int slotNum, int ord)
-
calcCounts
public void calcCounts()
-
reset
public void reset() throws IOExceptionDescription copied from class:SlotAccCalled to reset the acc to a fresh state, ready for reuse- Throws:
IOException
-
resize
public void resize(SlotAcc.Resizer resizer)
-
getValue
public Object getValue(int slot) throws IOException
- Throws:
IOException
-
getNonShardValue
public long getNonShardValue(int slot)
Returns the current slot value as long This is used to get non-sharded value
-
resetIterators
public void resetIterators() throws IOExceptionDescription copied from class:SlotAccTypically called from setNextReader to reset docValue iterators- Overrides:
resetIteratorsin classSlotAcc- Throws:
IOException
-
lookupOrd
protected org.apache.lucene.util.BytesRef lookupOrd(int ord) throws IOException- Throws:
IOException
-
setNextReader
public void setNextReader(org.apache.lucene.index.LeafReaderContext readerContext) throws IOExceptionDescription copied from class:SlotAccNOTE: 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.- Overrides:
setNextReaderin classSlotAcc- Throws:
IOException
-
collect
public void collect(int doc, int slotNum, IntFunction<SlotAcc.SlotContext> slotContext) throws IOExceptionDescription copied from class:SlotAccAll subclasses must override this method to collect documents. This method is called by the default impl ofSlotAcc.collect(DocSet, int, IntFunction)but it's also neccessary if this accumulator is used for sorting.- Specified by:
collectin classSlotAcc- Parameters:
doc- Single Segment docId (relative to the currentLeafReaderContextto collectslotNum- 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
-
-