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/11/9 00013 // 00014 #ifndef __COLLECTION_H 00015 #define __COLLECTION_H 00016 00017 #include "../index/IndexWriter.h" 00018 #include "../utility/StdHeader.h" 00019 #include "../document/doctypedef.h" 00020 00021 using namespace firtex::index; 00022 00023 namespace firtex 00024 { 00025 namespace collection 00026 { 00031 class CCollection 00032 { 00033 public: 00034 static const tstring category; 00035 static const tstring identifier; 00036 public: 00037 CCollection(void); 00038 00044 CCollection(CIndexWriter* pIndexWriter); 00045 virtual ~CCollection(void); 00046 public: 00051 void attachWriter(CIndexWriter* pWriter); 00052 00058 CIndexWriter* detachWriter(); 00059 00064 void setTerminate(bool bTerminate = true){m_bTerminate = bTerminate;} 00065 00070 inline bool isTerminate(){return m_bTerminate;} 00071 00078 void setModifiedDate(const tchar* field = _T("modified"),bool bStore = true,bool bIndex = true); 00079 00083 bool isIndexModifiedDate(); 00084 00085 schemaid_t getModifiedDateSchemaId(){return m_modifiedDateSchemaId;} 00086 00092 inline CIndexParameter* getIndexParameter(); 00093 public: 00097 virtual tstring getCategory(){ return category; } 00098 00102 virtual tstring getIdentifier(){ return m_identifier; } 00103 00107 bool scan(); 00108 public: 00112 virtual bool addFile(const tchar* filename){throw CUnsupportedOperationException("CCollection.addFile");return false;} 00113 00117 virtual void close(); 00118 protected: 00122 virtual bool scanInternal()=0; 00123 protected: 00124 CIndexWriter* m_pIndexWriter; 00125 CIndexParameter* m_pIndexParameter; 00126 bool m_bTerminate; 00127 tstring m_identifier; 00128 schemaid_t m_modifiedDateSchemaId; 00129 }; 00131 // 00132 inline CIndexParameter* CCollection::getIndexParameter() 00133 { 00134 if(!m_pIndexParameter) 00135 m_pIndexParameter = new CIndexParameter(); 00136 return m_pIndexParameter; 00137 } 00138 inline bool CCollection::isIndexModifiedDate() 00139 { 00140 return (m_modifiedDateSchemaId!=-1); 00141 } 00142 } 00143 } 00144 00145 00146 #endif
http://www.firtex.org http://www.sourceforge.net/projects/firtex