internal virtual SepDocsAndPositionsEnum Init(FieldInfo fieldInfo, SepTermState termState, Bits liveDocs) { _liveDocs = liveDocs; _storePayloads = fieldInfo.HasPayloads(); // TODO: can't we only do this if consumer skipped consuming the previous docs? _docIndex.CopyFrom(termState.DOC_INDEX); _docIndex.Seek(_docReader); _freqIndex.CopyFrom(termState.FREQ_INDEX); _freqIndex.Seek(_freqReader); _posIndex.CopyFrom(termState.POS_INDEX); _posSeekPending = true; _payloadPending = false; _payloadFp = termState.PAYLOAD_FP; _skipFp = termState.SKIP_FP; _docFreq = termState.DocFreq; _count = 0; _doc = -1; _accum = 0; _pendingPosCount = 0; _pendingPayloadBytes = 0; _skipped = false; return(this); }
internal virtual SepDocsEnum Init(FieldInfo fieldInfo, SepTermState termState, Bits liveDocs) { _liveDocs = liveDocs; if (fieldInfo.FieldIndexOptions.HasValue) { _indexOptions = fieldInfo.FieldIndexOptions.Value; } _omitTf = _indexOptions == FieldInfo.IndexOptions.DOCS_ONLY; _storePayloads = fieldInfo.HasPayloads(); // TODO: can't we only do this if consumer // skipped consuming the previous docs? _docIndex.CopyFrom(termState.DOC_INDEX); _docIndex.Seek(_docReader); if (!_omitTf) { _freqIndex.CopyFrom(termState.FREQ_INDEX); _freqIndex.Seek(_freqReader); } _docFreq = termState.DocFreq; // NOTE: unused if docFreq < skipMinimum: _skipFp = termState.SKIP_FP; _count = 0; _doc = -1; _accum = 0; _freq = 1; _skipped = false; return(this); }
public override int NextPosition() { if (_posSeekPending) { _posIndex.Seek(_posReader); _payloadIn.Seek(_payloadFp); _posSeekPending = false; } int code; // scan over any docs that were iterated without their positions while (_pendingPosCount > _freq) { code = _posReader.Next(); if (_storePayloads && (code & 1) != 0) { // Payload length has changed _payloadLength = _posReader.Next(); Debug.Assert(_payloadLength >= 0); } _pendingPosCount--; _position = 0; _pendingPayloadBytes += _payloadLength; } code = _posReader.Next(); if (_storePayloads) { if ((code & 1) != 0) { // Payload length has changed _payloadLength = _posReader.Next(); Debug.Assert(_payloadLength >= 0); } _position += (int)((uint)code >> 1); _pendingPayloadBytes += _payloadLength; _payloadPending = _payloadLength > 0; } else { _position += code; } _pendingPosCount--; Debug.Assert(_pendingPosCount >= 0); return(_position); }