Mailing List Archive

cvs commit: jakarta-lucene/src/java/org/apache/lucene/index FieldsReader.java
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>
Re: cvs commit: jakarta-lucene/src/java/org/apache/lucene/index FieldsReader.java [ In reply to ]
I'll put the old file back

--- Doug Cutting <cutting@lucene.com> wrote:
> Otis,
>
> I really appreciate all of the work you do on Lucene. However
> sometimes
> I have to disagree.
>
> otis@apache.org wrote:
> > - Added FIXME/TODO tags about things to document.
>
> While documentation in a package private class is nice, it is not an
> absolute requirement. So I don't think this warrants a FIXME
> comment.
>
> > -final class FieldsReader {
> > +final class FieldsReader
> > +{
>
> You also re-indented the code and your indentation style violates
> standard Java style. In Java, opening braces go with the previous
> line,
> not on a line of their own:
>
>
>
http://java.sun.com/docs/codeconv/html/CodeConventions.doc6.html#15395
>
> Doug
>
>
> --
> To unsubscribe, e-mail:
> <mailto:lucene-dev-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail:
> <mailto:lucene-dev-help@jakarta.apache.org>
>


__________________________________________________
Do you Yahoo!?
New DSL Internet Access from SBC & Yahoo!
http://sbc.yahoo.com

--
To unsubscribe, e-mail: <mailto:lucene-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:lucene-dev-help@jakarta.apache.org>
Re: cvs commit: jakarta-lucene/src/java/org/apache/lucene/index FieldsReader.java [ In reply to ]
Otis,

I really appreciate all of the work you do on Lucene. However sometimes
I have to disagree.

otis@apache.org wrote:
> - Added FIXME/TODO tags about things to document.

While documentation in a package private class is nice, it is not an
absolute requirement. So I don't think this warrants a FIXME comment.

> -final class FieldsReader {
> +final class FieldsReader
> +{

You also re-indented the code and your indentation style violates
standard Java style. In Java, opening braces go with the previous line,
not on a line of their own:

http://java.sun.com/docs/codeconv/html/CodeConventions.doc6.html#15395

Doug


--
To unsubscribe, e-mail: <mailto:lucene-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:lucene-dev-help@jakarta.apache.org>
cvs commit: jakarta-lucene/src/java/org/apache/lucene/index FieldsReader.java [ In reply to ]
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>