FirteX-高性能全文索引和检索平台

API Documentation


首页 | 名字空间列表 | 类继承关系 | 组合类型列表 | $(BL\录(B | 文件列表 | 名字空间成员 | 组合类型成员 | 文件成员

IndexBarrelWriter.h

浏览该文件的文档。
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 _INDEXBARRELWRITER_H
00016 #define _INDEXBARRELWRITER_H
00017 
00018 #if _MSC_VER > 1000
00019 #pragma once
00020 #endif // _MSC_VER > 1000
00021 
00022 #include "../utility/StdHeader.h"
00023 #include "FieldsInfo.h"
00024 #include "Posting.h"
00025 #include "StoredFieldsWriter.h"
00026 #include "StoredFieldsReader.h"
00027 #include "Term.h"
00028 #include "TermDocs.h"
00029 #include "TermPositions.h"
00030 #include "FieldIndexer.h"
00031 #include "../store/Directory.h"
00032 #include "../document/Document.h"
00033 #include "../document/Field.h"
00034 #include "../utility/MemCache.h"
00035 #include "../index/NormsWriter.h"
00036 #include "../index/TermVectorWriter.h"
00037 
00038 #include <map>
00039 
00040 using namespace std;
00041 using namespace firtex;
00042 using namespace firtex::store;
00043 
00044 namespace firtex
00045 {
00046         namespace index
00047         {               
00048 
00049                 class CIndexBarrelWriter
00050                 {
00051                 public:
00052                         CIndexBarrelWriter(CDirectory* pDirectory,const tstring& name);
00053                         CIndexBarrelWriter(CDirectory* pDirectory);
00054                         ~CIndexBarrelWriter(void);
00055                 public:
00060                         void                    open(const tstring& barrelName);
00061 
00065                         void                    close();
00066                         
00072                         bool                    addDocument(document::CDocument* pDoc); 
00073                         
00078                         bool                    cacheFull();
00083                         bool                    cacheEmpty(){return m_pMemCache->isEmpty();}                    
00084                         
00088                         const tstring&  getBarrelName(){return m_barrelName;}
00089 
00095                         CFieldIndexer*  getFieldIndexer(const tstring& field);
00096                 protected:
00100                         void                    writeCache();
00101 
00105                         void                    resetCache();
00106 
00107                         CPosMemCache*   getMemCache(){return m_pMemCache;}
00108                 protected:                      
00109                         CDirectory*                                     m_pDirectory;
00110                         tstring                                         m_barrelName;
00111                         CStoredFieldsWriter*            m_pStoredFieldsWriter;  
00112                         CTermVectorWriter*                      m_pTermVectorWriter;    
00113                         CFieldsInfo*                            m_pFieldsInfo;
00114                         CPosMemCache*                           m_pMemCache;                    //内存缓冲
00115 
00116                         CNormsWriter*                           m_pNormsWriter;
00117 
00118                         CFieldIndexer**                         m_fieldIndexers;
00119                         int32_t                                         m_numIndexers;
00120 
00121 
00122                         friend class CFXInvIndex;
00123                 };
00124         }
00125 }
00126 
00127 #endif

http://www.firtex.org http://www.sourceforge.net/projects/firtex