org.apache.lucene.search.comparators (Lucene 10.5.1 core API)
Description: declaration: package: org.apache.lucene.search.comparators

# Package org.apache.lucene.search.comparators

package org.apache.lucene.search.comparators
Comparators, used to compare hits so as to determine their sort order when collecting the top results with `TopFieldCollector`.

- Related Packages
  Package
  Description
  org.apache.lucene.search
  Code to search indices.
  org.apache.lucene.search.knn
  Classes related to vector search: knn and vector fields.
  org.apache.lucene.search.similarities
  This package contains the various ranking models that can be used in Lucene.
- Classes
  Class
  Description
  DocComparator
  Comparator that sorts by asc _doc
  DoubleComparator
  Comparator based on `Double.compare(double, double)` for `numHits`.
  FloatComparator
  Comparator based on `Float.compare(float, float)` for `numHits`.
  IntComparator
  Comparator based on `Integer.compare(int, int)` for `numHits`.
  LongComparator
  Comparator based on `Long.compare(long, long)` for `numHits`.
  NumericComparator<T extends Number>
  Abstract numeric comparator for comparing numeric values.
  TermOrdValComparator
  Sorts by field's natural Term sort order, using ordinals.