org.apache.lucene.search
Class SortComparator
- java.lang.Object
-
- org.apache.lucene.search.SortComparator
-
- All Implemented Interfaces:
- java.io.Serializable, SortComparatorSource
public abstract class SortComparator extends java.lang.Object implements SortComparatorSource
Abstract base class for sorting hits returned by a Query.This class should only be used if the other SortField types (SCORE, DOC, STRING, INT, FLOAT) do not provide an adequate sorting. It maintains an internal cache of values which could be quite large. The cache is an array of Comparable, one for each document in the index. There is a distinct Comparable for each unique term in the field - if some documents have the same term in the field, the cache array will have entries which reference the same Comparable.
Created: Apr 21, 2004 5:08:38 PM
- Since:
- 1.4
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor and Description SortComparator()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description ScoreDocComparatornewComparator(IndexReader reader, java.lang.String fieldname)Creates a comparator for the field in the given index.
-
-
-
Method Detail
-
newComparator
public ScoreDocComparator newComparator(IndexReader reader, java.lang.String fieldname) throws java.io.IOException
Description copied from interface:SortComparatorSourceCreates a comparator for the field in the given index.- Specified by:
newComparatorin interfaceSortComparatorSource- Parameters:
reader- Index to create comparator for.fieldname- Name of the field to create comparator for.- Returns:
- Comparator of ScoreDoc objects.
- Throws:
java.io.IOException- If an error occurs reading the index.
-
-
DataMelt 3.0 © DataMelt by jWork.ORG