22 namespace Lucene.Net.Index
32 private int[] lastSkipDoc;
33 private int[] lastSkipPayloadLength;
34 private long[] lastSkipFreqPointer;
35 private long[] lastSkipProxPointer;
41 private bool curStorePayloads;
42 private int curPayloadLength;
43 private long curFreqPointer;
44 private long curProxPointer;
48 this.freqOutput = freqOutput;
49 this.proxOutput = proxOutput;
51 lastSkipDoc =
new int[numberOfSkipLevels];
52 lastSkipPayloadLength =
new int[numberOfSkipLevels];
53 lastSkipFreqPointer =
new long[numberOfSkipLevels];
54 lastSkipProxPointer =
new long[numberOfSkipLevels];
57 internal virtual void SetFreqOutput(
IndexOutput freqOutput)
59 this.freqOutput = freqOutput;
62 internal virtual void SetProxOutput(
IndexOutput proxOutput)
64 this.proxOutput = proxOutput;
68 internal virtual void SetSkipData(
int doc,
bool storePayloads,
int payloadLength)
71 this.curStorePayloads = storePayloads;
72 this.curPayloadLength = payloadLength;
73 this.curFreqPointer = freqOutput.FilePointer;
74 if (proxOutput != null)
75 this.curProxPointer = proxOutput.FilePointer;
78 protected internal override void ResetSkip()
81 for (
int i = 0; i < lastSkipDoc.Length; i++) lastSkipDoc[i] = 0;
82 for (
int i = 0; i < lastSkipPayloadLength.Length; i++) lastSkipPayloadLength[i] = -1;
83 for (
int i = 0; i < lastSkipFreqPointer.Length; i++) lastSkipFreqPointer[i] = freqOutput.FilePointer;
84 if (proxOutput != null)
85 for (
int i = 0; i < lastSkipProxPointer.Length; i++) lastSkipProxPointer[i] = proxOutput.FilePointer;
88 protected internal override void WriteSkipData(
int level,
IndexOutput skipBuffer)
110 if (curStorePayloads)
112 int delta = curDoc - lastSkipDoc[level];
113 if (curPayloadLength == lastSkipPayloadLength[level])
117 skipBuffer.WriteVInt(delta * 2);
123 skipBuffer.WriteVInt(delta * 2 + 1);
124 skipBuffer.WriteVInt(curPayloadLength);
125 lastSkipPayloadLength[level] = curPayloadLength;
131 skipBuffer.WriteVInt(curDoc - lastSkipDoc[level]);
133 skipBuffer.WriteVInt((
int) (curFreqPointer - lastSkipFreqPointer[level]));
134 skipBuffer.WriteVInt((
int) (curProxPointer - lastSkipProxPointer[level]));
136 lastSkipDoc[level] = curDoc;
139 lastSkipFreqPointer[level] = curFreqPointer;
140 lastSkipProxPointer[level] = curProxPointer;