public abstract class SlotAcc extends Object implements Closeable
Modifier and Type | Class and Description |
---|---|
static class |
SlotAcc.Resizer |
static class |
SlotAcc.SlotContext
Incapsulates information about the current slot, for Accumulators that may want
additional info during collection.
|
Modifier and Type | Field and Description |
---|---|
protected int |
currentDocBase |
protected LeafReaderContext |
currentReaderContext |
protected org.apache.solr.search.facet.FacetContext |
fcontext |
Constructor and Description |
---|
SlotAcc(org.apache.solr.search.facet.FacetContext fcontext) |
Modifier and Type | Method and Description |
---|---|
void |
close() |
int |
collect(DocSet docs,
int slot,
IntFunction<SlotAcc.SlotContext> slotContext)
Bulk collection of all documents in a slot.
|
abstract void |
collect(int doc,
int slot,
IntFunction<SlotAcc.SlotContext> slotContext)
All subclasses must override this method to collect documents.
|
abstract int |
compare(int slotA,
int slotB) |
abstract Object |
getValue(int slotNum) |
abstract void |
reset()
Called to reset the acc to a fresh state, ready for reuse
|
protected void |
resetIterators()
Typically called from setNextReader to reset docValue iterators
|
abstract void |
resize(SlotAcc.Resizer resizer) |
void |
setNextReader(LeafReaderContext readerContext)
NOTE: this currently detects when it is being reused and calls resetIterators by comparing reader ords
with previous calls to setNextReader.
|
void |
setValues(SimpleOrderedMap<Object> bucket,
int slotNum) |
protected final org.apache.solr.search.facet.FacetContext fcontext
protected LeafReaderContext currentReaderContext
protected int currentDocBase
public void setNextReader(LeafReaderContext readerContext) throws IOException
IOException
public abstract void collect(int doc, int slot, IntFunction<SlotAcc.SlotContext> slotContext) throws IOException
collect(DocSet,int,IntFunction)
but it's also neccessary if this accumulator
is used for sorting.doc
- Single Segment docId (relative to the current LeafReaderContext
to 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 -- the IntFunction
is only garunteed to be valid for
the current slot, and the SlotAcc.SlotContext
returned is only valid for the duration
of the collect()
call.IOException
public int collect(DocSet docs, int slot, IntFunction<SlotAcc.SlotContext> slotContext) throws IOException
collect(int,int,IntFunction)
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 -- the IntFunction
is only garunteed to be valid for
the current slot, and the SlotAcc.SlotContext
returned is only valid for the duration
of the collect()
call.IOException
public abstract int compare(int slotA, int slotB)
public abstract Object getValue(int slotNum) throws IOException
IOException
public void setValues(SimpleOrderedMap<Object> bucket, int slotNum) throws IOException
IOException
public abstract void reset() throws IOException
IOException
protected void resetIterators() throws IOException
IOException
public abstract void resize(SlotAcc.Resizer resizer)
public void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
IOException
Copyright © 2000-2019 Apache Software Foundation. All Rights Reserved.