public class FieldSortedHitQueue extends PriorityQueue
FieldCache.DEFAULT
for maintaining internal term lookup tables.
Created: Dec 8, 2003 12:56:03 PM
Searcher.search(Query,Filter,int,Sort)
,
FieldCache
Modifier and Type | Field and Description |
---|---|
protected ScoreDocComparator[] |
comparators
Stores a comparator corresponding to each field being sorted by
|
protected SortField[] |
fields
Stores the sort criteria being used.
|
protected float |
maxscore
Stores the maximum score value encountered, needed for normalizing.
|
heap
Constructor and Description |
---|
FieldSortedHitQueue(IndexReader reader,
SortField[] fields,
int size)
Creates a hit queue sorted by the given list of fields.
|
Modifier and Type | Method and Description |
---|---|
float |
getMaxScore()
returns the maximum score encountered by elements inserted via insert()
|
boolean |
insert(FieldDoc fdoc) |
boolean |
insert(Object fdoc)
Adds element to the PriorityQueue in log(size) time if either
the PriorityQueue is not full, or not lessThan(element, top()).
|
Object |
insertWithOverflow(Object element)
insertWithOverflow() is the same as insert() except its
return value: it returns the object (if any) that was
dropped off the heap because it was full.
|
protected boolean |
lessThan(Object a,
Object b)
Returns whether
a is less relevant than b . |
adjustTop, clear, initialize, pop, put, size, top
protected ScoreDocComparator[] comparators
protected SortField[] fields
protected float maxscore
public FieldSortedHitQueue(IndexReader reader, SortField[] fields, int size) throws IOException
reader
- Index to use.fields
- Fieldable names, in priority order (highest priority first). Cannot be null
or empty.size
- The number of hits to retain. Must be greater than zero.IOException
public float getMaxScore()
public boolean insert(FieldDoc fdoc)
public boolean insert(Object fdoc)
PriorityQueue
insert
in class PriorityQueue
public Object insertWithOverflow(Object element)
PriorityQueue
insertWithOverflow
in class PriorityQueue
protected boolean lessThan(Object a, Object b)
a
is less relevant than b
.lessThan
in class PriorityQueue
a
- ScoreDocb
- ScoreDoctrue
if document a
should be sorted after document b
.Copyright © 2000-2013 Apache Software Foundation. All Rights Reserved.