Class FeatureSortField

java.lang.Object
org.apache.lucene.search.SortField
org.apache.lucene.document.FeatureSortField

final class FeatureSortField extends SortField
Sorts using the value of a specified feature name from a FeatureField.
  • Field Details

    • featureName

      private final String featureName
  • Constructor Details

    • FeatureSortField

      public FeatureSortField(String field, String featureName)
      Creates a FeatureSortField that can be used to sort hits by the value of a particular feature in a FeatureField.
      Parameters:
      featureName - The name of the feature to use for the sort value
  • Method Details

    • getComparator

      public FieldComparator<?> getComparator(int numHits, int sortPos)
      Description copied from class: SortField
      Returns the FieldComparator to use for sorting.
      Overrides:
      getComparator in class SortField
      Parameters:
      numHits - number of top hits the queue will store
      sortPos - position of this SortField within Sort. The comparator is primary if sortPos==0, secondary if sortPos==1, etc. Some comparators can optimize themselves when they are the primary sort.
      Returns:
      FieldComparator to use when sorting
    • setMissingValue

      public void setMissingValue(Object missingValue)
      Description copied from class: SortField
      Set the value to use for documents that don't have a value.
      Overrides:
      setMissingValue in class SortField
    • hashCode

      public int hashCode()
      Description copied from class: SortField
      Returns a hash code for this SortField instance. If a FieldComparatorSource was provided, it must properly implement hashCode (unless a singleton is always used).
      Overrides:
      hashCode in class SortField
    • equals

      public boolean equals(Object obj)
      Description copied from class: SortField
      Returns true if o is equal to this. If a FieldComparatorSource was provided, it must properly implement equals (unless a singleton is always used). canUsePoints field is not part of equals and hasCode intentionally, as it is only useful during search-time and using it in these functions prevents index sorting optimizations that rely on the equality of the index-time and search-time SortField instances.
      Overrides:
      equals in class SortField
    • toString

      public String toString()
      Overrides:
      toString in class SortField