//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public FSTOrdTermsWriter(org.apache.lucene.index.SegmentWriteState state, org.apache.lucene.codecs.PostingsWriterBase postingsWriter) throws java.io.IOException public FSTOrdTermsWriter(SegmentWriteState state, PostingsWriterBase postingsWriter) { //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final String termsIndexFileName = org.apache.lucene.index.IndexFileNames.segmentFileName(state.segmentInfo.name, state.segmentSuffix, TERMS_INDEX_EXTENSION); string termsIndexFileName = IndexFileNames.segmentFileName(state.segmentInfo.name, state.segmentSuffix, TERMS_INDEX_EXTENSION); //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final String termsBlockFileName = org.apache.lucene.index.IndexFileNames.segmentFileName(state.segmentInfo.name, state.segmentSuffix, TERMS_BLOCK_EXTENSION); string termsBlockFileName = IndexFileNames.segmentFileName(state.segmentInfo.name, state.segmentSuffix, TERMS_BLOCK_EXTENSION); this.postingsWriter = postingsWriter; this.fieldInfos = state.fieldInfos; bool success = false; try { this.indexOut = state.directory.createOutput(termsIndexFileName, state.context); this.blockOut = state.directory.createOutput(termsBlockFileName, state.context); writeHeader(indexOut); writeHeader(blockOut); this.postingsWriter.init(blockOut); success = true; } finally { if (!success) { IOUtils.closeWhileHandlingException(indexOut, blockOut); } } }
public FSTTermsWriter(SegmentWriteState state, PostingsWriterBase postingsWriter) { var termsFileName = IndexFileNames.SegmentFileName(state.SegmentInfo.Name, state.SegmentSuffix, TERMS_EXTENSION); _postingsWriter = postingsWriter; _fieldInfos = state.FieldInfos; _output = state.Directory.CreateOutput(termsFileName, state.Context); var success = false; try { WriteHeader(_output); _postingsWriter.Init(_output); success = true; } finally { if (!success) { IOUtils.DisposeWhileHandlingException(_output); } } }
// private final String segment; public BlockTermsWriter(TermsIndexWriterBase termsIndexWriter, SegmentWriteState state, PostingsWriterBase postingsWriter) { string termsFileName = IndexFileNames.SegmentFileName(state.SegmentInfo.Name, state.SegmentSuffix, TERMS_EXTENSION); this.termsIndexWriter = termsIndexWriter; m_output = state.Directory.CreateOutput(termsFileName, state.Context); bool success = false; try { //fieldInfos = state.FieldInfos; // LUCENENET: Not used WriteHeader(m_output); currentField = null; this.postingsWriter = postingsWriter; // segment = state.segmentName; //System.out.println("BTW.init seg=" + state.segmentName); postingsWriter.Init(m_output); // have consumer write its format/header success = true; } finally { if (!success) { IOUtils.DisposeWhileHandlingException(m_output); } } }
public BlockTermsWriter(TermsIndexWriterBase termsIndexWriter, SegmentWriteState state, PostingsWriterBase postingsWriter) { var termsFileName = IndexFileNames.SegmentFileName(state.SegmentInfo.Name, state.SegmentSuffix, TERMS_EXTENSION); _termsIndexWriter = termsIndexWriter; _output = state.Directory.CreateOutput(termsFileName, state.Context); var success = false; try { FieldInfos = state.FieldInfos; WriteHeader(_output); CurrentField = null; PostingsWriter = postingsWriter; postingsWriter.Init(_output); // have consumer write its format/header success = true; } finally { if (!success) { IOUtils.CloseWhileHandlingException(_output); } } }
public override FieldsConsumer FieldsConsumer(SegmentWriteState state) { PostingsWriterBase docsWriter = null; PostingsWriterBase pulsingWriterInner = null; PostingsWriterBase pulsingWriter = null; // Terms dict bool success = false; try { docsWriter = new Lucene41PostingsWriter(state); pulsingWriterInner = new PulsingPostingsWriter(state, 2, docsWriter); pulsingWriter = new PulsingPostingsWriter(state, 1, pulsingWriterInner); FieldsConsumer ret = new BlockTreeTermsWriter(state, pulsingWriter, BlockTreeTermsWriter.DEFAULT_MIN_BLOCK_SIZE, BlockTreeTermsWriter.DEFAULT_MAX_BLOCK_SIZE); success = true; return(ret); } finally { if (!success) { IOUtils.DisposeWhileHandlingException(docsWriter, pulsingWriterInner, pulsingWriter); } } }
private readonly IndexOutput indexOut = null; // LUCENENET: marked readonly #pragma warning restore CA2213 // Disposable fields should be disposed public FSTOrdTermsWriter(SegmentWriteState state, PostingsWriterBase postingsWriter) { var termsIndexFileName = IndexFileNames.SegmentFileName(state.SegmentInfo.Name, state.SegmentSuffix, TERMS_INDEX_EXTENSION); var termsBlockFileName = IndexFileNames.SegmentFileName(state.SegmentInfo.Name, state.SegmentSuffix, TERMS_BLOCK_EXTENSION); this.postingsWriter = postingsWriter; //fieldInfos = state.FieldInfos; // LUCENENET: Never read var success = false; try { indexOut = state.Directory.CreateOutput(termsIndexFileName, state.Context); blockOut = state.Directory.CreateOutput(termsBlockFileName, state.Context); WriteHeader(indexOut); WriteHeader(blockOut); this.postingsWriter.Init(blockOut); success = true; } finally { if (!success) { IOUtils.DisposeWhileHandlingException(indexOut, blockOut); } } }
public override FieldsConsumer FieldsConsumer(SegmentWriteState state) { PostingsWriterBase docsWriter = null; // Terms that have <= freqCutoff number of docs are // "pulsed" (inlined): PostingsWriterBase pulsingWriter = null; // Terms dict bool success = false; try { docsWriter = _wrappedPostingsBaseFormat.PostingsWriterBase(state); // Terms that have <= freqCutoff number of docs are // "pulsed" (inlined): pulsingWriter = new PulsingPostingsWriter(state, _freqCutoff, docsWriter); FieldsConsumer ret = new BlockTreeTermsWriter(state, pulsingWriter, _minBlockSize, _maxBlockSize); success = true; return(ret); } finally { if (!success) { IOUtils.CloseWhileHandlingException(docsWriter, pulsingWriter); } } }
/// <summary> /// If the total number of positions (summed across all docs /// for this term) is less than or equal maxPositions, then the postings are /// inlined into terms dict /// </summary> public PulsingPostingsWriter(SegmentWriteState state, int maxPositions, PostingsWriterBase wrappedPostingsWriter) { _pending = new Position[maxPositions]; for (var i = 0; i < maxPositions; i++) { _pending[i] = new Position(); } _fields = new List <FieldMetaData>(); // We simply wrap another postings writer, but only call // on it when tot positions is >= the cutoff: _wrappedPostingsWriter = wrappedPostingsWriter; _segmentState = state; }
public TermsWriter( TermsIndexWriterBase.FieldWriter fieldIndexWriter, FieldInfo fieldInfo, PostingsWriterBase postingsWriter, BlockTermsWriter btw) { _fieldInfo = fieldInfo; _fieldIndexWriter = fieldIndexWriter; _btw = btw; _pendingTerms = new TermEntry[32]; for (int i = 0; i < _pendingTerms.Length; i++) { _pendingTerms[i] = new TermEntry(); } _termsStartPointer = _btw._output.FilePointer; _postingsWriter = postingsWriter; _longsSize = postingsWriter.SetField(fieldInfo); }
internal TermsWriter( BlockTermsWriter outerInstance, TermsIndexWriterBase.FieldWriter fieldIndexWriter, FieldInfo fieldInfo, PostingsWriterBase postingsWriter) { this.outerInstance = outerInstance; this.fieldInfo = fieldInfo; this.fieldIndexWriter = fieldIndexWriter; pendingTerms = new TermEntry[32]; for (int i = 0; i < pendingTerms.Length; i++) { pendingTerms[i] = new TermEntry(); } termsStartPointer = outerInstance.m_output.Position; // LUCENENET specific: Renamed from getFilePointer() to match FileStream this.postingsWriter = postingsWriter; this.longsSize = postingsWriter.SetField(fieldInfo); }
internal TermsWriter( BlockTermsWriter outerInstance, TermsIndexWriterBase.FieldWriter fieldIndexWriter, FieldInfo fieldInfo, PostingsWriterBase postingsWriter) { this.outerInstance = outerInstance; this.fieldInfo = fieldInfo; this.fieldIndexWriter = fieldIndexWriter; pendingTerms = new TermEntry[32]; for (int i = 0; i < pendingTerms.Length; i++) { pendingTerms[i] = new TermEntry(); } termsStartPointer = outerInstance.m_output.GetFilePointer(); this.postingsWriter = postingsWriter; this.longsSize = postingsWriter.SetField(fieldInfo); }
public override FieldsConsumer FieldsConsumer(SegmentWriteState state) { PostingsWriterBase docsWriter = null; PostingsWriterBase pulsingWriter = null; bool success = false; try { docsWriter = _wrappedPostingsBaseFormat.PostingsWriterBase(state); pulsingWriter = new PulsingPostingsWriter(state, _freqCutoff, docsWriter); FieldsConsumer ret = new FSTOrdTermsWriter(state, pulsingWriter); success = true; return(ret); } finally { if (!success) { IOUtils.CloseWhileHandlingException(docsWriter, pulsingWriter); } } }
public FSTTermsWriter(SegmentWriteState state, PostingsWriterBase postingsWriter) { var termsFileName = IndexFileNames.SegmentFileName(state.SegmentInfo.Name, state.SegmentSuffix, TERMS_EXTENSION); _postingsWriter = postingsWriter; _fieldInfos = state.FieldInfos; _output = state.Directory.CreateOutput(termsFileName, state.Context); var success = false; try { WriteHeader(_output); _postingsWriter.Init(_output); success = true; } finally { if (!success) { IOUtils.CloseWhileHandlingException(_output); } } }
public FSTOrdTermsWriter(SegmentWriteState state, PostingsWriterBase postingsWriter) { var termsIndexFileName = IndexFileNames.SegmentFileName(state.SegmentInfo.Name, state.SegmentSuffix, TERMS_INDEX_EXTENSION); var termsBlockFileName = IndexFileNames.SegmentFileName(state.SegmentInfo.Name, state.SegmentSuffix, TERMS_BLOCK_EXTENSION); this.postingsWriter = postingsWriter; fieldInfos = state.FieldInfos; var success = false; try { indexOut = state.Directory.CreateOutput(termsIndexFileName, state.Context); blockOut = state.Directory.CreateOutput(termsBlockFileName, state.Context); WriteHeader(indexOut); WriteHeader(blockOut); this.postingsWriter.Init(blockOut); success = true; } finally { if (!success) { IOUtils.CloseWhileHandlingException(indexOut, blockOut); } } }
TermsWriter( TermsIndexWriterBase.FieldWriter fieldIndexWriter, FieldInfo fieldInfo, PostingsWriterBase postingsWriter) { this.fieldInfo = fieldInfo; this.fieldIndexWriter = fieldIndexWriter; pendingTerms = new TermEntry[32]; for(int i=0;i<pendingTerms.length;i++) { pendingTerms[i] = new TermEntry(); } termsStartPointer = out.getFilePointer(); this.postingsWriter = postingsWriter; this.longsSize = postingsWriter.setField(fieldInfo); }
/// <summary> /// If the total number of positions (summed across all docs /// for this term) is <= maxPositions, then the postings are /// inlined into terms dict /// </summary> public PulsingPostingsWriter(SegmentWriteState state, int maxPositions, PostingsWriterBase wrappedPostingsWriter) { pending = new Position[maxPositions]; for (int i = 0; i < maxPositions; i++) { pending[i] = new Position(); } fields = new List<FieldMetaData>(); // We simply wrap another postings writer, but only call // on it when tot positions is >= the cutoff: this._wrappedPostingsWriter = wrappedPostingsWriter; this.segmentState = state; }