Package org.apache.lucene.index
Class Fields
- java.lang.Object
-
- org.apache.lucene.index.Fields
-
- Direct Known Subclasses:
FieldsProducer
,FilterLeafReader.FilterFields
,MultiFields
public abstract class Fields extends Object implements Iterable<String>
Provides aTerms
index for fields that have it, and lists which fields do. This is primarily an internal/experimental API (seeFieldsProducer
), although it is also used to expose the set of term vectors per document.- WARNING: This API is experimental and might change in incompatible ways in the next release.
-
-
Field Summary
Fields Modifier and Type Field Description static Fields[]
EMPTY_ARRAY
Zero-lengthFields
array.
-
Constructor Summary
Constructors Modifier Constructor Description protected
Fields()
Sole constructor.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description abstract Iterator<String>
iterator()
Returns an iterator that will step through all fields names.abstract int
size()
Returns the number of fields or -1 if the number of distinct field names is unknown.abstract Terms
terms(String field)
Get theTerms
for this field.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
-
-
-
Field Detail
-
EMPTY_ARRAY
public static final Fields[] EMPTY_ARRAY
Zero-lengthFields
array.
-
-
Method Detail
-
iterator
public abstract Iterator<String> iterator()
Returns an iterator that will step through all fields names. This will not return null.
-
terms
public abstract Terms terms(String field) throws IOException
Get theTerms
for this field. This will return null if the field does not exist.- Throws:
IOException
-
size
public abstract int size()
Returns the number of fields or -1 if the number of distinct field names is unknown. If >= 0,iterator()
will return as many field names.
-
-