Lucene++ - a full-featured, c++ search engine
API Documentation

BooleanQuery.h
Go to the documentation of this file.
1 // Copyright (c) 2009-2014 Alan Wright. All rights reserved.
3 // Distributable under the terms of either the Apache License (Version 2.0)
4 // or the GNU Lesser General Public License.
6
7 #ifndef BOOLEANQUERY_H
8 #define BOOLEANQUERY_H
9
10 #include "Query.h"
11 #include "BooleanClause.h"
12 #include "Weight.h"
13
14 namespace Lucene {
15
18 class LPPAPI BooleanQuery : public Query {
19 public:
27 BooleanQuery(bool disableCoord = false);
28 virtual ~BooleanQuery();
29
30 LUCENE_CLASS(BooleanQuery);
31
32 protected:
33 static int32_t maxClauseCount;
34
35 Collection<BooleanClausePtr> clauses;
36 bool disableCoord;
37 int32_t minNrShouldMatch;
38
39 public:
40 using Query::toString;
41
45 static int32_t getMaxClauseCount();
46
48 static void setMaxClauseCount(int32_t maxClauseCount);
49
52 bool isCoordDisabled();
53
55 virtual SimilarityPtr getSimilarity(const SearcherPtr& searcher);
56
66 void setMinimumNumberShouldMatch(int32_t min);
67
69 int32_t getMinimumNumberShouldMatch();
70
73 void add(const QueryPtr& query, BooleanClause::Occur occur);
74
77 void add(const BooleanClausePtr& clause);
78
80 Collection<BooleanClausePtr> getClauses();
81
83 Collection<BooleanClausePtr>::iterator begin();
84 Collection<BooleanClausePtr>::iterator end();
85
86 virtual WeightPtr createWeight(const SearcherPtr& searcher);
87
88 virtual QueryPtr rewrite(const IndexReaderPtr& reader);
89
90 virtual void extractTerms(SetTerm terms);
91
92 virtual LuceneObjectPtr clone(const LuceneObjectPtr& other = LuceneObjectPtr());
93 virtual String toString(const String& field);
94 virtual bool equals(const LuceneObjectPtr& other);
95 virtual int32_t hashCode();
96
97 friend class BooleanWeight;
98 };
99
100 }
101
102 #endif
BooleanClause.h
LUCENE_CLASS
#define LUCENE_CLASS(Name)
Definition: LuceneObject.h:24
Query.h
Weight.h
Lucene::BooleanClause::Occur
Occur
Specifies how clauses are to occur in matching documents.
Definition: BooleanClause.h:18
Lucene::BooleanQuery
A Query that matches documents matching boolean combinations of other queries, eg....
Definition: BooleanQuery.h:18
Lucene::BooleanQuery::setMinimumNumberShouldMatch
void setMinimumNumberShouldMatch(int32_t min)
Specifies a minimum number of the optional BooleanClauses which must be satisfied.
Lucene::BooleanQuery::add
void add(const QueryPtr &query, BooleanClause::Occur occur)
Adds a clause to a boolean query.
Lucene::BooleanQuery::hashCode
virtual int32_t hashCode()
Return hash code for this object.
Lucene::BooleanQuery::getSimilarity
virtual SimilarityPtr getSimilarity(const SearcherPtr &searcher)
Implement coord disabling.
Lucene::BooleanQuery::extractTerms
virtual void extractTerms(SetTerm terms)
Adds all terms occurring in this query to the terms set. Only works if this query is in its rewritten...
Lucene::BooleanQuery::~BooleanQuery
virtual ~BooleanQuery()
Lucene::BooleanQuery::getMaxClauseCount
static int32_t getMaxClauseCount()
Return the maximum number of clauses permitted, 1024 by default. Attempts to add more than the permit...
Lucene::BooleanQuery::disableCoord
bool disableCoord
Definition: BooleanQuery.h:36
Lucene::BooleanQuery::end
Collection< BooleanClausePtr >::iterator end()
Lucene::BooleanQuery::begin
Collection< BooleanClausePtr >::iterator begin()
Returns an iterator on the clauses in this query.
Lucene::BooleanQuery::toString
virtual String toString(const String &field)
Prints a query to a string, with field assumed to be the default field and omitted.
Lucene::BooleanQuery::getMinimumNumberShouldMatch
int32_t getMinimumNumberShouldMatch()
Gets the minimum number of the optional BooleanClauses which must be satisfied.
Lucene::BooleanQuery::rewrite
virtual QueryPtr rewrite(const IndexReaderPtr &reader)
Called to re-write queries into primitive queries. For example, a PrefixQuery will be rewritten into ...
Lucene::BooleanQuery::clauses
Collection< BooleanClausePtr > clauses
Definition: BooleanQuery.h:35
Lucene::BooleanQuery::minNrShouldMatch
int32_t minNrShouldMatch
Definition: BooleanQuery.h:37
Lucene::BooleanQuery::createWeight
virtual WeightPtr createWeight(const SearcherPtr &searcher)
Constructs an appropriate Weight implementation for this query. Only implemented by primitive queries...
Lucene::BooleanQuery::clone
virtual LuceneObjectPtr clone(const LuceneObjectPtr &other=LuceneObjectPtr())
Returns a clone of this query.
Lucene::BooleanQuery::isCoordDisabled
bool isCoordDisabled()
Returns true if Similarity#coord(int32_t, int32_t) is disabled in scoring for this query instance.
Lucene::BooleanQuery::setMaxClauseCount
static void setMaxClauseCount(int32_t maxClauseCount)
Set the maximum number of clauses permitted per BooleanQuery. Default value is 1024.
Lucene::BooleanQuery::BooleanQuery
BooleanQuery(bool disableCoord=false)
Constructs an empty boolean query.
Lucene::BooleanQuery::getClauses
Collection< BooleanClausePtr > getClauses()
Returns the set of clauses in this query.
Lucene::BooleanQuery::add
void add(const BooleanClausePtr &clause)
Adds a clause to a boolean query.
Lucene::BooleanQuery::maxClauseCount
static int32_t maxClauseCount
Definition: BooleanQuery.h:30
Lucene::BooleanQuery::equals
virtual bool equals(const LuceneObjectPtr &other)
Return whether two objects are equal.
Lucene::Collection< BooleanClausePtr >
Lucene::Query
The abstract base class for queries.
Definition: Query.h:31
Lucene::Query::toString
virtual String toString()
Prints a query to a string.
Lucene
Definition: AbstractAllTermDocs.h:12
Lucene::LuceneObjectPtr
boost::shared_ptr< LuceneObject > LuceneObjectPtr
Definition: LuceneTypes.h:539
Lucene::QueryPtr
boost::shared_ptr< Query > QueryPtr
Definition: LuceneTypes.h:420
Lucene::SearcherPtr
boost::shared_ptr< Searcher > SearcherPtr
Definition: LuceneTypes.h:434
Lucene::SimilarityPtr
boost::shared_ptr< Similarity > SimilarityPtr
Definition: LuceneTypes.h:435
Lucene::BooleanClausePtr
boost::shared_ptr< BooleanClause > BooleanClausePtr
Definition: LuceneTypes.h:278
Lucene::IndexReaderPtr
boost::shared_ptr< IndexReader > IndexReaderPtr
Definition: LuceneTypes.h:157
Lucene::WeightPtr
boost::shared_ptr< Weight > WeightPtr
Definition: LuceneTypes.h:480

clucene.sourceforge.net