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_MultiReader 00008 #define _lucene_index_MultiReader 00009 00010 00011 //#include "SegmentHeader.h" 00012 #include "IndexReader.h" 00013 CL_CLASS_DEF(document,Document) 00014 //#include "Terms.h" 00015 //#include "SegmentMergeQueue.h" 00016 00017 CL_NS_DEF(index) 00018 00019 class MultiReader:public IndexReader{ 00020 private: 00021 class Internal; 00022 Internal* internal; 00023 int32_t readerIndex(const int32_t n) const; 00024 bool hasNorms(const TCHAR* field); 00025 uint8_t* fakeNorms(); 00026 protected: 00027 void doSetNorm(int32_t n, const TCHAR* field, uint8_t value); 00028 void doUndeleteAll(); 00029 void doCommit(); 00030 // synchronized 00031 void doClose(); 00032 00033 // synchronized 00034 void doDelete(const int32_t n); 00035 public: 00037 MultiReader(CL_NS(store)::Directory* directory, SegmentInfos* sis, IndexReader** subReaders); 00038 00047 MultiReader(IndexReader** subReaders); 00048 00049 ~MultiReader(); 00050 00057 bool getTermFreqVectors(int32_t n, CL_NS(util)::Array<TermFreqVector*>& result); 00058 TermFreqVector* getTermFreqVector(int32_t n, const TCHAR* field); 00059 00060 00061 // synchronized 00062 int32_t numDocs(); 00063 00064 int32_t maxDoc() const; 00065 00066 bool document(int32_t n, CL_NS(document)::Document* doc); 00067 00068 bool isDeleted(const int32_t n); 00069 bool hasDeletions() const; 00070 00071 // synchronized 00072 uint8_t* norms(const TCHAR* field); 00073 void norms(const TCHAR* field, uint8_t* result); 00074 00075 TermEnum* terms() const; 00076 TermEnum* terms(const Term* term) const; 00077 00078 //Returns the document frequency of the current term in the set 00079 int32_t docFreq(const Term* t=NULL) const; 00080 TermDocs* termDocs() const; 00081 TermPositions* termPositions() const; 00082 00083 00087 void getFieldNames(FieldOption fldOption, StringArrayWithDeletor& retarray); 00088 }; 00089 00090 00091 CL_NS_END 00092 #endif