internal DirectDocValuesConsumer(SegmentWriteState state, string dataCodec, string dataExtension, string metaCodec, string metaExtension) { maxDoc = state.SegmentInfo.DocCount; bool success = false; try { string dataName = IndexFileNames.SegmentFileName(state.SegmentInfo.Name, state.SegmentSuffix, dataExtension); data = state.Directory.CreateOutput(dataName, state.Context); CodecUtil.WriteHeader(data, dataCodec, DirectDocValuesProducer.VERSION_CURRENT); string metaName = IndexFileNames.SegmentFileName(state.SegmentInfo.Name, state.SegmentSuffix, metaExtension); meta = state.Directory.CreateOutput(metaName, state.Context); CodecUtil.WriteHeader(meta, metaCodec, DirectDocValuesProducer.VERSION_CURRENT); success = true; } finally { if (!success) { IOUtils.CloseWhileHandlingException(this); } } }
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 override FieldsConsumer FieldsConsumer(SegmentWriteState state) { PostingsWriterBase postingsWriter = new Lucene41PostingsWriter(state); bool success = false; try { FieldsConsumer ret = new FSTTermsWriter(state, postingsWriter); success = true; return ret; } finally { if (!success) { IOUtils.CloseWhileHandlingException(postingsWriter); } } }
public override FieldsConsumer FieldsConsumer(SegmentWriteState state) { PostingsWriterBase postingsWriter = new Lucene41PostingsWriter(state); bool success = false; try { FieldsConsumer ret = new FSTTermsWriter(state, postingsWriter); success = true; return(ret); } finally { if (!success) { IOUtils.DisposeWhileHandlingException(postingsWriter); } } }
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 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 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); } } }
public override FieldsConsumer FieldsConsumer(SegmentWriteState state) { return new SimpleTextFieldsWriter(state); }
public override DocValuesConsumer FieldsConsumer(SegmentWriteState state) { return(new SimpleTextDocValuesWriter(state, "dat")); }
/// <summary> /// Creates a postings writer with <code>PackedInts.COMPACT</code> </summary> public Lucene41PostingsWriter(SegmentWriteState state) : this(state, PackedInts.COMPACT) { }
/// <summary> /// Creates a postings writer with the specified PackedInts overhead ratio </summary> // TODO: does this ctor even make sense? public Lucene41PostingsWriter(SegmentWriteState state, float acceptableOverheadRatio) : base() { DocOut = state.Directory.CreateOutput(IndexFileNames.SegmentFileName(state.SegmentInfo.Name, state.SegmentSuffix, Lucene41PostingsFormat.DOC_EXTENSION), state.Context); IndexOutput posOut = null; IndexOutput payOut = null; bool success = false; try { CodecUtil.WriteHeader(DocOut, DOC_CODEC, VERSION_CURRENT); ForUtil = new ForUtil(acceptableOverheadRatio, DocOut); if (state.FieldInfos.HasProx()) { PosDeltaBuffer = new int[ForUtil.MAX_DATA_SIZE]; posOut = state.Directory.CreateOutput(IndexFileNames.SegmentFileName(state.SegmentInfo.Name, state.SegmentSuffix, Lucene41PostingsFormat.POS_EXTENSION), state.Context); CodecUtil.WriteHeader(posOut, POS_CODEC, VERSION_CURRENT); if (state.FieldInfos.HasPayloads()) { PayloadBytes = new sbyte[128]; PayloadLengthBuffer = new int[ForUtil.MAX_DATA_SIZE]; } else { PayloadBytes = null; PayloadLengthBuffer = null; } if (state.FieldInfos.HasOffsets()) { OffsetStartDeltaBuffer = new int[ForUtil.MAX_DATA_SIZE]; OffsetLengthBuffer = new int[ForUtil.MAX_DATA_SIZE]; } else { OffsetStartDeltaBuffer = null; OffsetLengthBuffer = null; } if (state.FieldInfos.HasPayloads() || state.FieldInfos.HasOffsets()) { payOut = state.Directory.CreateOutput(IndexFileNames.SegmentFileName(state.SegmentInfo.Name, state.SegmentSuffix, Lucene41PostingsFormat.PAY_EXTENSION), state.Context); CodecUtil.WriteHeader(payOut, PAY_CODEC, VERSION_CURRENT); } } else { PosDeltaBuffer = null; PayloadLengthBuffer = null; OffsetStartDeltaBuffer = null; OffsetLengthBuffer = null; PayloadBytes = null; } this.PayOut = payOut; this.PosOut = posOut; success = true; } finally { if (!success) { IOUtils.CloseWhileHandlingException(DocOut, posOut, payOut); } } DocDeltaBuffer = new int[ForUtil.MAX_DATA_SIZE]; FreqBuffer = new int[ForUtil.MAX_DATA_SIZE]; // TODO: should we try skipping every 2/4 blocks...? SkipWriter = new Lucene41SkipWriter(MaxSkipLevels, Lucene41PostingsFormat.BLOCK_SIZE, state.SegmentInfo.DocCount, DocOut, posOut, payOut); Encoded = new byte[ForUtil.MAX_ENCODED_SIZE]; }
/// <summary> /// Creates a postings writer with the specified PackedInts overhead ratio </summary> // TODO: does this ctor even make sense? public Lucene41PostingsWriter(SegmentWriteState state, float acceptableOverheadRatio) : base() { DocOut = state.Directory.CreateOutput(IndexFileNames.SegmentFileName(state.SegmentInfo.Name, state.SegmentSuffix, Lucene41PostingsFormat.DOC_EXTENSION), state.Context); IndexOutput posOut = null; IndexOutput payOut = null; bool success = false; try { CodecUtil.WriteHeader(DocOut, DOC_CODEC, VERSION_CURRENT); ForUtil = new ForUtil(acceptableOverheadRatio, DocOut); if (state.FieldInfos.HasProx()) { PosDeltaBuffer = new int[ForUtil.MAX_DATA_SIZE]; posOut = state.Directory.CreateOutput(IndexFileNames.SegmentFileName(state.SegmentInfo.Name, state.SegmentSuffix, Lucene41PostingsFormat.POS_EXTENSION), state.Context); CodecUtil.WriteHeader(posOut, POS_CODEC, VERSION_CURRENT); if (state.FieldInfos.HasPayloads()) { PayloadBytes = new byte[128]; PayloadLengthBuffer = new int[ForUtil.MAX_DATA_SIZE]; } else { PayloadBytes = null; PayloadLengthBuffer = null; } if (state.FieldInfos.HasOffsets()) { OffsetStartDeltaBuffer = new int[ForUtil.MAX_DATA_SIZE]; OffsetLengthBuffer = new int[ForUtil.MAX_DATA_SIZE]; } else { OffsetStartDeltaBuffer = null; OffsetLengthBuffer = null; } if (state.FieldInfos.HasPayloads() || state.FieldInfos.HasOffsets()) { payOut = state.Directory.CreateOutput(IndexFileNames.SegmentFileName(state.SegmentInfo.Name, state.SegmentSuffix, Lucene41PostingsFormat.PAY_EXTENSION), state.Context); CodecUtil.WriteHeader(payOut, PAY_CODEC, VERSION_CURRENT); } } else { PosDeltaBuffer = null; PayloadLengthBuffer = null; OffsetStartDeltaBuffer = null; OffsetLengthBuffer = null; PayloadBytes = null; } this.PayOut = payOut; this.PosOut = posOut; success = true; } finally { if (!success) { IOUtils.CloseWhileHandlingException(DocOut, posOut, payOut); } } DocDeltaBuffer = new int[ForUtil.MAX_DATA_SIZE]; FreqBuffer = new int[ForUtil.MAX_DATA_SIZE]; // TODO: should we try skipping every 2/4 blocks...? SkipWriter = new Lucene41SkipWriter(MaxSkipLevels, Lucene41PostingsFormat.BLOCK_SIZE, state.SegmentInfo.DocCount, DocOut, posOut, payOut); Encoded = new byte[ForUtil.MAX_ENCODED_SIZE]; }
public override FieldsConsumer FieldsConsumer(SegmentWriteState state) { return(new SimpleTextFieldsWriter(state)); }
public override DocValuesConsumer NormsConsumer(SegmentWriteState state) { return new SimpleTextNormsConsumer(state); }
public override DocValuesConsumer FieldsConsumer(SegmentWriteState state) { return new DirectDocValuesConsumer(state, DATA_CODEC, DATA_EXTENSION, METADATA_CODEC, METADATA_EXTENSION); }
private readonly HashSet <string> _fieldsSeen = new HashSet <string>(); // for asserting public SimpleTextDocValuesWriter(SegmentWriteState state, string ext) { data = state.Directory.CreateOutput( IndexFileNames.SegmentFileName(state.SegmentInfo.Name, state.SegmentSuffix, ext), state.Context); numDocs = state.SegmentInfo.DocCount; }
private readonly HashSet<string> _fieldsSeen = new HashSet<string>(); // for asserting public SimpleTextDocValuesWriter(SegmentWriteState state, string ext) { data = state.Directory.CreateOutput( IndexFileNames.SegmentFileName(state.SegmentInfo.Name, state.SegmentSuffix, ext), state.Context); numDocs = state.SegmentInfo.DocCount; }
public SimpleTextNormsConsumer(SegmentWriteState state) : base(state, NORMS_SEG_EXTENSION) { // All we do is change the extension from .dat -> .len; // otherwise this is a normal simple doc values file: }
public override DocValuesConsumer NormsConsumer(SegmentWriteState state) { return(new SimpleTextNormsConsumer(state)); }
public override DocValuesConsumer FieldsConsumer(SegmentWriteState state) { return(new DirectDocValuesConsumer(state, DATA_CODEC, DATA_EXTENSION, METADATA_CODEC, METADATA_EXTENSION)); }
public override DocValuesConsumer FieldsConsumer(SegmentWriteState state) { return new SimpleTextDocValuesWriter(state, "dat"); }
public override FieldsConsumer FieldsConsumer(SegmentWriteState state) { return ForName("Lucene41").FieldsConsumer(state); }