LUCENE-608: deprecate Document.fields(), add getFields()

git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@416440 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Daniel Naber 2006-06-22 18:37:32 +00:00
parent 79ae648af5
commit 8ebdf9fc86
2 changed files with 23 additions and 7 deletions

View File

@ -10,7 +10,8 @@ New features
(Samphan Raruenrom va Chris Hostetter)
2. LUCENE-545: New FieldSelector API and associated changes to IndexReader and implementations.
New Fieldable interface for use with the lazy field loading mechanism. (Grant Ingersoll and Chuck Williams via Grant Ingersoll)
New Fieldable interface for use with the lazy field loading mechanism.
(Grant Ingersoll and Chuck Williams via Grant Ingersoll)
API Changes
@ -21,9 +22,13 @@ API Changes
and is supposed to be replaced with the WordlistLoader class in
package org.apache.lucene.analysis (Daniel Naber)
10. LUCENE-609: Revert return type of Document.getField(s) to Field
3. LUCENE-609: Revert return type of Document.getField(s) to Field
for backward compatibility, added new Document.getFieldable(s)
for access to new lazy loaded fields. (Yonik Seeley)
4. LUCENE-608: Document.fields() has been deprecated and a new method
Document.getFields() has been added that returns a List instead of
an Enumeration (Daniel Naber)
Bug fixes

View File

@ -168,11 +168,22 @@ public final class Document implements java.io.Serializable {
return null;
}
/** Returns an Enumeration of all the fields in a document. */
/** Returns an Enumeration of all the fields in a document.
* @deprecated use {@link #getFields()} instead
*/
public final Enumeration fields() {
return ((Vector)fields).elements();
}
/** Returns a List of all the fields in a document.
* <p>Note that fields which are <i>not</i> {@link Fieldable#isStored() stored} are
* <i>not</i> available in documents retrieved from the index, e.g. with {@link
* Hits#doc(int)}, {@link Searcher#doc(int)} or {@link IndexReader#document(int)}.
*/
public final List getFields() {
return fields;
}
/**
* Returns an array of {@link Field}s with the given name.
* This method can return <code>null</code>.
@ -202,7 +213,7 @@ public final class Document implements java.io.Serializable {
* This method can return <code>null</code>.
*
* @param name the name of the field
* @return a <code>Fieldable[]</code> array
* @return a <code>Fieldable[]</code> array or <code>null</code>
*/
public Fieldable[] getFieldables(String name) {
List result = new ArrayList();
@ -225,7 +236,7 @@ public final class Document implements java.io.Serializable {
* This method can return <code>null</code>.
*
* @param name the name of the field
* @return a <code>String[]</code> of field values
* @return a <code>String[]</code> of field values or <code>null</code>
*/
public final String[] getValues(String name) {
List result = new ArrayList();
@ -247,7 +258,7 @@ public final class Document implements java.io.Serializable {
* binary fields with the specified name are available.
*
* @param name the name of the field
* @return a <code>byte[][]</code> of binary field values.
* @return a <code>byte[][]</code> of binary field values or <code>null</code>
*/
public final byte[][] getBinaryValues(String name) {
List result = new ArrayList();
@ -270,7 +281,7 @@ public final class Document implements java.io.Serializable {
* There may be non-binary fields with the same name.
*
* @param name the name of the field.
* @return a <code>byte[]</code> containing the binary field value.
* @return a <code>byte[]</code> containing the binary field value or <code>null</code>
*/
public final byte[] getBinaryValue(String name) {
for (int i=0; i < fields.size(); i++) {