public void  Write(Directory directory)
        {
            OutputStream output = directory.CreateFile("segments.new");

            try
            {
                output.WriteInt(FORMAT);     // write FORMAT
                output.WriteLong(++version); // every write changes the index
                output.WriteInt(counter);    // write counter
                output.WriteInt(Count);      // write infos
                for (int i = 0; i < Count; i++)
                {
                    SegmentInfo si = Info(i);
                    output.WriteString(si.name);
                    output.WriteInt(si.docCount);
                }
            }
            finally
            {
                output.Close();
            }

            // install new segment info
            directory.RenameFile("segments.new", "segments");
        }
Ejemplo n.º 2
0
		private void  Initialize(Directory directory, System.String segment, FieldInfos fis, bool isi)
		{
			fieldInfos = fis;
			isIndex = isi;
			output = directory.CreateFile(segment + (isIndex?".tii":".tis"));
			output.WriteInt(FORMAT); // write format
			output.WriteLong(0); // leave space for size
			output.WriteInt(indexInterval); // write indexInterval
			output.WriteInt(skipInterval); // write skipInterval
		}
Ejemplo n.º 3
0
 private void  Initialize(Directory directory, System.String segment, FieldInfos fis, bool isi)
 {
     fieldInfos = fis;
     isIndex    = isi;
     output     = directory.CreateFile(segment + (isIndex?".tii":".tis"));
     output.WriteInt(FORMAT);         // write format
     output.WriteLong(0);             // leave space for size
     output.WriteInt(indexInterval);  // write indexInterval
     output.WriteInt(skipInterval);   // write skipInterval
 }
        /// <summary>Writes this vector to the file <code>name</code> in Directory
        /// <code>d</code>, in a format that can be read by the constructor {@link
        /// #BitVector(Directory, String)}.
        /// </summary>
        public void  Write(Directory d, System.String name)
        {
            OutputStream output = d.CreateFile(name);

            try
            {
                output.WriteInt(Size());              // write size
                output.WriteInt(Count());             // write count
                output.WriteBytes(bits, bits.Length); // write bits
            }
            finally
            {
                output.Close();
            }
        }
        /// <summary>Create term vectors writer for the specified segment in specified
        /// directory.  A new TermVectorsWriter should be created for each
        /// segment. The parameter <code>maxFields</code> indicates how many total
        /// fields are found in this document. Not all of these fields may require
        /// termvectors to be stored, so the number of calls to
        /// <code>openField</code> is less or equal to this number.
        /// </summary>
        public TermVectorsWriter(Directory directory, System.String segment, FieldInfos fieldInfos)
        {
            // Open files for TermVector storage
            tvx = directory.CreateFile(segment + TVX_EXTENSION);
            tvx.WriteInt(FORMAT_VERSION);
            tvd = directory.CreateFile(segment + TVD_EXTENSION);
            tvd.WriteInt(FORMAT_VERSION);
            tvf = directory.CreateFile(segment + TVF_EXTENSION);
            tvf.WriteInt(FORMAT_VERSION);

            this.fieldInfos = fieldInfos;
            fields          = System.Collections.ArrayList.Synchronized(new System.Collections.ArrayList(fieldInfos.Size()));
            terms           = System.Collections.ArrayList.Synchronized(new System.Collections.ArrayList(10));
        }
Ejemplo n.º 6
0
		/// <summary>Create term vectors writer for the specified segment in specified
		/// directory.  A new TermVectorsWriter should be created for each
		/// segment. The parameter <code>maxFields</code> indicates how many total
		/// fields are found in this document. Not all of these fields may require
		/// termvectors to be stored, so the number of calls to
		/// <code>openField</code> is less or equal to this number.
		/// </summary>
		public TermVectorsWriter(Directory directory, System.String segment, FieldInfos fieldInfos)
		{
			// Open files for TermVector storage
			tvx = directory.CreateFile(segment + TVX_EXTENSION);
			tvx.WriteInt(FORMAT_VERSION);
			tvd = directory.CreateFile(segment + TVD_EXTENSION);
			tvd.WriteInt(FORMAT_VERSION);
			tvf = directory.CreateFile(segment + TVF_EXTENSION);
			tvf.WriteInt(FORMAT_VERSION);
			
			this.fieldInfos = fieldInfos;
			fields = System.Collections.ArrayList.Synchronized(new System.Collections.ArrayList(fieldInfos.Size()));
			terms = System.Collections.ArrayList.Synchronized(new System.Collections.ArrayList(10));
		}
        private void  WriteDeleteableFiles(System.Collections.ArrayList files)
        {
            OutputStream output = directory.CreateFile("deleteable.new");

            try
            {
                output.WriteInt(files.Count);
                for (int i = 0; i < files.Count; i++)
                {
                    output.WriteString((System.String)files[i]);
                }
            }
            finally
            {
                output.Close();
            }
            directory.RenameFile("deleteable.new", "deletable");
        }