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_TermScorer_ 00008 #define _lucene_search_TermScorer_ 00009 00010 #if defined(_LUCENE_PRAGMA_ONCE) 00011 # pragma once 00012 #endif 00013 00014 #include "Scorer.h" 00015 #include "CLucene/index/Terms.h" 00016 #include "CLucene/search/Similarity.h" 00017 #include "SearchHeader.h" 00018 00019 CL_NS_DEF(search) 00020 00021 class TermScorer: public Scorer { 00022 private: 00023 CL_NS(index)::TermDocs* termDocs; 00024 uint8_t* norms; 00025 Weight* weight; 00026 const float_t weightValue; 00027 int32_t _doc; 00028 00029 int32_t docs[32]; // buffered doc numbers 00030 int32_t freqs[32]; // buffered term freqs 00031 int32_t pointer; 00032 int32_t pointerMax; 00033 00034 float_t scoreCache[LUCENE_SCORE_CACHE_SIZE]; 00035 public: 00036 00037 //TermScorer takes TermDocs and delets it when TermScorer is cleaned up 00038 TermScorer(Weight* weight, CL_NS(index)::TermDocs* td, 00039 Similarity* similarity, uint8_t* _norms); 00040 00041 ~TermScorer(); 00042 00043 int32_t doc() const { return _doc; } 00044 00045 bool next(); 00046 bool skipTo(int32_t target); 00047 void explain(int32_t doc, Explanation* ret); 00048 TCHAR* toString(); 00049 00050 float_t score(); 00051 }; 00052 CL_NS_END 00053 #endif