CLucene - a full-featured, c++ search engine
API Documentation
00001 #ifndef _lucene_util_ScorerDocQueue_ 00002 #define _lucene_util_ScorerDocQueue_ 00003 00004 00005 CL_CLASS_DEF(search,Scorer) 00006 00007 CL_NS_USE(search) 00008 CL_NS_DEF(util) 00009 00010 class CLUCENE_EXPORT ScorerDocQueue:LUCENE_BASE { 00011 private: 00012 class HeapedScorerDoc:LUCENE_BASE { 00013 public: 00014 Scorer* _scorer; 00015 int32_t _doc; 00016 00017 HeapedScorerDoc( Scorer* s ); 00018 HeapedScorerDoc( Scorer* s, int32_t doc ); 00019 ~HeapedScorerDoc(); 00020 00021 void adjust(); 00022 }; 00023 00024 HeapedScorerDoc** heap; 00025 HeapedScorerDoc* topHsd; 00026 00027 int32_t maxSize; 00028 int32_t _size; 00029 00030 public: 00031 00032 ScorerDocQueue( int32_t maxSize ); 00033 ~ScorerDocQueue(); 00034 00035 void put( Scorer* scorer ); 00036 bool insert( Scorer* scorer ); 00037 Scorer* pop(); 00038 void adjustTop(); 00039 int32_t size(); 00040 void clear(); 00041 00042 Scorer* top(); 00043 int32_t topDoc(); 00044 float_t topScore(); 00045 bool topNextAndAdjustElsePop(); 00046 bool topSkipToAndAdjustElsePop( int32_t target ); 00047 00048 private: 00049 00050 bool checkAdjustElsePop( bool cond ); 00051 void popNoResult(); 00052 void upHeap(); 00053 void downHeap(); 00054 00055 }; 00056 00057 CL_NS_END 00058 #endif