org.apache.lucene.collation

Class CollationDocValuesField

  • All Implemented Interfaces:
    IndexableField


    public final class CollationDocValuesField
    extends Field
    Indexes collation keys as a single-valued SortedDocValuesField.

    This is more efficient that CollationKeyAnalyzer if the field only has one value: no uninversion is necessary to sort on the field, locale-sensitive range queries can still work via DocValuesRangeQuery, and the underlying data structures built at index-time are likely more efficient and use less memory than FieldCache.

    • Constructor Detail

      • CollationDocValuesField

        public CollationDocValuesField(String name,
                                       Collator collator)
        Create a new ICUCollationDocValuesField.

        NOTE: you should not create a new one for each document, instead just make one and reuse it during your indexing process, setting the value via setStringValue(String).

        Parameters:
        name - field name
        collator - Collator for generating collation keys.
    • Method Detail

      • setStringValue

        public void setStringValue(String value)
        Description copied from class: Field

        Expert: 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.

        Overrides:
        setStringValue in class Field