Class LuceneTermFieldComparator<T>

java.lang.Object
org.apache.lucene.search.FieldComparator<T>
com.atlassian.confluence.internal.search.v2.lucene.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 Summary

    Constructors
    Constructor
    Description
    LuceneTermFieldComparator(String fieldName, Function<org.apache.lucene.util.BytesRef,T> parser, Comparator<T> comparator, int numHits)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    compare(int slot1, int slot2)
     
    int
    compareBottom(int doc)
     
    int
    compareDocToValue(int doc, T value)
     
    int
    compareValues(T x, T y)
     
    void
    copy(int slot, int doc)
     
    protected String
     
    protected T
    getSortValue(int doc)
     
    protected org.apache.lucene.index.BinaryDocValues
    getTerms(org.apache.lucene.index.AtomicReaderContext context)
     
    void
    setBottom(int slot)
     
    org.apache.lucene.search.FieldComparator<T>
    setNextReader(org.apache.lucene.index.AtomicReaderContext context)
     
    value(int slot)
     

    Methods inherited from class org.apache.lucene.search.FieldComparator

    setScorer

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • LuceneTermFieldComparator

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

    • 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)