Beispiel #1
0
        private void  WriteDoc()
        {
            if (IsFieldOpen())
            {
                throw new System.SystemException("Field is still open while writing document");
            }
            //System.out.println("Writing doc pointer: " + currentDocPointer);
            // write document index record
            tvx.WriteLong(currentDocPointer);

            // write document data record
            int size = fields.Count;

            // write the number of fields
            tvd.WriteVInt(size);

            // write field numbers
            for (int i = 0; i < size; i++)
            {
                TVField field = (TVField)fields[i];
                tvd.WriteVInt(field.number);
            }

            // write field pointers
            long lastFieldPointer = 0;

            for (int i = 0; i < size; i++)
            {
                TVField field = (TVField)fields[i];
                tvd.WriteVLong(field.tvfPointer - lastFieldPointer);
                lastFieldPointer = field.tvfPointer;
            }
            //System.out.println("After writing doc pointer: " + tvx.getFilePointer());
        }
Beispiel #2
0
 private void  OpenField(int fieldNumber, bool storePositionWithTermVector, bool storeOffsetWithTermVector)
 {
     if (!IsDocumentOpen())
     {
         throw new System.SystemException("Cannot open field when no document is open.");
     }
     CloseField();
     currentField = new TVField(fieldNumber, storePositionWithTermVector, storeOffsetWithTermVector);
 }
        /// <summary>Start processing a Field. This can be followed by a number of calls to
        /// addTerm, and a final call to closeField to indicate the end of
        /// processing of this Field. If a Field was previously open, it is
        /// closed automatically.
        /// </summary>
        public void  OpenField(System.String field)
        {
            if (!IsDocumentOpen())
            {
                throw new System.SystemException("Cannot open Field when no document is open.");
            }

            CloseField();
            currentField = new TVField(fieldInfos.FieldNumber(field));
        }
        /// <summary>Finished processing current Field. This should be followed by a call to
        /// openField before future calls to addTerm.
        /// </summary>
        public void  CloseField()
        {
            if (IsFieldOpen())
            {
                /* DEBUG */
                //System.out.println("closeField()");
                /* DEBUG */

                // save Field and terms
                WriteField();
                fields.Add(currentField);
                terms.Clear();
                currentField = null;
            }
        }
Beispiel #5
0
		/// <summary>Finished processing current Field. This should be followed by a call to
		/// openField before future calls to addTerm.
		/// </summary>
		public void  CloseField()
		{
			if (IsFieldOpen())
			{
				/* DEBUG */
				//System.out.println("closeField()");
				/* DEBUG */
				
				// save Field and terms
				WriteField();
				fields.Add(currentField);
				terms.Clear();
				currentField = null;
			}
		}
Beispiel #6
0
		/// <summary>Start processing a Field. This can be followed by a number of calls to
		/// addTerm, and a final call to closeField to indicate the end of
		/// processing of this Field. If a Field was previously open, it is
		/// closed automatically.
		/// </summary>
		public void  OpenField(System.String field)
		{
			if (!IsDocumentOpen())
				throw new System.SystemException("Cannot open Field when no document is open.");
			
			CloseField();
			currentField = new TVField(fieldInfos.FieldNumber(field));
		}
 private void OpenField(int fieldNumber, bool storePositionWithTermVector, bool storeOffsetWithTermVector)
 {
     if (!IsDocumentOpen())
         throw new System.SystemException("Cannot open field when no document is open.");
     CloseField();
     currentField = new TVField(fieldNumber, storePositionWithTermVector, storeOffsetWithTermVector);
 }