

PostingAccumulator
- Namespace
- Rowles.LeanCorpus.Index.Indexer
- Assembly
- Rowles.LeanCorpus.dll
Accumulates doc IDs, term frequencies, and positions for a single qualified term during indexing. Uses ArrayPool-backed buffers to avoid GC pressure from repeated resize-copy-abandon cycles. Call ReturnBuffers() after flush to return rented arrays.
internal sealed class PostingAccumulator
PostingAccumulator()
Count
DocIds
EstimatedBytes
Estimated heap bytes consumed by this accumulator's pooled buffers, plus a fixed 64-byte overhead for the object itself. Cached and updated only when buffers grow, so reads are O(1).
HasFreqs
HasPayloads
HasPositions
Add(int, int)
AddDocOnly(int)
AddPositions(int, ReadOnlySpan<int>)
Bulk-appends a contiguous run of positions for a single doc. Equivalent to calling Add(int, int) once per position, but with a single capacity check and copy. Used by the concurrent merge path.
AddWithPayload(int, int, byte[]?)
GetFreq(int)
GetPayload(int, int)
GetPositions(int)
RemapDocIds(int[])
Translates doc IDs using the inverse permutation and re-sorts entries so doc IDs remain in ascending order (required by the postings codec).
ReturnBuffers()
Returns all pooled arrays. Call once after flush; do not use the accumulator afterwards.