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/25 00013 // 00014 #ifndef __SEARCHER_H 00015 #define __SEARCHER_H 00016 00017 #include "QueryHits.h" 00018 #include "Similarity.h" 00019 00020 #include "../index/TermDocs.h" 00021 #include "../index/TermReader.h" 00022 #include "../index/NormBytes.h" 00023 using namespace firtex::index; 00024 using namespace firtex; 00025 00026 namespace firtex 00027 { 00028 namespace search 00029 { 00030 00031 class CSearcher 00032 { 00033 public: 00034 00035 CSearcher(void) 00036 { 00037 m_pSimilarity = CSimilarity::getDefault();//创建默认的Similarity 00038 } 00039 00040 virtual ~CSearcher(void) 00041 { 00042 00043 m_pSimilarity = NULL; 00044 } 00045 public: 00052 virtual CQueryHits* search(CQuery* pQuery,int nDocs) = 0; 00053 00060 virtual CQuery* optimizeQuery(CQuery* pOrgQuery) = 0; 00061 00066 virtual CTermReader* termReader()const=0; 00067 00073 virtual freq_t docFreq(CTerm* pTerm)=0; 00074 00080 virtual CNormBytes* norms(const tchar* field) = 0; 00081 00086 virtual count_t maxDocs()=0; 00087 00093 virtual document::CDocument* doc(docid_t docID)=0; 00094 00095 CSimilarity* getSimilarity() 00096 { 00097 return m_pSimilarity; 00098 } 00099 void setSimilarity(CSimilarity* pSimilarity) 00100 { 00101 m_pSimilarity = pSimilarity; 00102 } 00103 00104 protected: 00105 CSimilarity* m_pSimilarity; 00106 }; 00107 } 00108 00109 } 00110 00111 00112 #endif
http://www.firtex.org http://www.sourceforge.net/projects/firtex