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_BooleanQuery_ 00008 #define _lucene_search_BooleanQuery_ 00009 00010 00011 //#include "ConjunctionScorer.h" 00012 //#include "CLucene/index/IndexReader.h" 00013 #include "CLucene/util/VoidMapSetDefinitions.h" 00014 CL_CLASS_DEF(util,StringBuffer) 00015 CL_CLASS_DEF(search,Weight) 00016 CL_CLASS_DEF(search,BooleanWeight2) 00017 #include "Query.h" 00018 //#include "SearchHeader.h" 00019 #include "BooleanClause.h" 00020 //#include "BooleanScorer.h" 00021 //#include "Scorer.h" 00022 //#include "Similarity.h" 00023 00024 CL_NS_DEF(search) 00025 00026 00027 // A Query that matches documents matching boolean combinations of other 00028 // queries, typically {@link TermQuery}s or {@link PhraseQuery}s. 00029 class CLUCENE_EXPORT BooleanQuery:public Query { 00030 public: 00031 typedef CL_NS(util)::CLVector<BooleanClause*,CL_NS(util)::Deletor::Object<BooleanClause> > ClausesType; 00032 private: 00033 ClausesType* clauses; 00034 static size_t maxClauseCount; 00035 00036 static bool useScorer14; 00037 00038 LUCENE_STATIC_CONSTANT(bool, allowDocsOutOfOrder=false); 00039 00040 bool disableCoord; 00041 protected: 00042 int32_t minNrShouldMatch; 00043 Weight* _createWeight(Searcher* searcher); 00044 BooleanQuery(const BooleanQuery& clone); 00045 00046 public: 00048 BooleanQuery( bool disableCoord = false ); 00049 00050 ~BooleanQuery(); 00051 const TCHAR* getQueryName() const; 00052 static const TCHAR* getClassName(); 00053 00057 static size_t getMaxClauseCount(); 00058 00060 static void setMaxClauseCount(size_t maxClauseCount); 00061 00082 void add(Query* query, const bool required, const bool prohibited){ 00083 add(query,false,required,prohibited); 00084 } 00085 void add(Query* query, const bool deleteQuery, const bool required, const bool prohibited); 00086 00087 void add(Query* query, const bool deleteQuery, BooleanClause::Occur occur); 00088 void add(Query* query, BooleanClause::Occur occur) { add(query,false,occur); }; 00089 00094 void getClauses(BooleanClause** clauses) const; 00095 00097 _CL_DEPRECATED( getClauses(clauses) ) BooleanClause** getClauses() const; 00098 00103 size_t getClauseCount() const; 00104 00108 void add(BooleanClause* clause); 00109 00110 Query* rewrite(CL_NS(index)::IndexReader* reader); 00111 Query* clone() const; 00112 00113 bool equals(Query* o) const; 00114 Similarity* getSimilarity( Searcher* searcher ); 00115 00116 bool isCoordDisabled(); 00117 void setCoordDisabled( bool disableCoord ); 00118 00119 static bool getUseScorer14(); 00120 static void setUseScorer14( bool use14 ); 00121 00123 TCHAR* toString(const TCHAR* field) const; 00125 size_t hashCode() const; 00126 00127 //internal 00128 int32_t getMinNrShouldMatch(); 00129 }; 00130 00131 CL_NS_END 00132 #endif