Interface NaturallyOrderedCustomFieldSearcher

All Known Implementing Classes:
AbstractDateRangeSearcher, DateRangeSearcher, DateTimeRangeSearcher, ExactNumberSearcher, ExactTextSearcher, SlowTextSearcher, TextSearcher

@PublicSpi public interface NaturallyOrderedCustomFieldSearcher
This interface indicates the values stored in the Lucene index for this searcher are naturally ordered and as a result natural sorting can be used allowing for best sort performance.
  • Method Summary

    Modifier and Type
    Method
    Description
    Return the name of the field to use for ordering.
    default org.apache.lucene.search.SortField.Type
    Deprecated, for removal: This API element is subject to removal in a future version.
    since 10.4, for legacy purpose only.
  • Method Details

    • getSortField

      String getSortField(CustomField customField)
      Return the name of the field to use for ordering. This will normally be just the field, .i.e customField.getId() but some searchers, e.g. TextSearcher, store additional fields to support sorting.
      Parameters:
      customField - The custom field to be searched
      Returns:
      The field name to use for ordering.
    • getSortFieldType

      @Deprecated(since="10.4", forRemoval=true) @Nullable default org.apache.lucene.search.SortField.Type getSortFieldType()
      Deprecated, for removal: This API element is subject to removal in a future version.
      since 10.4, for legacy purpose only. Leave the default implementation (returns null) for custom fields indexed with the Search API FieldIndexer.
      Returns the Lucene type to use when sorting on the values of legacy custom fields. This also necessitates adding NumericDocValues to documents for numeric and date data types, and SortedDocValues for string types at indexing time.

      This method needed for legacy fields only. If your custom field is already indexed with the Search API FieldIndexer, you should leave this method with the default implementation (i.e. returns null). This method is ignored for OpenSearch.

      Returns:
      type to expect when sorting values of this custom field.