org.apache.lucene.search

Class FieldSortedHitQueue

public class FieldSortedHitQueue extends PriorityQueue

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

Since: lucene 1.4

Version: $Id: FieldSortedHitQueue.java 374436 2006-02-02 16:55:26Z yonik $

Author: Tim Jones (Nacimiento Software)

See Also: Searcher FieldCache

Field Summary
protected ScoreDocComparator[]comparators
Stores a comparator corresponding to each field being sorted by
protected SortField[]fields
Stores the sort criteria being used.
protected floatmaxscore
Stores the maximum score value encountered, needed for normalizing.
Constructor Summary
FieldSortedHitQueue(IndexReader reader, SortField[] fields, int size)
Creates a hit queue sorted by the given list of fields.
Method Summary
floatgetMaxScore()
returns the maximum score encountered by elements inserted via insert()
booleaninsert(FieldDoc fdoc)
booleaninsert(Object fdoc)
protected booleanlessThan(Object a, Object b)
Returns whether a is less relevant than b.

Field Detail

comparators

protected ScoreDocComparator[] comparators
Stores a comparator corresponding to each field being sorted by

fields

protected SortField[] fields
Stores the sort criteria being used.

maxscore

protected float maxscore
Stores the maximum score value encountered, needed for normalizing.

Constructor Detail

FieldSortedHitQueue

public FieldSortedHitQueue(IndexReader reader, SortField[] fields, int size)
Creates a hit queue sorted by the given list of fields.

Parameters: reader Index to use. fields Field names, in priority order (highest priority first). Cannot be null or empty. size The number of hits to retain. Must be greater than zero.

Throws: IOException

Method Detail

getMaxScore

public float getMaxScore()
returns the maximum score encountered by elements inserted via insert()

insert

public boolean insert(FieldDoc fdoc)

insert

public boolean insert(Object fdoc)

lessThan

protected boolean lessThan(Object a, Object b)
Returns whether a is less relevant than b.

Parameters: a ScoreDoc b ScoreDoc

Returns: true if document a should be sorted after document b.

Copyright © 2000-2007 Apache Software Foundation. All Rights Reserved.