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/3 00013 // 00014 #ifndef _CONFIG_H 00015 #define _CONFIG_H 00016 00017 #include "StdHeader.h" 00018 #include "logger.h" 00019 #include <list> 00020 using namespace std; 00021 00022 namespace firtex 00023 { 00024 namespace utility 00025 { 00026 class CXMLElement; 00027 class CConfig 00028 { 00029 public: 00030 CConfig(void); 00031 ~CConfig(void); 00032 public: 00037 void setLogLevel(const tchar* l); 00038 tstring& getLogLevel(){return m_sLoglevel;} 00039 protected: 00040 void setup(); 00041 void terminate(); 00042 public: 00043 struct sGeneral 00044 { 00045 tstring Path; //程序所在路径 00046 tstring PluginPath; //插件路径 00047 }General; 00048 00049 struct sParser 00050 { 00051 }Parser; 00052 00053 struct sAnalyzer 00054 { 00055 tstring stopwordFile; 00056 }Analyzer; 00057 00058 struct sIndex 00059 { 00060 int32_t maxIndexTerms; //最多索引词数 00061 int64_t memory; //索引使用的内存Cache大小 00062 }Index; 00063 00064 struct sIndexMerger 00065 { 00066 int32_t mergeFactor; //合并因子,索引合并时每mergeFactor个一起合并 00067 int32_t maxIndexBarrels; //允许同时存在的子索引桶个数,子索引数大于此值则强制合并 00068 }IndexMerger; 00069 00070 tlogger Logger; 00071 00072 struct sAdvance 00073 { 00074 int32_t memGrow; //当内存池中内存不足,为了处理完当前文档向系统申请的内存容量 00075 int32_t indexInputBuffer; //CIndexInput读文件使用buffer大小,默认32K 00076 int32_t indexOutputBuffer; //CIndexOutput读文件使用buffer大小,默认32K 00077 int32_t posPostingInitSize; //position list 初始大小,默认为8,即2^8=256 00078 int32_t dfPostingInitSize; //doc and freq list 初始大小,默认为5,即2^5=32 00079 int32_t postingIncrement; //posting 大小增长因子,默认为2,newsize=2*oldsize 00080 }Advance; 00081 public: 00082 void load(const tstring& sFile = ""); 00083 void save(const tstring& sFile = ""); 00084 protected: 00085 void add(const tstring& sName, int64_t* pDword, int64_t nDefault); 00086 void add(const tstring& sName, int32_t* pDword, int32_t nDefault); 00087 void add(const tstring& sName, double* pFloat, double nDefault); 00088 void add(const tstring& sName, tstring* pString, const tstring& pszDefault); 00089 protected: 00090 public: 00091 class CParamItem 00092 { 00093 public: 00094 CParamItem(const tstring& sName, int64_t* pInt64,int32_t* pInt32,double* pFloat, tstring* pString); 00095 void load(CXMLElement* pXML); 00096 void save(CXMLElement* pXML); 00097 public: 00098 tstring m_sName; 00099 int32_t* m_pInt32; 00100 int64_t* m_pInt64; 00101 double* m_pFloat; 00102 tstring* m_pString; 00103 }; 00104 protected: 00105 list<CParamItem*> m_items; 00106 tstring m_sPath; 00107 00108 string m_sLoglevel;//disable_all,enable_all,default_level(info),fatal,err,warn,info,dbg 00109 }; 00110 extern CConfig GlobalConfig; 00111 #define FIRTEX_CLOG(log_level) FIRTEX_LOG(GlobalConfig.Logger,log_level) 00112 } 00113 } 00114 00115 using namespace firtex::utility; 00116 00117 #endif
http://www.firtex.org http://www.sourceforge.net/projects/firtex