CLucene - a full-featured, c++ search engine
API Documentation
00001 /*------------------------------------------------------------------------------ 00002 * Copyright (C) 2003-2006 Ben van Klinken and the CLucene Team 00003 * 00004 * Distributable under the terms of either the Apache License (Version 2.0) or 00005 * the GNU Lesser General Public License, as specified in the COPYING file. 00006 ------------------------------------------------------------------------------*/ 00007 #ifndef _lucene_index_TermInfosWriter_ 00008 #define _lucene_index_TermInfosWriter_ 00009 00010 #if defined(_LUCENE_PRAGMA_ONCE) 00011 # pragma once 00012 #endif 00013 00014 #include "CLucene/store/Directory.h" 00015 #include "FieldInfos.h" 00016 #include "TermInfo.h" 00017 #include "Term.h" 00018 00019 CL_NS_DEF(index) 00020 00021 00022 // This stores a monotonically increasing set of <Term, TermInfo> pairs in a 00023 // Directory. A TermInfos can be written once, in order. 00024 class TermInfosWriter :LUCENE_BASE{ 00025 private: 00026 FieldInfos* fieldInfos; 00027 CL_NS(store)::IndexOutput* output; 00028 Term* lastTerm; 00029 TermInfo* lastTi; 00030 int64_t size; 00031 int64_t lastIndexPointer; 00032 bool isIndex; 00033 TermInfosWriter* other; 00034 00035 //inititalize 00036 TermInfosWriter(CL_NS(store)::Directory* directory, const char* segment, FieldInfos* fis, int32_t interval, bool isIndex); 00037 public: 00039 LUCENE_STATIC_CONSTANT(int32_t,FORMAT=-2); 00040 00048 int32_t indexInterval;// = 128 00049 00057 int32_t skipInterval;// = 16 00058 00059 TermInfosWriter(CL_NS(store)::Directory* directory, const char* segment, FieldInfos* fis, int32_t interval); 00060 00061 ~TermInfosWriter(); 00062 00068 void add(Term* term, const TermInfo* ti); 00069 00071 void close(); 00072 00073 private: 00075 void initialise(CL_NS(store)::Directory* directory, const char* segment, int32_t interval, bool IsIndex); 00076 void writeTerm(Term* term); 00077 }; 00078 CL_NS_END 00079 #endif