org.apache.lucene.search
Class ShardFieldDocSortedHitQueue

java.lang.Object
  extended by org.apache.lucene.util.PriorityQueue<ShardFieldDoc>
      extended by org.apache.lucene.search.ShardFieldDocSortedHitQueue

public class ShardFieldDocSortedHitQueue
extends org.apache.lucene.util.PriorityQueue<ShardFieldDoc>


Constructor Summary
ShardFieldDocSortedHitQueue(org.apache.lucene.search.SortField[] fields, int size)
          Creates a hit queue sorted by the given list of fields.
 
Method Summary
protected  boolean lessThan(ShardFieldDoc docA, ShardFieldDoc docB)
          Returns whether a is less relevant than b.
 void setFields(org.apache.lucene.search.SortField[] fields)
          Allows redefinition of sort fields if they are null.
 
Methods inherited from class org.apache.lucene.util.PriorityQueue
add, clear, getHeapArray, getSentinelObject, initialize, insertWithOverflow, pop, size, top, updateTop
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ShardFieldDocSortedHitQueue

public ShardFieldDocSortedHitQueue(org.apache.lucene.search.SortField[] fields,
                                   int size)
Creates a hit queue sorted by the given list of fields.

Parameters:
fields - Fieldable names, in priority order (highest priority first).
size - The number of hits to retain. Must be greater than zero.
Method Detail

setFields

public void setFields(org.apache.lucene.search.SortField[] fields)
Allows redefinition of sort fields if they are null. This is to handle the case using ParallelMultiSearcher where the original list contains AUTO and we don't know the actual sort type until the values come back. The fields can only be set once. This method should be synchronized external like all other PQ methods.

Parameters:
fields -

lessThan

protected final boolean lessThan(ShardFieldDoc docA,
                                 ShardFieldDoc docB)
Returns whether a is less relevant than b.

Specified by:
lessThan in class org.apache.lucene.util.PriorityQueue<ShardFieldDoc>
Parameters:
a - ScoreDoc
b - ScoreDoc
Returns:
true if document a should be sorted after document b.


Copyright © 2009-2012. All Rights Reserved.