Field that stores a per-document BytesRef value, indexed for sorting. Here's an example
usage:
document.add(new SortedDocValuesField(name, new BytesRef("hello")));
If you also need to store the value, you should add a separate StoredField instance.
This value can be at most 32766 bytes long.
| constant | type | note |
|---|---|---|
| TYPE | FieldType | Type for sorted bytes DocValues |
<init>(String name, org.apache.lucene.util.BytesRef bytes)Create a new sorted DocValues field.
| name | type | description |
|---|---|---|
| name | String | field name |
| bytes | org.apache.lucene.util.BytesRef | binary content |
| IllegalArgumentException | if the field name is null | |
indexedField(String name, org.apache.lucene.util.BytesRef bytes)Creates a new SortedDocValuesField with the specified 64-bit long value that also
creates a skip index.
| name | type | description |
|---|---|---|
| name | String | field name |
| bytes | org.apache.lucene.util.BytesRef | binary content |
| IllegalArgumentException | if the field name is null | |
newSlowExactQuery(String field, org.apache.lucene.util.BytesRef value)Create a query for matching an exact BytesRef value.
NOTE: Such queries cannot efficiently advance to the next match, which makes them
slow if they are not ANDed with a selective query. As a consequence, they are best used wrapped
in an IndexOrDocValuesQuery, alongside a range query that executes on points, such as
BinaryPoint#newExactQuery.
newSlowRangeQuery(String field, org.apache.lucene.util.BytesRef lowerValue, org.apache.lucene.util.BytesRef upperValue, boolean lowerInclusive, boolean upperInclusive)Create a range query that matches all documents whose value is between lowerValue and
upperValue included.
You can have half-open ranges by setting lowerValue = null or upperValue =
null.
NOTE: Such queries cannot efficiently advance to the next match, which makes them
slow if they are not ANDed with a selective query. As a consequence, they are best used wrapped
in an IndexOrDocValuesQuery, alongside a range query that executes on points, such as
BinaryPoint#newRangeQuery.
newSlowSetQuery(String field, Collection<org.apache.lucene.util.BytesRef> values)Create a query matching any of the specified values.
NOTE: Such queries cannot efficiently advance to the next match, which makes them
slow if they are not ANDed with a selective query. As a consequence, they are best used wrapped
in an IndexOrDocValuesQuery, alongside a set query that executes on postings, such as
TermInSetQuery.
setByteValue(byte value) · also: set_byte_valueExpert: change the value of this field. See #setStringValue(String).
setBytesValue(byte[] value) · also: set_bytes_valueExpert: change the value of this field. See #setStringValue(String).
setBytesValue(org.apache.lucene.util.BytesRef value) · also: set_bytes_valueExpert: change the value of this field. See #setStringValue(String).
NOTE: the provided BytesRef is not copied so be sure not to change it until you're done with this field.
getCharSequenceValue() · also: get_char_sequence_valuesetDoubleValue(double value) · also: set_double_valueExpert: change the value of this field. See #setStringValue(String).
Returns the FieldType for this field.
setFloatValue(float value) · also: set_float_valueExpert: change the value of this field. See #setStringValue(String).
setIntValue(int value) · also: set_int_valueExpert: change the value of this field. See #setStringValue(String).
setLongValue(long value) · also: set_long_valueExpert: change the value of this field. See #setStringValue(String).
name()numericValue()readerValue()The value of the field as a Reader, or null. If null, the String value or binary value is used. Exactly one of stringValue(), readerValue(), and binaryValue() must be set.
setReaderValue(java.io.Reader value) · also: set_reader_valueExpert: change the value of this field. See #setStringValue(String).
setShortValue(short value) · also: set_short_valueExpert: change the value of this field. See #setStringValue(String).
stringValue()The value of the field as a String, or null. If null, the Reader value or binary value is used. Exactly one of stringValue(), readerValue(), and binaryValue() must be set.
setStringValue(String value) · also: set_string_valueExpert: change the value of this field. This can be used during indexing to re-use a single
Field instance to improve indexing speed by avoiding GC cost of new'ing and reclaiming Field
instances. Typically a single Document instance is re-used as well. This helps most on
small documents.
Each Field instance should only be used once within a single Document instance. See
ImproveIndexingSpeed for
details.
toString()Prints a Field for human consumption.
tokenStream(org.apache.lucene.analysis.Analyzer analyzer, org.apache.lucene.analysis.TokenStream reuse)setTokenStream(org.apache.lucene.analysis.TokenStream tokenStream) · also: set_token_streamExpert: sets the token stream to be used for indexing.
The TokenStream for this field to be used when indexing, or null. If null, the Reader value or String value is analyzed to produce the indexed tokens.