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 _INDEX_H 00016 #define _INDEX_H 00017 00018 #include "../document/Document.h" 00019 #include "../store/Directory.h" 00020 #include "TermReader.h" 00021 #include "IndexBarrelReader.h" 00022 #include "TermVectorReader.h" 00023 #include "BarrelsInfo.h" 00024 00025 using namespace firtex; 00026 using namespace firtex::store; 00027 00028 namespace firtex 00029 { 00030 namespace index 00031 { 00032 class CNormBytes; 00033 class CIndex 00034 { 00035 public: 00036 00037 CIndex(void):m_pDirectory(NULL) 00038 { 00039 } 00040 CIndex(CDirectory* pDir):m_pDirectory(pDir) 00041 { 00042 00043 } 00044 00045 virtual ~CIndex(void) 00046 { 00047 if(m_pDirectory) 00048 { 00049 m_pDirectory->close(); 00050 m_pDirectory = NULL; 00051 } 00052 } 00053 public: 00058 virtual void addDocument(document::CDocument* pDoc) = 0; 00059 00064 virtual void deleteDocument(docid_t docID) = 0; 00065 00069 virtual void deleteDocuments(const CTerm* term) = 0; 00070 00074 virtual void undeleteAll() = 0; 00075 00079 virtual void close() = 0; 00080 00084 virtual void removeAll() = 0; 00085 00089 virtual count_t numDocs() = 0; 00090 00095 virtual count_t maxDoc() = 0; 00096 00101 virtual document::CDocument* document(docid_t docID) = 0; 00102 00110 virtual document::CField* field(docid_t docID,fieldid_t fid) = 0; 00111 00112 00116 virtual CTermReader* termReader() = 0; 00117 00123 virtual CNormBytes* norms(fieldid_t fieldID) = 0; 00124 00130 virtual CNormBytes* norms(const tchar* field) = 0; 00131 00137 virtual void merge() = 0; 00138 00144 virtual void optimize(bool bDeleteDocs = false) = 0; 00145 00149 CDirectory* getDirectory(){return m_pDirectory;} 00150 00154 void setDirectory(CDirectory* pDir){m_pDirectory = pDir;} 00155 00160 virtual string getVersion() = 0; 00161 00165 virtual CBarrelsInfo& getBarrelsInfo() = 0; 00166 00171 virtual CIndexBarrelReader* getBarrelReader() = 0; 00172 00177 virtual CFieldsInfo& getFieldsInfo() = 0; 00178 00184 virtual CTermVectorReader* getTermVectorReader() = 0; 00185 protected: 00186 CDirectory* m_pDirectory; 00187 00188 }; 00189 } 00190 } 00191 00192 #endif
http://www.firtex.org http://www.sourceforge.net/projects/firtex