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_IndexSearcher_ 00008 #define _lucene_search_IndexSearcher_ 00009 00010 00011 #include "Searchable.h" 00012 CL_CLASS_DEF(store,Directory) 00013 CL_CLASS_DEF(document,Document) 00014 CL_CLASS_DEF(index,Term) 00015 CL_CLASS_DEF(search,TopDocs) 00016 CL_CLASS_DEF(search,TopFieldDocs) 00017 CL_CLASS_DEF(search,Query) 00018 CL_CLASS_DEF(search,Filter) 00019 CL_CLASS_DEF(search,Sort) 00020 CL_CLASS_DEF(search,HitCollector) 00021 CL_CLASS_DEF(search,Explanation) 00022 CL_CLASS_DEF(index,IndexReader) 00023 //#include "CLucene/index/IndexReader.h" 00024 //#include "CLucene/util/BitSet.h" 00025 //#include "HitQueue.h" 00026 //#include "FieldSortedHitQueue.h" 00027 00028 CL_NS_DEF(search) 00034 class CLUCENE_EXPORT IndexSearcher:public Searcher{ 00035 CL_NS(index)::IndexReader* reader; 00036 bool readerOwner; 00037 00038 public: 00040 IndexSearcher(const char* path); 00041 00043 IndexSearcher(CL_NS(store)::Directory* directory); 00044 00046 IndexSearcher(CL_NS(index)::IndexReader* r); 00047 00048 ~IndexSearcher(); 00049 00051 void close(); 00052 00053 int32_t docFreq(const CL_NS(index)::Term* term) const; 00054 00055 bool doc(int32_t i, CL_NS(document)::Document* document); 00056 _CL_DEPRECATED( doc(i, document) ) CL_NS(document)::Document* doc(int32_t i); 00057 00058 int32_t maxDoc() const; 00059 00060 TopDocs* _search(Query* query, Filter* filter, const int32_t nDocs); 00061 TopFieldDocs* _search(Query* query, Filter* filter, const int32_t nDocs, const Sort* sort); 00062 00063 void _search(Query* query, Filter* filter, HitCollector* results); 00064 00065 CL_NS(index)::IndexReader* getReader(); 00066 00067 Query* rewrite(Query* original); 00068 void explain(Query* query, int32_t doc, Explanation* ret); 00069 00070 virtual const TCHAR* getClassName(); 00071 }; 00072 CL_NS_END 00073 #endif