| java.lang.Object org.apache.lucene.util.PriorityQueue org.apache.lucene.search.FieldSortedHitQueue
FieldSortedHitQueue | public class FieldSortedHitQueue extends PriorityQueue (Code) | | Expert: A hit queue for sorting by hits by terms in more than one field.
Uses FieldCache.DEFAULT for maintaining internal term lookup tables.
Created: Dec 8, 2003 12:56:03 PM
author: Tim Jones (Nacimiento Software) since: lucene 1.4 version: $Id: FieldSortedHitQueue.java 605225 2007-12-18 15:13:05Z gsingers $ See Also: Searcher.search(QueryFilterintSort) See Also: FieldCache |
Constructor Summary | |
public | FieldSortedHitQueue(IndexReader reader, SortField[] fields, int size) Creates a hit queue sorted by the given list of fields.
Parameters: reader - Index to use. Parameters: fields - Fieldable names, in priority order (highest priority first). |
Method Summary | |
static ScoreDocComparator | comparatorAuto(IndexReader reader, String fieldname) Returns a comparator for sorting hits according to values in the given field.
The terms in the field are looked at to determine whether they contain integers,
floats or strings. | static ScoreDocComparator | comparatorDouble(IndexReader reader, String fieldname) Returns a comparator for sorting hits according to a field containing doubles.
Parameters: reader - Index to use. Parameters: fieldname - Fieldable containg float values. | static ScoreDocComparator | comparatorFloat(IndexReader reader, String fieldname) Returns a comparator for sorting hits according to a field containing floats.
Parameters: reader - Index to use. Parameters: fieldname - Fieldable containg float values. | static ScoreDocComparator | comparatorInt(IndexReader reader, String fieldname) Returns a comparator for sorting hits according to a field containing integers.
Parameters: reader - Index to use. Parameters: fieldname - Fieldable containg integer values. | static ScoreDocComparator | comparatorLong(IndexReader reader, String fieldname) Returns a comparator for sorting hits according to a field containing integers.
Parameters: reader - Index to use. Parameters: fieldname - Fieldable containg integer values. | static ScoreDocComparator | comparatorString(IndexReader reader, String fieldname) Returns a comparator for sorting hits according to a field containing strings.
Parameters: reader - Index to use. Parameters: fieldname - Fieldable containg string values. | static ScoreDocComparator | comparatorStringLocale(IndexReader reader, String fieldname, Locale locale) Returns a comparator for sorting hits according to a field containing strings.
Parameters: reader - Index to use. Parameters: fieldname - Fieldable containg string values. | FieldDoc | fillFields(FieldDoc doc) Given a FieldDoc object, stores the values used
to sort the given document. | static ScoreDocComparator | getCachedComparator(IndexReader reader, String field, int type, Locale locale, SortComparatorSource factory) | SortField[] | getFields() Returns the SortFields being used by this hit queue. | public float | getMaxScore() | public boolean | insert(FieldDoc fdoc) | public boolean | insert(Object fdoc) | public Object | insertWithOverflow(Object element) | protected boolean | lessThan(Object a, Object b) Returns whether a is less relevant than b . |
Comparators | final static FieldCacheImpl.Cache Comparators(Code) | | Internal cache of comparators. Similar to FieldCache, only
caches comparators instead of term values.
|
comparators | protected ScoreDocComparator[] comparators(Code) | | Stores a comparator corresponding to each field being sorted by
|
fields | protected SortField[] fields(Code) | | Stores the sort criteria being used.
|
maxscore | protected float maxscore(Code) | | Stores the maximum score value encountered, needed for normalizing.
|
FieldSortedHitQueue | public FieldSortedHitQueue(IndexReader reader, SortField[] fields, int size) throws IOException(Code) | | Creates a hit queue sorted by the given list of fields.
Parameters: reader - Index to use. Parameters: fields - Fieldable names, in priority order (highest priority first). Cannot be null or empty. Parameters: size - The number of hits to retain. Must be greater than zero. throws: IOException - |
comparatorAuto | static ScoreDocComparator comparatorAuto(IndexReader reader, String fieldname) throws IOException(Code) | | Returns a comparator for sorting hits according to values in the given field.
The terms in the field are looked at to determine whether they contain integers,
floats or strings. Once the type is determined, one of the other static methods
in this class is called to get the comparator.
Parameters: reader - Index to use. Parameters: fieldname - Fieldable containg values. Comparator for sorting hits. throws: IOException - If an error occurs reading the index. |
comparatorDouble | static ScoreDocComparator comparatorDouble(IndexReader reader, String fieldname) throws IOException(Code) | | Returns a comparator for sorting hits according to a field containing doubles.
Parameters: reader - Index to use. Parameters: fieldname - Fieldable containg float values. Comparator for sorting hits. throws: IOException - If an error occurs reading the index. |
comparatorFloat | static ScoreDocComparator comparatorFloat(IndexReader reader, String fieldname) throws IOException(Code) | | Returns a comparator for sorting hits according to a field containing floats.
Parameters: reader - Index to use. Parameters: fieldname - Fieldable containg float values. Comparator for sorting hits. throws: IOException - If an error occurs reading the index. |
comparatorInt | static ScoreDocComparator comparatorInt(IndexReader reader, String fieldname) throws IOException(Code) | | Returns a comparator for sorting hits according to a field containing integers.
Parameters: reader - Index to use. Parameters: fieldname - Fieldable containg integer values. Comparator for sorting hits. throws: IOException - If an error occurs reading the index. |
comparatorLong | static ScoreDocComparator comparatorLong(IndexReader reader, String fieldname) throws IOException(Code) | | Returns a comparator for sorting hits according to a field containing integers.
Parameters: reader - Index to use. Parameters: fieldname - Fieldable containg integer values. Comparator for sorting hits. throws: IOException - If an error occurs reading the index. |
comparatorString | static ScoreDocComparator comparatorString(IndexReader reader, String fieldname) throws IOException(Code) | | Returns a comparator for sorting hits according to a field containing strings.
Parameters: reader - Index to use. Parameters: fieldname - Fieldable containg string values. Comparator for sorting hits. throws: IOException - If an error occurs reading the index. |
comparatorStringLocale | static ScoreDocComparator comparatorStringLocale(IndexReader reader, String fieldname, Locale locale) throws IOException(Code) | | Returns a comparator for sorting hits according to a field containing strings.
Parameters: reader - Index to use. Parameters: fieldname - Fieldable containg string values. Comparator for sorting hits. throws: IOException - If an error occurs reading the index. |
fillFields | FieldDoc fillFields(FieldDoc doc)(Code) | | Given a FieldDoc object, stores the values used
to sort the given document. These values are not the raw
values out of the index, but the internal representation
of them. This is so the given search hit can be collated
by a MultiSearcher with other search hits.
Parameters: doc - The FieldDoc to store sort values into. The same FieldDoc passed in. See Also: Searchable.search(WeightFilterintSort) |
getFields | SortField[] getFields()(Code) | | Returns the SortFields being used by this hit queue.
|
getMaxScore | public float getMaxScore()(Code) | | returns the maximum score encountered by elements inserted via insert()
|
lessThan | protected boolean lessThan(Object a, Object b)(Code) | | Returns whether a is less relevant than b .
Parameters: a - ScoreDoc Parameters: b - ScoreDoc true if document a should be sorted after document b . |
|
|