/// <exception cref="IOException"/> internal SepSkipListWriter(int skipInterval, int numberOfSkipLevels, int docCount, Int32IndexOutput freqOutput, Int32IndexOutput docOutput, Int32IndexOutput posOutput, IndexOutput payloadOutput) : base(skipInterval, numberOfSkipLevels, docCount) { this.freqOutput = freqOutput; this.posOutput = posOutput; this.payloadOutput = payloadOutput; lastSkipDoc = new int[numberOfSkipLevels]; lastSkipPayloadLength = new int[numberOfSkipLevels]; // TODO: -- also cutover normal IndexOutput to use getIndex()? lastSkipPayloadPointer = new long[numberOfSkipLevels]; freqIndex = new Int32IndexOutput.Index[numberOfSkipLevels]; docIndex = new Int32IndexOutput.Index[numberOfSkipLevels]; posIndex = new Int32IndexOutput.Index[numberOfSkipLevels]; for (int i = 0; i < numberOfSkipLevels; i++) { if (freqOutput != null) { freqIndex[i] = freqOutput.GetIndex(); } docIndex[i] = docOutput.GetIndex(); if (posOutput != null) { posIndex[i] = posOutput.GetIndex(); } } }
/// <exception cref="IOException"/> internal void SetPosOutput(Int32IndexOutput posOutput) { this.posOutput = posOutput; for (int i = 0; i < m_numberOfSkipLevels; i++) { posIndex[i] = posOutput.GetIndex(); } }
private SepTermState SetEmptyState() { SepTermState emptyState = new SepTermState(); emptyState.DocIndex = docOut.GetIndex(); if (indexOptions != IndexOptions.DOCS_ONLY) { emptyState.FreqIndex = freqOut.GetIndex(); if (indexOptions == IndexOptions.DOCS_AND_FREQS_AND_POSITIONS) { emptyState.PosIndex = posOut.GetIndex(); } } emptyState.PayloadFP = 0; emptyState.SkipFP = 0; return(emptyState); }
internal virtual void SetPosOutput(Int32IndexOutput posOutput) { _posOutput = posOutput; for (var i = 0; i < m_numberOfSkipLevels; i++) { _posIndex[i] = posOutput.GetIndex(); } }
public SepPostingsWriter(SegmentWriteState state, Int32StreamFactory factory, int skipInterval) { freqOut = null; freqIndex = null; posOut = null; posIndex = null; payloadOut = null; bool success = false; try { this.skipInterval = skipInterval; this.skipMinimum = skipInterval; /* set to the same for now */ string docFileName = IndexFileNames.SegmentFileName(state.SegmentInfo.Name, state.SegmentSuffix, DOC_EXTENSION); docOut = factory.CreateOutput(state.Directory, docFileName, state.Context); docIndex = docOut.GetIndex(); if (state.FieldInfos.HasFreq) { string frqFileName = IndexFileNames.SegmentFileName(state.SegmentInfo.Name, state.SegmentSuffix, FREQ_EXTENSION); freqOut = factory.CreateOutput(state.Directory, frqFileName, state.Context); freqIndex = freqOut.GetIndex(); } if (state.FieldInfos.HasProx) { string posFileName = IndexFileNames.SegmentFileName(state.SegmentInfo.Name, state.SegmentSuffix, POS_EXTENSION); posOut = factory.CreateOutput(state.Directory, posFileName, state.Context); posIndex = posOut.GetIndex(); // TODO: -- only if at least one field stores payloads? string payloadFileName = IndexFileNames.SegmentFileName(state.SegmentInfo.Name, state.SegmentSuffix, PAYLOAD_EXTENSION); payloadOut = state.Directory.CreateOutput(payloadFileName, state.Context); } string skipFileName = IndexFileNames.SegmentFileName(state.SegmentInfo.Name, state.SegmentSuffix, SKIP_EXTENSION); skipOut = state.Directory.CreateOutput(skipFileName, state.Context); totalNumDocs = state.SegmentInfo.DocCount; skipListWriter = new SepSkipListWriter(skipInterval, maxSkipLevels, totalNumDocs, freqOut, docOut, posOut, payloadOut); success = true; } finally { if (!success) { IOUtils.CloseWhileHandlingException(docOut, skipOut, freqOut, posOut, payloadOut); } } }