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 Fri, 20 Sep 2002 02:21:31 GMT
otis        2002/09/19 19:21:31

  Modified:    src/java/org/apache/lucene/index FieldsReader.java
  Log:
  - Reverted back to the previous revision (1.1).
  
  Revision  Changes    Path
  1.3       +43 -58    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.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- FieldsReader.java	19 Sep 2002 02:11:42 -0000	1.2
  +++ FieldsReader.java	20 Sep 2002 02:21:31 -0000	1.3
  @@ -63,66 +63,51 @@
   import org.apache.lucene.document.Document;
   import org.apache.lucene.document.Field;
   
  -/**
  - * 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;
  +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);
   
  -        fieldsStream = d.openFile(segment + ".fdt");
  -        indexStream = d.openFile(segment + ".fdx");
  +      byte bits = fieldsStream.readByte();
   
  -        // 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;
  -    }
  -
  -    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
  +      doc.add(new Field(fi.name,		  // name
   			fieldsStream.readString(), // read value
  -			true,			   // stored
  -			fi.isIndexed,		   // indexed
  -			(bits & 1) != 0));	   // tokenized
  -        }
  -
  -        return doc;
  +			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