22 namespace Lucene.Net.Index
34 internal int skipInterval;
35 internal int totalNumDocs;
37 internal bool omitTermFreqAndPositions;
38 internal bool storePayloads;
39 internal long freqStart;
46 state.flushedFiles.Add(fileName);
47 out_Renamed = parent.parent.dir.CreateOutput(fileName);
48 totalNumDocs = parent.parent.totalNumDocs;
51 skipInterval = parent.parent.termsOut.skipInterval;
52 skipListWriter = parent.parent.skipListWriter;
53 skipListWriter.SetFreqOutput(out_Renamed);
58 internal void SetField(
FieldInfo fieldInfo)
60 this.fieldInfo = fieldInfo;
61 omitTermFreqAndPositions = fieldInfo.omitTermFreqAndPositions;
62 storePayloads = fieldInfo.storePayloads;
63 posWriter.SetField(fieldInfo);
66 internal int lastDocID;
75 int delta = docID - lastDocID;
77 if (docID < 0 || (df > 0 && delta <= 0))
80 if ((++df % skipInterval) == 0)
83 skipListWriter.SetSkipData(lastDocID, storePayloads, posWriter.lastPayloadLength);
84 skipListWriter.BufferSkip(df);
87 System.Diagnostics.Debug.Assert(docID < totalNumDocs,
"docID=" + docID +
" totalNumDocs=" + totalNumDocs);
90 if (omitTermFreqAndPositions)
91 out_Renamed.WriteVInt(delta);
92 else if (1 == termDocFreq)
93 out_Renamed.WriteVInt((delta << 1) | 1);
96 out_Renamed.WriteVInt(delta << 1);
97 out_Renamed.WriteVInt(termDocFreq);
107 internal override void Finish()
109 long skipPointer = skipListWriter.WriteSkip(out_Renamed);
113 termInfo.Set(df, parent.freqStart, parent.proxStart, (
int) (skipPointer - parent.freqStart));
116 UnicodeUtil.UTF16toUTF8(parent.currentTerm, parent.currentTermStart, utf8);
120 parent.termsOut.Add(fieldInfo.number, utf8.result, utf8.length, termInfo);
127 public void Dispose()
130 out_Renamed.Dispose();