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


ScorerDocQueue.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 SCORERDOCQUEUE_H
8 #define SCORERDOCQUEUE_H
9 
10 #include "LuceneObject.h"
11 
12 namespace Lucene {
13 
16 class LPPAPI ScorerDocQueue : public LuceneObject {
17 public:
18  ScorerDocQueue(int32_t maxSize);
19  virtual ~ScorerDocQueue();
20 
22 
23 protected:
25  int32_t maxSize;
26  int32_t _size;
27  HeapedScorerDocPtr topHSD; // same as heap[1], only for speed
28 
29 public:
32  void put(const ScorerPtr& scorer);
33 
37  bool insert(const ScorerPtr& scorer);
38 
42 
45  int32_t topDoc();
46 
47  double topScore();
49  bool topSkipToAndAdjustElsePop(int32_t target);
50 
54 
56  void adjustTop();
57 
59  int32_t size();
60 
62  void clear();
63 
64 protected:
65  bool checkAdjustElsePop(bool cond);
66 
69  void popNoResult();
70 
71  void upHeap();
72  void downHeap();
73 };
74 
75 }
76 
77 #endif
LUCENE_CLASS
#define LUCENE_CLASS(Name)
Definition: LuceneObject.h:24
Lucene::Collection< HeapedScorerDocPtr >
Lucene::ScorerDocQueue::topNextAndAdjustElsePop
bool topNextAndAdjustElsePop()
Lucene::ScorerDocQueue::checkAdjustElsePop
bool checkAdjustElsePop(bool cond)
Lucene::ScorerDocQueue::pop
ScorerPtr pop()
Removes and returns the least scorer of the ScorerDocQueue in log(size) time. Should not be used when...
Lucene::ScorerDocQueue::adjustTop
void adjustTop()
Should be called when the scorer at top changes doc() value.
Lucene::ScorerDocQueue::heap
Collection< HeapedScorerDocPtr > heap
Definition: ScorerDocQueue.h:21
Lucene::ScorerDocQueue::topScore
double topScore()
Lucene::ScorerDocQueue::topSkipToAndAdjustElsePop
bool topSkipToAndAdjustElsePop(int32_t target)
Lucene::ScorerDocQueue::_size
int32_t _size
Definition: ScorerDocQueue.h:26
Lucene::ScorerDocQueue::popNoResult
void popNoResult()
Removes the least scorer of the ScorerDocQueue in log(size) time. Should not be used when the queue i...
Lucene::ScorerDocQueue::topHSD
HeapedScorerDocPtr topHSD
Definition: ScorerDocQueue.h:27
Lucene::ScorerDocQueue::maxSize
int32_t maxSize
Definition: ScorerDocQueue.h:25
Lucene::ScorerDocQueue::insert
bool insert(const ScorerPtr &scorer)
Adds a Scorer to the ScorerDocQueue in log(size) time if either the ScorerDocQueue is not full,...
Lucene::ScorerDocQueue::put
void put(const ScorerPtr &scorer)
Adds a Scorer to a ScorerDocQueue in log(size) time. If one tries to add more Scorers than maxSize Ar...
Lucene
Definition: AbstractAllTermDocs.h:12
Lucene::HeapedScorerDocPtr
boost::shared_ptr< HeapedScorerDoc > HeapedScorerDocPtr
Definition: LuceneTypes.h:531
Lucene::LuceneObject
Base class for all Lucene classes.
Definition: LuceneObject.h:31
Lucene::ScorerDocQueue::ScorerDocQueue
ScorerDocQueue(int32_t maxSize)
Lucene::ScorerDocQueue
A ScorerDocQueue maintains a partial ordering of its Scorers such that the least Scorer can always be...
Definition: ScorerDocQueue.h:16
Lucene::ScorerPtr
boost::shared_ptr< Scorer > ScorerPtr
Definition: LuceneTypes.h:429
Lucene::ScorerDocQueue::upHeap
void upHeap()
Lucene::ScorerDocQueue::clear
void clear()
Removes all entries from the ScorerDocQueue.
Lucene::ScorerDocQueue::~ScorerDocQueue
virtual ~ScorerDocQueue()
Lucene::ScorerDocQueue::top
ScorerPtr top()
Returns the least Scorer of the ScorerDocQueue in constant time. Should not be used when the queue is...
Lucene::ScorerDocQueue::size
int32_t size()
Returns the number of scorers currently stored in the ScorerDocQueue.
Lucene::ScorerDocQueue::downHeap
void downHeap()
Lucene::ScorerDocQueue::topDoc
int32_t topDoc()
Returns document number of the least Scorer of the ScorerDocQueue in constant time....
LuceneObject.h

clucene.sourceforge.net