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_PrefixQuery 00008 #define _lucene_search_PrefixQuery 00009 00010 CL_CLASS_DEF(index,Term) 00011 //#include "CLucene/index/Terms.h" 00012 //#include "CLucene/index/IndexReader.h" 00013 //#include "SearchHeader.h" 00014 //#include "BooleanQuery.h" 00015 //#include "TermQuery.h" 00016 #include "Query.h" 00017 #include "Filter.h" 00018 CL_CLASS_DEF(util,StringBuffer) 00019 00020 CL_NS_DEF(search) 00023 class CLUCENE_EXPORT PrefixQuery: public Query { 00024 private: 00025 CL_NS(index)::Term* prefix; 00026 protected: 00027 PrefixQuery(const PrefixQuery& clone); 00028 public: 00029 00030 //Constructor. Constructs a query for terms starting with prefix 00031 PrefixQuery(CL_NS(index)::Term* Prefix); 00032 00033 //Destructor 00034 ~PrefixQuery(); 00035 00036 //Returns the name "PrefixQuery" 00037 const TCHAR* getQueryName() const; 00038 static const TCHAR* getClassName(); 00039 00041 CL_NS(index)::Term* getPrefix(bool pointer=true); 00042 00043 Query* combine(Query** queries); 00044 Query* rewrite(CL_NS(index)::IndexReader* reader); 00045 Query* clone() const; 00046 bool equals(Query * other) const; 00047 00048 //Creates a user-readable version of this query and returns it as as string 00049 TCHAR* toString(const TCHAR* field) const; 00050 00051 size_t hashCode() const; 00052 }; 00053 00054 00055 class PrefixFilter: public Filter 00056 { 00057 private: 00058 CL_NS(index)::Term* prefix; 00059 protected: 00060 PrefixFilter( const PrefixFilter& copy ); 00061 00062 public: 00063 PrefixFilter(CL_NS(index)::Term* prefix); 00064 ~PrefixFilter(); 00065 00068 CL_NS(util)::BitSet* bits( CL_NS(index)::IndexReader* reader ); 00069 00070 Filter* clone() const; 00071 00073 TCHAR* toString(); 00074 00075 // Returns a reference of internal prefix 00076 CL_NS(index)::Term* getPrefix() const; 00077 }; 00078 CL_NS_END 00079 #endif