lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Otis Gospodnetic <otis_gospodne...@yahoo.com>
Subject Re: cvs commit: jakarta-lucene/src/java/org/apache/lucene/document Document.java
Date Tue, 07 Jan 2003 02:36:50 GMT
Be my guest.

--- Kelvin Tan <kelvin-lists@relevanz.com> wrote:
> I couldn't help noticing that the code formatting for the new methods
> are different from the rest of the class (Turbine vs Sun). Shouldn't
> it be corrected?
> 
> On 7 Jan 2003 02:29:21 -0000, otis@apache.org said:
> >otis        2003/01/06 18:29:21
> >
> >Modified:    src/java/org/apache/lucene/document Document.java Log:
> >- Added getFields and getValues methods.
> >Contributed by Rasik Pandey on 2002-10-09.
> >
> >Revision  Changes    Path 1.5       +52 -1     jakarta-
> >lucene/src/java/org/apache/lucene/document/Document.java
> >
> >Index: Document.java
> >===================================================================
> >RCS file: /home/cvs/jakarta-
> >lucene/src/java/org/apache/lucene/document/Document.java,v
> >retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5
> >--- Document.java        6 Nov 2002 19:55:02 -0000        1.4 +++
> Document.java        7
> >Jan 2003 02:29:21 -0000        1.5 @@ -55,6 +55,9 @@ */
> >
> >import java.util.Enumeration;
> >+import java.util.List;
> >+import java.util.ArrayList;
> >+ import org.apache.lucene.index.IndexReader;
> >import org.apache.lucene.search.Hits;
> >
> >@@ -135,6 +138,55 @@ return new DocumentFieldEnumeration(this);
> >}
> >
> >+  /** +   * Returns an array of {@link Field}s with the given name.
> >+   * +   * @param name the name of the field +   * @return a
> ><code>Field[]</code> array +   */ +   public final Field[]
> >getFields(String name) +   { +     List tempFieldList = new
> >ArrayList();
> >+     for (DocumentFieldList list = fieldList; list != null; list =
> >list.next) +     { +       if (list.field.name().equals(name)) +
> >{ +         tempFieldList.add(list.field);
> >+       }
> >+     }
> >+     int fieldCount = tempFieldList.size();
> >+     if (fieldCount == 0) +       return null;
> >+     else +     { +       Field[] fields = new Field[fieldCount];
> >+       for (int i = 0; i < fieldCount; i++) +       { +
> >fields[i] = (Field) tempFieldList.get(i);
> >+       }
> >+       return fields;
> >+     }
> >+   }
> >+ +  /** +   * Returns an array of values of the field specified as
> >the method parameter.
> >+   * +   * @param name the name of the field +   * @return a
> ><code>String[]</code> of field values +   */ +  public final
> >String[] getValues(String name) +  { +    Field[] namedFields =
> >getFields(name);
> >+    if (namedFields == null) +      return null;
> >+    String[] values = new String[namedFields.length];
> >+    for (int i = 0; i < namedFields.length; i++) +    { +
> >values[i] = namedFields[i].stringValue();
> >+    }
> >+    return values;
> >+  }
> >+ /** Prints the fields of a document for human consumption. */
> >public final String toString() { StringBuffer buffer = new
> >StringBuffer();
> >@@ -147,7 +199,6 @@ buffer.append(">");
> >return buffer.toString();
> >}
> >-
> >}
> >
> >final class DocumentFieldList implements java.io.Serializable {
> >
> >
> >
> >
> >--
> >To unsubscribe, e-mail:   <mailto:lucene-dev-
> >unsubscribe@jakarta.apache.org> For additional commands, e-mail:
> ><mailto:lucene-dev-
> >help@jakarta.apache.org>
> 
> 
> 
> 
> --
> 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!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.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>


Mime
View raw message