Class FeatureSortField


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

      • featureName

        private final java.lang.String featureName
    • Constructor Detail

      • FeatureSortField

        public FeatureSortField​(java.lang.String field,
                                java.lang.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 Detail

      • 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​(java.lang.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​(java.lang.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 java.lang.String toString()
        Overrides:
        toString in class SortField