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


Loading...
Searching...
No Matches
BooleanQuery.h
Go to the documentation of this file.
1
2// 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
14namespace Lucene {
15
18class LPPAPI BooleanQuery : public Query {
19public:
27 BooleanQuery(bool disableCoord = false);
28 virtual ~BooleanQuery();
29
31
32protected:
33 static int32_t maxClauseCount;
34
38
39public:
40 using Query::toString;
41
45 static int32_t getMaxClauseCount();
46
48 static void setMaxClauseCount(int32_t maxClauseCount);
49
53
55 virtual SimilarityPtr getSimilarity(const SearcherPtr& searcher);
56
66 void setMinimumNumberShouldMatch(int32_t min);
67
70
73 void add(const QueryPtr& query, BooleanClause::Occur occur);
74
77 void add(const BooleanClausePtr& clause);
78
81
85
86 virtual WeightPtr createWeight(const SearcherPtr& searcher);
87
88 virtual QueryPtr rewrite(const IndexReaderPtr& reader);
89
90 virtual void extractTerms(SetTerm terms);
91
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
#define LUCENE_CLASS(Name)
Definition LuceneObject.h:24
Occur
Specifies how clauses are to occur in matching documents.
Definition BooleanClause.h:18
A Query that matches documents matching boolean combinations of other queries, eg....
Definition BooleanQuery.h:18
void setMinimumNumberShouldMatch(int32_t min)
Specifies a minimum number of the optional BooleanClauses which must be satisfied.
void add(const QueryPtr &query, BooleanClause::Occur occur)
Adds a clause to a boolean query.
Collection< BooleanClausePtr >::iterator end()
Collection< BooleanClausePtr >::iterator begin()
Returns an iterator on the clauses in this query.
virtual int32_t hashCode()
Return hash code for this object.
virtual SimilarityPtr getSimilarity(const SearcherPtr &searcher)
Implement coord disabling.
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...
static int32_t getMaxClauseCount()
Return the maximum number of clauses permitted, 1024 by default. Attempts to add more than the permit...
bool disableCoord
Definition BooleanQuery.h:36
virtual String toString(const String &field)
Prints a query to a string, with field assumed to be the default field and omitted.
int32_t getMinimumNumberShouldMatch()
Gets the minimum number of the optional BooleanClauses which must be satisfied.
virtual QueryPtr rewrite(const IndexReaderPtr &reader)
Called to re-write queries into primitive queries. For example, a PrefixQuery will be rewritten into ...
Collection< BooleanClausePtr > clauses
Definition BooleanQuery.h:35
int32_t minNrShouldMatch
Definition BooleanQuery.h:37
virtual WeightPtr createWeight(const SearcherPtr &searcher)
Constructs an appropriate Weight implementation for this query. Only implemented by primitive queries...
virtual LuceneObjectPtr clone(const LuceneObjectPtr &other=LuceneObjectPtr())
Returns a clone of this query.
bool isCoordDisabled()
Returns true if Similarity#coord(int32_t, int32_t) is disabled in scoring for this query instance.
static void setMaxClauseCount(int32_t maxClauseCount)
Set the maximum number of clauses permitted per BooleanQuery. Default value is 1024.
BooleanQuery(bool disableCoord=false)
Constructs an empty boolean query.
Collection< BooleanClausePtr > getClauses()
Returns the set of clauses in this query.
void add(const BooleanClausePtr &clause)
Adds a clause to a boolean query.
static int32_t maxClauseCount
Definition BooleanQuery.h:33
virtual bool equals(const LuceneObjectPtr &other)
Return whether two objects are equal.
Utility template class to handle collections that can be safely copied and shared.
Definition Collection.h:17
collection_type::iterator iterator
Definition Collection.h:22
The abstract base class for queries.
Definition Query.h:31
Definition AbstractAllTermDocs.h:12
boost::shared_ptr< LuceneObject > LuceneObjectPtr
Definition LuceneTypes.h:539
boost::shared_ptr< Query > QueryPtr
Definition LuceneTypes.h:420
boost::shared_ptr< Searcher > SearcherPtr
Definition LuceneTypes.h:434
boost::shared_ptr< Similarity > SimilarityPtr
Definition LuceneTypes.h:435
boost::shared_ptr< BooleanClause > BooleanClausePtr
Definition LuceneTypes.h:278
boost::shared_ptr< IndexReader > IndexReaderPtr
Definition LuceneTypes.h:157
boost::shared_ptr< Weight > WeightPtr
Definition LuceneTypes.h:480

clucene.sourceforge.net