CLucene - a full-featured, c++ search engine
API Documentation
00001 /*------------------------------------------------------------------------------ 00002 * Copyright (C) 2003-2006 Ben van Klinken and the CLucene Team 00003 * 00004 * Distributable under the terms of either the Apache License (Version 2.0) or 00005 * the GNU Lesser General Public License, as specified in the COPYING file. 00006 ------------------------------------------------------------------------------*/ 00007 #ifndef _lucene_search_Scorer_ 00008 #define _lucene_search_Scorer_ 00009 00010 #if defined(_LUCENE_PRAGMA_ONCE) 00011 # pragma once 00012 #endif 00013 00014 #include "Similarity.h" 00015 #include "SearchHeader.h" 00016 #include "Explanation.h" 00017 00018 CL_NS_DEF(search) 00020 class Scorer: LUCENE_BASE { 00021 private: 00022 Similarity* similarity; 00023 protected: 00025 Scorer(Similarity* similarity) { 00026 this->similarity = similarity; 00027 } 00028 public: 00029 virtual ~Scorer(){ 00030 } 00031 00033 Similarity* getSimilarity() const{ 00034 return this->similarity; 00035 } 00036 00038 void score(HitCollector* hc) { 00039 while (next()) { 00040 hc->collect(doc(), score()); 00041 } 00042 } 00043 00046 virtual bool next() = 0; 00047 00050 virtual int32_t doc() const = 0; 00051 00054 virtual float_t score() = 0; 00055 00069 virtual bool skipTo(int32_t target) = 0; 00070 00072 virtual void explain(int32_t doc, Explanation* ret) = 0; 00073 00074 00076 virtual TCHAR* toString() = 0; 00077 00078 }; 00079 CL_NS_END 00080 #endif