Example #1
0
        /// <summary>
        /// Save a single segment's info. </summary>
        public override void Write(Directory dir, SegmentInfo si, FieldInfos fis, IOContext ioContext)
        {
            string fileName = IndexFileNames.SegmentFileName(si.Name, "", Lucene46SegmentInfoFormat.SI_EXTENSION);

            si.AddFile(fileName);

            IndexOutput output = dir.CreateOutput(fileName, ioContext);

            bool success = false;

            try
            {
                CodecUtil.WriteHeader(output, Lucene46SegmentInfoFormat.CODEC_NAME, Lucene46SegmentInfoFormat.VERSION_CURRENT);
                // Write the Lucene version that created this segment, since 3.1
                output.WriteString(si.Version);
                output.WriteInt32(si.DocCount);

                output.WriteByte((byte)(sbyte)(si.UseCompoundFile ? SegmentInfo.YES : SegmentInfo.NO));
                output.WriteStringStringMap(si.Diagnostics);
                output.WriteStringSet(si.GetFiles());
                CodecUtil.WriteFooter(output);
                success = true;
            }
            finally
            {
                if (!success)
                {
                    IOUtils.DisposeWhileHandlingException(output);
                    si.Dir.DeleteFile(fileName);
                }
                else
                {
                    output.Dispose();
                }
            }
        }
 public override StoredFieldsWriter FieldsWriter(Directory directory, SegmentInfo si, IOContext context)
 {
     return(new Lucene40StoredFieldsWriter(directory, si.Name, context));
 }
 public override StoredFieldsReader FieldsReader(Directory directory, SegmentInfo si, FieldInfos fn, IOContext context)
 {
     return(new Lucene40StoredFieldsReader(directory, si, fn, context));
 }
Example #4
0
 /// <summary>
 /// Returns a <see cref="StoredFieldsReader"/> to load stored
 /// fields.
 /// </summary>
 public abstract StoredFieldsReader FieldsReader(Directory directory, SegmentInfo si, FieldInfos fn, IOContext context);
Example #5
0
 /// <summary>
 /// Returns a <see cref="StoredFieldsWriter"/> to write stored
 /// fields.
 /// </summary>
 public abstract StoredFieldsWriter FieldsWriter(Directory directory, SegmentInfo si, IOContext context);
Example #6
0
 public override StoredFieldsReader FieldsReader(Directory directory, SegmentInfo si, FieldInfos fn, IOContext context)
 {
     return(new CompressingStoredFieldsReader(directory, si, segmentSuffix, fn, context, formatName, compressionMode));
 }
Example #7
0
 public override StoredFieldsWriter FieldsWriter(Directory directory, SegmentInfo si, IOContext context)
 {
     return(new CompressingStoredFieldsWriter(directory, si, segmentSuffix, context, formatName, compressionMode, chunkSize));
 }
Example #8
0
 /// <summary>
 /// Returns a <see cref="TermVectorsWriter"/> to write term
 /// vectors.
 /// </summary>
 public abstract TermVectorsWriter VectorsWriter(Directory directory, SegmentInfo segmentInfo, IOContext context);
Example #9
0
 /// <summary>
 /// Returns a <see cref="TermVectorsReader"/> to read term
 /// vectors.
 /// </summary>
 public abstract TermVectorsReader VectorsReader(Directory directory, SegmentInfo segmentInfo, FieldInfos fieldInfos, IOContext context);
Example #10
0
 /// <summary>
 /// Write <see cref="SegmentInfo"/> data. </summary>
 /// <exception cref="System.IO.IOException"> If an I/O error occurs. </exception>
 public abstract void Write(Directory dir, SegmentInfo info, FieldInfos fis, IOContext ioContext);
 public override TermVectorsWriter VectorsWriter(Directory directory, SegmentInfo segmentInfo, IOContext context)
 {
     return(new Lucene40TermVectorsWriter(directory, segmentInfo.Name, context));
 }
 public override TermVectorsReader VectorsReader(Directory directory, SegmentInfo segmentInfo, FieldInfos fieldInfos, IOContext context)
 {
     return(new Lucene40TermVectorsReader(directory, segmentInfo, fieldInfos, context));
 }