You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by ot...@apache.org on 2002/09/19 04:11:42 UTC
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: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: cvs commit: jakarta-lucene/src/java/org/apache/lucene/index FieldsReader.java
Posted by Otis Gospodnetic <ot...@yahoo.com>.
I'll put the old file back
--- Doug Cutting <cu...@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:
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
>
__________________________________________________
Do you Yahoo!?
New DSL Internet Access from SBC & Yahoo!
http://sbc.yahoo.com
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: cvs commit: jakarta-lucene/src/java/org/apache/lucene/index FieldsReader.java
Posted by Doug Cutting <cu...@lucene.com>.
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: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>