From 474d9de9858f7c20bcdc2334c4e0b7788b54f385 Mon Sep 17 00:00:00 2001 From: Otis Gospodnetic Date: Fri, 20 Sep 2002 02:21:31 +0000 Subject: [PATCH] - Reverted back to the previous revision (1.1). git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@149858 13f79535-47bb-0310-9956-ffa450edef68 --- .../org/apache/lucene/index/FieldsReader.java | 89 ++++++++----------- 1 file changed, 37 insertions(+), 52 deletions(-) diff --git a/src/java/org/apache/lucene/index/FieldsReader.java b/src/java/org/apache/lucene/index/FieldsReader.java index 0377a8abff8..ff4cfac4f92 100644 --- a/src/java/org/apache/lucene/index/FieldsReader.java +++ b/src/java/org/apache/lucene/index/FieldsReader.java @@ -63,66 +63,51 @@ import org.apache.lucene.store.InputStream; import org.apache.lucene.document.Document; import org.apache.lucene.document.Field; -/** - * FIXME: Describe class FieldsReader here. - * - * @version $Id$ - */ -final class FieldsReader -{ - private FieldInfos fieldInfos; - private InputStream fieldsStream; - private InputStream indexStream; - private int size; +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; + FieldsReader(Directory d, String segment, FieldInfos fn) + throws IOException { + fieldInfos = fn; - fieldsStream = d.openFile(segment + ".fdt"); - indexStream = d.openFile(segment + ".fdx"); + fieldsStream = d.openFile(segment + ".fdt"); + indexStream = d.openFile(segment + ".fdx"); - // TODO: document the magic number 8 - size = (int)indexStream.length() / 8; - } + size = (int)indexStream.length() / 8; + } - final void close() - throws IOException - { - fieldsStream.close(); - indexStream.close(); - } + final void close() throws IOException { + fieldsStream.close(); + indexStream.close(); + } - final int size() - { - return size; - } + 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); + 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); - 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(); - 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; + } }