CLucene - a full-featured, c++ search engine
API Documentation


lucene::search::FieldDocSortedHitQueue Class Reference

Expert: Collects sorted results from Searchable's and collates them. More...

#include <FieldDocSortedHitQueue.h>

Inheritance diagram for lucene::search::FieldDocSortedHitQueue:
lucene::util::PriorityQueue< FieldDoc *, lucene::util::Deletor::Object< FieldDoc > > lucene::debug::LuceneBase

List of all members.

Public Member Functions

 FieldDocSortedHitQueue (SortField **fields, int32_t size)
 Creates a hit queue sorted by the given list of fields.
 ~FieldDocSortedHitQueue ()
void setFields (SortField **fields)
 Allows redefinition of sort fields if they are NULL.
SortField ** getFields ()
 Returns the fields being used to sort.

Protected Member Functions

bool lessThan (FieldDoc *docA, FieldDoc *docB)
 Returns an array of collators, possibly NULL.

Detailed Description

Expert: Collects sorted results from Searchable's and collates them.

The elements put into this queue must be of type FieldDoc.


Constructor & Destructor Documentation

lucene::search::FieldDocSortedHitQueue::FieldDocSortedHitQueue ( SortField **  fields,
int32_t  size 
)

Creates a hit queue sorted by the given list of fields.

Parameters:
fields Field names, in priority order (highest priority first).
size The number of hits to retain. Must be greater than zero.
lucene::search::FieldDocSortedHitQueue::~FieldDocSortedHitQueue (  ) 

Member Function Documentation

SortField** lucene::search::FieldDocSortedHitQueue::getFields (  )  [inline]

Returns the fields being used to sort.

bool lucene::search::FieldDocSortedHitQueue::lessThan ( FieldDoc docA,
FieldDoc docB 
) [protected]

Returns an array of collators, possibly NULL.

The collators correspond to any SortFields which were given a specific locale.

Parameters:
fields Array of sort fields.
Returns:
Array, possibly NULL.

private Collator[] hasCollators (SortField[] fields) { if (fields == NULL) return NULL; Collator[] ret = new Collator[fields.length]; for (int32_t i=0; i<fields.length; ++i) { Locale locale = fields[i].getLocale(); if (locale != NULL) ret[i] = Collator.getInstance (locale); } return ret; } Returns whether a is less relevant than b.

Parameters:
a FieldDoc
b FieldDoc
Returns:
true if document a should be sorted after document b.
void lucene::search::FieldDocSortedHitQueue::setFields ( 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 is thread safe.

Parameters:
fields 

The documentation for this class was generated from the following file:

clucene.sourceforge.net