Skip to content

armgit / solr

Public Imported from GitHub
0

Apache Solr open-source search software

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

Robert Muir75f18ad40461
diff --git a/lucene/core/src/java/org/apache/lucene/document/Document.java b/lucene/core/src/java/org/apache/lucene/document/Document.java
index cdba083942f..2f44444babe 100644
--- a/lucene/core/src/java/org/apache/lucene/document/Document.java
+++ b/lucene/core/src/java/org/apache/lucene/document/Document.java
@@ -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) {
diff --git a/lucene/core/src/java/org/apache/lucene/document/Field.java b/lucene/core/src/java/org/apache/lucene/document/Field.java
index dff2e58aa6e..550d1fd1797 100644
--- a/lucene/core/src/java/org/apache/lucene/document/Field.java
+++ b/lucene/core/src/java/org/apache/lucene/document/Field.java
@@ -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
diff --git a/lucene/core/src/test/org/apache/lucene/document/TestDocument.java b/lucene/core/src/test/org/apache/lucene/document/TestDocument.java
index bd873ec8a9c..50c1ed0a919 100644
--- a/lucene/core/src/test/org/apache/lucene/document/TestDocument.java
+++ b/lucene/core/src/test/org/apache/lucene/document/TestDocument.java
@@ -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();