#include "CLucene/StdHeader.h" #ifndef _lucene_index_SegmentMerger_ #define _lucene_index_SegmentMerger_ #include "CLucene/store/Directory.h" #include "CLucene/document/Document.h" #include "CLucene/util/BitVector.h" #include "CLucene/util/VoidList.h" #include "SegmentMergeInfo.h" #include "SegmentMergeQueue.h" #include "FieldInfos.h" #include "FieldsWriter.h" #include "TermInfosWriter.h" namespace lucene{ namespace index { class SegmentMerger { private: Directory& directory; const char_t* segment; lucene::util::VoidList readers; FieldInfos* fieldInfos; SegmentMergeQueue* queue; lucene::store::OutputStream* freqOutput; lucene::store::OutputStream* proxOutput; TermInfosWriter* termInfosWriter; TermInfo termInfo; //(new) minimize consing public: SegmentMerger(Directory& dir, const char_t* name); ~SegmentMerger(); void add(SegmentReader& reader); SegmentReader& segmentReader(const int_t i); void merge(); private: const char_t* segmentname(const char_t* ext, const int_t x=-1); void mergeFields(); void mergeTerms(); void mergeTermInfos(); void mergeTermInfo( SegmentMergeInfo** smis, const int_t n); int_t appendPostings(SegmentMergeInfo** smis, const int_t n); void mergeNorms(); }; }} #endif