1
/*------------------------------------------------------------------------------
2
* Copyright (C) 2003-2006 Ben van Klinken and the CLucene Team
4
* Distributable under the terms of either the Apache License (Version 2.0) or
5
* the GNU Lesser General Public License, as specified in the COPYING file.
6
------------------------------------------------------------------------------*/
7
#ifndef _lucene_search_HitQueue_
8
#define _lucene_search_HitQueue_
10
#if defined(_LUCENE_PRAGMA_ONCE)
14
#include "SearchHeader.h"
19
* An optimised PriorityQueue which takes ScoreDoc structs. Some by-ref passing
20
* and memory related optimisations have been done.
22
class HitQueue: LUCENE_BASE {
32
bool lessThan(struct ScoreDoc& hitA, struct ScoreDoc& hitB);
36
struct ScoreDoc& top();
37
void put(struct ScoreDoc& element);
40
* Adds element to the PriorityQueue in log(size) time if either
41
* the PriorityQueue is not full, or not lessThan(element, top()).
43
* @return true if element is added, false otherwise.
45
bool insert(struct ScoreDoc& element);
47
* Returns the number of elements currently stored in the PriorityQueue.
50
HitQueue(const int32_t maxSize);