Class LuceneTermFieldComparator<T>

  • Direct Known Subclasses:
    LuceneMultiTermFieldComparator

    public class LuceneTermFieldComparator<T>
    extends org.apache.lucene.search.FieldComparator<T>
    When returned from FieldComparatorSource.newComparator, a LuceneTermFieldComparator compares hits so as to determine their sort order when collecting results, using a custom sort comparator.
    • Nested Class Summary

      • Nested classes/interfaces inherited from class org.apache.lucene.search.FieldComparator

        org.apache.lucene.search.FieldComparator.ByteComparator, org.apache.lucene.search.FieldComparator.DocComparator, org.apache.lucene.search.FieldComparator.DoubleComparator, org.apache.lucene.search.FieldComparator.FloatComparator, org.apache.lucene.search.FieldComparator.IntComparator, org.apache.lucene.search.FieldComparator.LongComparator, org.apache.lucene.search.FieldComparator.NumericComparator<T extends Number>, org.apache.lucene.search.FieldComparator.RelevanceComparator, org.apache.lucene.search.FieldComparator.ShortComparator, org.apache.lucene.search.FieldComparator.TermOrdValComparator, org.apache.lucene.search.FieldComparator.TermValComparator
    • Constructor Detail

      • LuceneTermFieldComparator

        public LuceneTermFieldComparator​(String fieldName,
                                         Function<org.apache.lucene.util.BytesRef,​T> parser,
                                         Comparator<T> comparator,
                                         int numHits)
    • Method Detail

      • getFieldName

        protected String getFieldName()
      • compareValues

        public int compareValues​(T x,
                                 T y)
        Overrides:
        compareValues in class org.apache.lucene.search.FieldComparator<T>
      • compare

        public int compare​(int slot1,
                           int slot2)
        Specified by:
        compare in class org.apache.lucene.search.FieldComparator<T>
      • setBottom

        public void setBottom​(int slot)
        Specified by:
        setBottom in class org.apache.lucene.search.FieldComparator<T>
      • compareBottom

        public int compareBottom​(int doc)
                          throws IOException
        Specified by:
        compareBottom in class org.apache.lucene.search.FieldComparator<T>
        Throws:
        IOException
      • copy

        public void copy​(int slot,
                         int doc)
                  throws IOException
        Specified by:
        copy in class org.apache.lucene.search.FieldComparator<T>
        Throws:
        IOException
      • setNextReader

        public org.apache.lucene.search.FieldComparator<T> setNextReader​(org.apache.lucene.index.AtomicReaderContext context)
                                                                  throws IOException
        Specified by:
        setNextReader in class org.apache.lucene.search.FieldComparator<T>
        Throws:
        IOException
      • getTerms

        protected org.apache.lucene.index.BinaryDocValues getTerms​(org.apache.lucene.index.AtomicReaderContext context)
                                                            throws IOException
        Throws:
        IOException
      • value

        public T value​(int slot)
        Specified by:
        value in class org.apache.lucene.search.FieldComparator<T>
      • compareDocToValue

        public int compareDocToValue​(int doc,
                                     T value)
                              throws IOException
        Specified by:
        compareDocToValue in class org.apache.lucene.search.FieldComparator<T>
        Throws:
        IOException
      • getSortValue

        protected T getSortValue​(int doc)