lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From o...@apache.org
Subject cvs commit: jakarta-lucene/src/java/org/apache/lucene/index FieldsReader.java
Date Thu, 19 Sep 2002 02:11:42 GMT
otis        2002/09/18 19:11:42

  Modified:    src/java/org/apache/lucene/index FieldsReader.java
  Log:
  - Added FIXME/TODO tags about things to document.
  
  Revision  Changes    Path
  1.2       +58 -43    jakarta-lucene/src/java/org/apache/lucene/index/FieldsReader.java
  
  Index: FieldsReader.java
  ===================================================================
  RCS file: /home/cvs/jakarta-lucene/src/java/org/apache/lucene/index/FieldsReader.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- FieldsReader.java	18 Sep 2001 16:29:52 -0000	1.1
  +++ FieldsReader.java	19 Sep 2002 02:11:42 -0000	1.2
  @@ -63,51 +63,66 @@
   import org.apache.lucene.document.Document;
   import org.apache.lucene.document.Field;
   
  -final class FieldsReader {
  -  private FieldInfos fieldInfos;
  -  private InputStream fieldsStream;
  -  private InputStream indexStream;
  -  private int size;
  -
  -  FieldsReader(Directory d, String segment, FieldInfos fn)
  -       throws IOException {
  -    fieldInfos = fn;
  -
  -    fieldsStream = d.openFile(segment + ".fdt");
  -    indexStream = d.openFile(segment + ".fdx");
  -
  -    size = (int)indexStream.length() / 8;
  -  }
  -
  -  final void close() throws IOException {
  -    fieldsStream.close();
  -    indexStream.close();
  -  }
  -
  -  final int size() {
  -    return size;
  -  }
  -
  -  final Document doc(int n) throws IOException {
  -    indexStream.seek(n * 8L);
  -    long position = indexStream.readLong();
  -    fieldsStream.seek(position);
  -    
  -    Document doc = new Document();
  -    int numFields = fieldsStream.readVInt();
  -    for (int i = 0; i < numFields; i++) {
  -      int fieldNumber = fieldsStream.readVInt();
  -      FieldInfo fi = fieldInfos.fieldInfo(fieldNumber);
  +/**
  + * FIXME: Describe class <code>FieldsReader</code> here.
  + *
  + * @version $Id$
  + */
  +final class FieldsReader
  +{
  +    private FieldInfos fieldInfos;
  +    private InputStream fieldsStream;
  +    private InputStream indexStream;
  +    private int size;
  +
  +    FieldsReader(Directory d, String segment, FieldInfos fn)
  +        throws IOException
  +    {
  +        fieldInfos = fn;
   
  -      byte bits = fieldsStream.readByte();
  +        fieldsStream = d.openFile(segment + ".fdt");
  +        indexStream = d.openFile(segment + ".fdx");
   
  -      doc.add(new Field(fi.name,		  // name
  -			fieldsStream.readString(), // read value
  -			true,			  // stored
  -			fi.isIndexed,		  // indexed
  -			(bits & 1) != 0));	  // tokenized
  +        // TODO: document the magic number 8
  +        size = (int)indexStream.length() / 8;
  +    }
  +
  +    final void close()
  +        throws IOException
  +    {
  +        fieldsStream.close();
  +        indexStream.close();
  +    }
  +
  +    final int size()
  +    {
  +        return size;
       }
   
  -    return doc;
  -  }
  +    final Document doc(int n)
  +        throws IOException
  +    {
  +        // TODO: document the magic number 8L
  +        indexStream.seek(n * 8L);
  +        long position = indexStream.readLong();
  +        fieldsStream.seek(position);
  +
  +        Document doc = new Document();
  +        int numFields = fieldsStream.readVInt();
  +        for (int i = 0; i < numFields; i++)
  +        {
  +            int fieldNumber = fieldsStream.readVInt();
  +            FieldInfo fi = fieldInfos.fieldInfo(fieldNumber);
  +
  +            byte bits = fieldsStream.readByte();
  +
  +            doc.add(new Field(fi.name, 		   // name
  +			fieldsStream.readString(), // read value
  +			true,			   // stored
  +			fi.isIndexed,		   // indexed
  +			(bits & 1) != 0));	   // tokenized
  +        }
  +
  +        return doc;
  +    }
   }
  
  
  

--
To unsubscribe, e-mail:   <mailto:lucene-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:lucene-dev-help@jakarta.apache.org>


Mime
View raw message