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 : 2005/12/28 00013 // 00014 #ifndef _TERMQUERY_H 00015 #define _TERMQUERY_H 00016 00017 #include "Weight.h" 00018 #include "Query.h" 00019 #include "TermScorer.h" 00020 #include "IndexSearcher.h" 00021 #include "../index/Term.h" 00022 00023 using namespace firtex::index; 00024 00025 namespace firtex 00026 { 00027 namespace search 00028 { 00029 class CTermQuery : public CQuery 00030 { 00031 class CTermWeight:public CWeight 00032 { 00033 public: 00034 CTermWeight(CSearcher* pSearcher,CTermQuery* pTermQuery,CTerm* pTerm); 00035 virtual ~CTermWeight(); 00036 public: 00037 weight_t squaredWeight(); 00038 weight_t getValue(); 00039 void normalize(float fQueryNorm); 00040 protected: 00041 CTerm* m_pTerm; 00042 CSearcher* m_pSearcher; 00043 00044 weight_t m_fWeight; 00045 score_t m_idf; 00046 }; 00047 public: 00048 CTermQuery(CTerm* t); 00049 CTermQuery(const CTermQuery& t); 00050 CTermQuery(void); 00051 virtual ~CTermQuery(void); 00052 public: 00053 const CTerm* term(){return m_pTerm;} 00054 00060 CScorer* scorer(CSearcher* pSearcher); 00061 00066 CQuery* clone(); 00067 00068 static const tchar* getClassName(){return _T("TermQuery");} 00069 00073 const tchar* getQueryName() const{return getClassName();} 00074 protected: 00075 CWeight* createWeight(CSearcher* pSearcher); 00076 protected: 00077 CTerm* m_pTerm; 00078 }; 00079 } 00080 } 00081 00082 #endif
http://www.firtex.org http://www.sourceforge.net/projects/firtex