hmmmm...I'm not too familiar with Lucene commit rules, after all I'm not a committer. :-)
In Turbine (http://jakarta.apache.org/turbine/common/code-standards.html), <quote> If you commit code that does not follow these conventions, you are responsible for also fixing your own code. </quote> *shrug* just thought I'd point it out... On Mon, 6 Jan 2003 18:36:50 -0800 (PST), Otis Gospodnetic said: >Be my guest. > >--- Kelvin Tan <[EMAIL PROTECTED]> 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, [EMAIL PROTECTED] 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- >>>[EMAIL PROTECTED]> For additional commands, e-mail: >>><mailto:lucene-dev- >>>[EMAIL PROTECTED]> >> >> >> >> >>-- >>To unsubscribe, e-mail: <mailto:lucene-dev- >>[EMAIL PROTECTED]> For additional commands, e-mail: >><mailto:[EMAIL PROTECTED]> >> > > >__________________________________________________ Do you Yahoo!? >Yahoo! Mail Plus - Powerful. Affordable. Sign up now. >http://mailplus.yahoo.com > >-- >To unsubscribe, e-mail: <mailto:lucene-dev- >[EMAIL PROTECTED]> For additional commands, e-mail: ><mailto:lucene-dev- >[EMAIL PROTECTED]> -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>