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 00012 // Created : 2005/12/07 00013 // 00014 00015 #ifndef __INVFIINDEX_H 00016 #define __INVFIINDEX_H 00017 00018 #include "../utility/StdHeader.h" 00019 #include <string> 00020 #include <vector> 00021 #include "Index.h" 00022 #include "IndexBarrelWriter.h" 00023 #include "IndexBarrelReader.h" 00024 #include "BarrelsInfo.h" 00025 00026 using namespace std; 00027 00028 namespace firtex 00029 { 00030 namespace index 00031 { 00032 class CFXInvIndex : public CIndex 00033 { 00034 public: 00035 CFXInvIndex(const tchar* indName,bool bCreate); 00036 CFXInvIndex(CDirectory* pDirectory,bool bCreate); 00037 virtual ~CFXInvIndex(void); 00038 public: 00039 00044 void addDocument(document::CDocument* pDoc); 00045 00050 void deleteDocument(docid_t docID); 00051 00055 void deleteDocuments(const CTerm* term); 00056 00060 void undeleteAll(); 00061 00065 void close(); 00066 00070 void removeAll(); 00071 00075 count_t numDocs(); 00076 00081 count_t maxDoc(); 00082 00088 void merge(); 00089 00095 void optimize(bool bDeleteDocs = false); 00096 00103 document::CDocument* document(docid_t docID); 00104 00112 document::CField* field(docid_t docID,fieldid_t fid); 00113 00119 CTermReader* termReader(); 00120 00127 CNormBytes* norms(fieldid_t fieldID); 00128 00135 CNormBytes* norms(const tchar* field); 00136 00141 string getVersion(){return m_pBarrelsInfo->getVersion();}; 00142 00146 CBarrelsInfo& getBarrelsInfo(){return *m_pBarrelsInfo;} 00147 00152 CFieldsInfo& getFieldsInfo(); 00153 00159 CIndexBarrelReader* getBarrelReader(); 00160 00166 CTermVectorReader* getTermVectorReader(); 00167 protected: 00171 void writeCache(); 00172 00176 void createBarrelReader(); 00177 private: 00178 CBarrelsInfo* m_pBarrelsInfo; 00179 CIndexBarrelWriter* m_pIndexBarrelWriter; //当前索引桶写接口 00180 00181 CIndexBarrelReader* m_pBarrelReader; //barrel读接口 00182 00183 count_t m_docCounter; //文档计数器 00184 docid_t m_curMinDocID; //当前索引桶的最小文档编号 00185 00186 friend class CMultiTermSearcher; 00187 }; 00189 //Inline function 00190 } 00191 } 00192 00193 #endif
http://www.firtex.org http://www.sourceforge.net/projects/firtex