FirteX-高性能全文索引和检索平台API Documentation |
00001 // 00002 // Copyright(C) 2005--2006 Institute of Computing Tech, Chinese Academy of Sciences. 00003 // All rights reserved. 00004 // This file is part of FirteX (www.firtex.org) 00005 // 00006 // Use of the FirteX is subject to the terms of the software license set forth in 00007 // the LICENSE file included with this software, and also available at 00008 // http://www.firtex.org/license.html 00009 // 00010 // Author : 郭瑞杰(GuoRuijie) 00011 // Email : ruijieguo@software.ict.ac.cn,ruijieguo@gmail.com 00012 // Created : 2006/5/9 00013 // 00014 #ifndef _CONJUNCTIONSCORER_H 00015 #define _CONJUNCTIONSCORER_H 00016 00017 #include <list> 00018 #include "Scorer.h" 00019 using namespace std; 00020 00021 namespace firtex 00022 { 00023 namespace search 00024 { 00025 class CConjunctionScorer :public CScorer 00026 { 00027 #define CONJUNCTION_PAGESIZE 1024 00028 typedef list<CScorer*> ScorerList; 00029 public: 00030 CConjunctionScorer(CSimilarity* pSimilarity); 00031 CConjunctionScorer(list<CScorer*>* scorers,CSimilarity* pSimilarity); 00032 virtual ~CConjunctionScorer(void); 00033 00034 public: 00039 count_t nextDocs(); 00040 00047 count_t scores(docid_t*& docs,score_t*& scores); 00048 00056 bool skipTo(docid_t target,docid_t& nearTarget); 00057 00062 bool next(); 00063 00064 /* 00065 * 返回当前位置文档的打分结果,必须配合{@link skipTo(docid_t,DOC_ID)}或{@link next()}使用,只有返回true后才有效 00066 */ 00067 score_t score(); 00068 00069 /* 00070 * 返回当前位置文档ID,必须配合{@link skipTo(docid_t,DOC_ID)}或{@link next()}使用,只有返回true后才有效 00071 */ 00072 docid_t doc(); 00073 00074 /* 00075 * add one scorer 00076 * @param pScorer The scorer witch will be added to the m_scoresList 00077 */ 00078 void add(CScorer* pScorer){m_scoresList.push_back(pScorer);} 00079 protected: 00080 ScorerList m_scoresList; 00081 00082 docid_t m_docs[CONJUNCTION_PAGESIZE]; //文档ID,内存由CTermDocs维护 00083 score_t m_scores[CONJUNCTION_PAGESIZE]; //打分结果 00084 count_t m_numDocs; //文档数 00085 }; 00086 } 00087 } 00088 00089 #endif
http://www.firtex.org http://www.sourceforge.net/projects/firtex