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_search_multisearcher 00008 #define _lucene_search_multisearcher 00009 00010 #if defined(_LUCENE_PRAGMA_ONCE) 00011 # pragma once 00012 #endif 00013 00014 #include "SearchHeader.h" 00015 #include "CLucene/document/Document.h" 00016 #include "CLucene/index/Term.h" 00017 00018 CL_NS_DEF(search) 00019 00020 class MultiHitCollector: public HitCollector{ 00021 private: 00022 HitCollector* results; 00023 int32_t start; 00024 public: 00025 MultiHitCollector(HitCollector* _results, int32_t _start); 00026 void collect(const int32_t doc, const float_t score) ; 00027 }; 00028 00029 00035 class MultiSearcher: public Searcher { 00036 private: 00037 Searchable** searchables; 00038 int32_t searchablesLen; 00039 int32_t* starts; 00040 int32_t _maxDoc; 00041 protected: 00042 int32_t* getStarts() { 00043 return starts; 00044 } 00045 00046 public: 00048 MultiSearcher(Searchable** searchables); 00049 00050 ~MultiSearcher(); 00051 00053 void close() ; 00054 00055 int32_t docFreq(const CL_NS(index)::Term* term) const ; 00056 00058 bool doc(int32_t n, CL_NS(document)::Document* document); 00059 00062 int32_t searcherIndex(int32_t n) const; 00063 00064 int32_t subSearcher(int32_t n) const; 00065 00066 int32_t subDoc(int32_t n) const; 00067 00068 int32_t maxDoc() const; 00069 00070 TopDocs* _search(Query* query, Filter* filter, const int32_t nDocs) ; 00071 00072 TopFieldDocs* _search (Query* query, Filter* filter, const int32_t n, const Sort* sort); 00073 00088 void _search(Query* query, Filter* filter, HitCollector* results); 00089 00090 Query* rewrite(Query* original); 00091 void explain(Query* query, int32_t doc, Explanation* ret); 00092 }; 00093 00094 CL_NS_END 00095 #endif