LUCENE-7075: clean up LegacyNumeric* in .document javadocs

This commit is contained in:
Robert Muir 2016-03-08 10:54:29 -05:00
parent dcb7a882b6
commit 75f18ad404
3 changed files with 18 additions and 11 deletions

View File

@ -199,8 +199,7 @@ public final class Document implements Iterable<IndexableField> {
* Returns an array of values of the field specified as the method parameter.
* This method returns an empty array when there are no
* matching fields. It never returns null.
* For {@link LegacyIntField}, {@link LegacyLongField}, {@link
* LegacyFloatField} and {@link LegacyDoubleField} it returns the string value of the number. If you want
* For a numeric {@link StoredField} it returns the string value of the number. If you want
* the actual numeric field instances back, use {@link #getFields}.
* @param name the name of the field
* @return a <code>String[]</code> of field values
@ -224,8 +223,7 @@ public final class Document implements Iterable<IndexableField> {
* this document, or null. If multiple fields exist with this name, this
* method returns the first value added. If only binary fields with this name
* exist, returns null.
* For {@link LegacyIntField}, {@link LegacyLongField}, {@link
* LegacyFloatField} and {@link LegacyDoubleField} it returns the string value of the number. If you want
* For a numeric {@link StoredField} it returns the string value of the number. If you want
* the actual numeric field instance back, use {@link #getField}.
*/
public final String get(String name) {

View File

@ -33,11 +33,20 @@ import org.apache.lucene.util.BytesRef;
/**
* Expert: directly create a field for a document. Most
* users should use one of the sugar subclasses: {@link
* LegacyIntField}, {@link LegacyLongField}, {@link LegacyFloatField}, {@link
* LegacyDoubleField}, {@link BinaryDocValuesField}, {@link
* NumericDocValuesField}, {@link SortedDocValuesField}, {@link
* StringField}, {@link TextField}, {@link StoredField}.
* users should use one of the sugar subclasses:
* <ul>
* <li>{@link TextField}: {@link Reader} or {@link String} indexed for full-text search
* <li>{@link StringField}: {@link String} indexed verbatim as a single token
* <li>{@link IntPoint}: {@code int} indexed for exact/range queries.
* <li>{@link LongPoint}: {@code long} indexed for exact/range queries.
* <li>{@link FloatPoint}: {@code float} indexed for exact/range queries.
* <li>{@link DoublePoint}: {@code double} indexed for exact/range queries.
* <li>{@link SortedDocValuesField}: {@code byte[]} indexed column-wise for sorting/faceting
* <li>{@link SortedSetDocValuesField}: {@code SortedSet<byte[]>} indexed column-wise for sorting/faceting
* <li>{@link NumericDocValuesField}: {@code long} indexed column-wise for sorting/faceting
* <li>{@link SortedNumericDocValuesField}: {@code SortedSet<long>} indexed column-wise for sorting/faceting
* <li>{@link StoredField}: Stored-only value for retrieving in summary results
* </ul>
*
* <p> A field is a section of a Document. Each field has three
* parts: name, type and value. Values may be text

View File

@ -340,10 +340,10 @@ public class TestDocument extends LuceneTestCase {
public void testNumericFieldAsString() throws Exception {
Document doc = new Document();
doc.add(new LegacyIntField("int", 5, Field.Store.YES));
doc.add(new StoredField("int", 5));
assertEquals("5", doc.get("int"));
assertNull(doc.get("somethingElse"));
doc.add(new LegacyIntField("int", 4, Field.Store.YES));
doc.add(new StoredField("int", 4));
assertArrayEquals(new String[] { "5", "4" }, doc.getValues("int"));
Directory dir = newDirectory();