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

- Main Page
- Related Pages
- Namespaces
- Data Structures
- Files

- File List
- Globals

HitQueueBase.h
Go to the documentation of this file.
1 // Copyright (c) 2009-2014 Alan Wright. All rights reserved.
3 // Distributable under the terms of either the Apache License (Version 2.0)
4 // or the GNU Lesser General Public License.
6
7 #ifndef HITQUEUEBASE_H
8 #define HITQUEUEBASE_H
9
10 #include "PriorityQueue.h"
11
12 namespace Lucene {
13
14 class LPPAPI HitQueueBase : public LuceneObject {
15 public:
16 HitQueueBase(int32_t size);
17 virtual ~HitQueueBase();
18
19 LUCENE_CLASS(HitQueueBase);
20
21 public:
22 virtual ScoreDocPtr add(const ScoreDocPtr& scoreDoc);
23 virtual ScoreDocPtr addOverflow(const ScoreDocPtr& scoreDoc);
24 virtual ScoreDocPtr top();
25 virtual ScoreDocPtr pop();
26 virtual ScoreDocPtr updateTop();
27 virtual int32_t size();
28 virtual bool empty();
29 virtual void clear();
30
31 protected:
32 PriorityQueueScoreDocsPtr queue;
33 int32_t queueSize;
34
35 public:
36 virtual void initialize();
37
38 protected:
39 virtual bool lessThan(const ScoreDocPtr& first, const ScoreDocPtr& second) = 0;
40 virtual ScoreDocPtr getSentinelObject();
41
42 friend class PriorityQueueScoreDocs;
43 };
44
45 class LPPAPI PriorityQueueScoreDocs : public PriorityQueue<ScoreDocPtr> {
46 public:
47 PriorityQueueScoreDocs(const HitQueueBasePtr& hitQueue, int32_t size);
48 virtual ~PriorityQueueScoreDocs();
49
50 LUCENE_CLASS(PriorityQueueScoreDocs);
51
52 protected:
53 HitQueueBaseWeakPtr _hitQueue;
54
55 protected:
56 virtual bool lessThan(const ScoreDocPtr& first, const ScoreDocPtr& second);
57 virtual ScoreDocPtr getSentinelObject();
58 };
59
60 }
61
62 #endif
Lucene::PriorityQueueScoreDocs
Definition: HitQueueBase.h:45
Lucene::PriorityQueue
A PriorityQueue maintains a partial ordering of its elements such that the least element can always b...
Definition: PriorityQueue.h:20
Lucene::ScoreDocPtr
boost::shared_ptr< ScoreDoc > ScoreDocPtr
Definition: LuceneTypes.h:428
Lucene::LuceneObject
Base class for all Lucene classes.
Definition: LuceneObject.h:31
LUCENE_CLASS
#define LUCENE_CLASS(Name)
Definition: LuceneObject.h:24
Lucene
Definition: AbstractAllTermDocs.h:12
Lucene::HitQueueBase::queueSize
int32_t queueSize
Definition: HitQueueBase.h:33
Lucene::HitQueueBaseWeakPtr
boost::weak_ptr< HitQueueBase > HitQueueBaseWeakPtr
Definition: LuceneTypes.h:371
Lucene::HitQueueBasePtr
boost::shared_ptr< HitQueueBase > HitQueueBasePtr
Definition: LuceneTypes.h:371
Lucene::HitQueueBase::queue
PriorityQueueScoreDocsPtr queue
Definition: HitQueueBase.h:32
Lucene::PriorityQueueScoreDocsPtr
boost::shared_ptr< PriorityQueueScoreDocs > PriorityQueueScoreDocsPtr
Definition: LuceneTypes.h:419
PriorityQueue.h
Lucene::HitQueueBase
Definition: HitQueueBase.h:14

clucene.sourceforge.net