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


Loading...
Searching...
No Matches
MultiTermQuery.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 MULTITERMQUERY_H
8#define MULTITERMQUERY_H
9
10#include "Query.h"
11
12namespace Lucene {
13
120
122class LPPAPI RewriteMethod : public LuceneObject {
123public:
124 virtual ~RewriteMethod();
126
127public:
128 virtual QueryPtr rewrite(const IndexReaderPtr& reader, const MultiTermQueryPtr& query) = 0;
129};
130
136public:
139
141
142public:
143 // Defaults derived from rough tests with a 20.0 million doc Wikipedia index. With more than 350 terms
144 // in the query, the filter method is fastest
145 static const int32_t DEFAULT_TERM_COUNT_CUTOFF;
146
147 // If the query will hit more than 1 in 1000 of the docs in the index (0.1%), the filter method is fastest
148 static const double DEFAULT_DOC_COUNT_PERCENT;
149
150protected:
153
154public:
157 virtual void setTermCountCutoff(int32_t count);
158
160 virtual int32_t getTermCountCutoff();
161
165 virtual void setDocCountPercent(double percent);
166
168 virtual double getDocCountPercent();
169
170 virtual QueryPtr rewrite(const IndexReaderPtr& reader, const MultiTermQueryPtr& query);
171
172 virtual int32_t hashCode();
173 virtual bool equals(const LuceneObjectPtr& other);
174};
175
176}
177
178#endif
#define LUCENE_CLASS(Name)
Definition LuceneObject.h:24
static const int32_t DEFAULT_TERM_COUNT_CUTOFF
Definition MultiTermQuery.h:145
virtual double getDocCountPercent()
double docCountPercent
Definition MultiTermQuery.h:152
int32_t termCountCutoff
Definition MultiTermQuery.h:151
virtual bool equals(const LuceneObjectPtr &other)
Return whether two objects are equal.
virtual void setTermCountCutoff(int32_t count)
If the number of terms in this query is equal to or larger than this setting then CONSTANT_SCORE_FILT...
virtual QueryPtr rewrite(const IndexReaderPtr &reader, const MultiTermQueryPtr &query)
virtual void setDocCountPercent(double percent)
If the number of documents to be visited in the postings exceeds this specified percentage of the max...
static const double DEFAULT_DOC_COUNT_PERCENT
Definition MultiTermQuery.h:148
virtual int32_t hashCode()
Return hash code for this object.
virtual int32_t getTermCountCutoff()
void clearTotalNumberOfTerms()
Resets the counting of unique terms. Do this before executing the query/filter.
static RewriteMethodPtr CONSTANT_SCORE_AUTO_REWRITE_DEFAULT()
Read-only default instance of ConstantScoreAutoRewrite, with ConstantScoreAutoRewrite#setTermCountCut...
RewriteMethodPtr rewriteMethod
Definition MultiTermQuery.h:39
virtual int32_t hashCode()
Return hash code for this object.
friend class ScoringBooleanQueryRewrite
Definition MultiTermQuery.h:117
int32_t numberOfTerms
Definition MultiTermQuery.h:40
static RewriteMethodPtr CONSTANT_SCORE_FILTER_REWRITE()
A rewrite method that first creates a private Filter, by visiting each term in sequence and marking a...
virtual QueryPtr rewrite(const IndexReaderPtr &reader)
Called to re-write queries into primitive queries. For example, a PrefixQuery will be rewritten into ...
virtual LuceneObjectPtr clone(const LuceneObjectPtr &other=LuceneObjectPtr())
Returns a clone of this query.
virtual bool equals(const LuceneObjectPtr &other)
Return whether two objects are equal.
static RewriteMethodPtr SCORING_BOOLEAN_QUERY_REWRITE()
A rewrite method that first translates each term into BooleanClause.Occur#SHOULD clause in a BooleanQ...
int32_t getTotalNumberOfTerms()
Return the number of unique terms visited during execution of the query. If there are many of them,...
void incTotalNumberOfTerms(int32_t inc)
static RewriteMethodPtr CONSTANT_SCORE_BOOLEAN_QUERY_REWRITE()
Like SCORING_BOOLEAN_QUERY_REWRITE except scores are not computed. Instead, each matching document re...
friend class ConstantScoreAutoRewrite
Definition MultiTermQuery.h:118
virtual RewriteMethodPtr getRewriteMethod()
virtual FilteredTermEnumPtr getEnum(const IndexReaderPtr &reader)=0
Construct the enumeration to be used, expanding the pattern term.
friend class MultiTermQueryWrapperFilter
Definition MultiTermQuery.h:116
virtual void setRewriteMethod(const RewriteMethodPtr &method)
Sets the rewrite method to be used when executing the query. You can use one of the four core methods...
Abstract class that defines how the query is rewritten.
Definition MultiTermQuery.h:122
virtual QueryPtr rewrite(const IndexReaderPtr &reader, const MultiTermQueryPtr &query)=0
Definition AbstractAllTermDocs.h:12
boost::shared_ptr< Query > QueryPtr
Definition LuceneTypes.h:420
boost::shared_ptr< MultiTermQuery > MultiTermQueryPtr
Definition LuceneTypes.h:389
boost::shared_ptr< LuceneObject > LuceneObjectPtr
Definition LuceneTypes.h:539
boost::shared_ptr< RewriteMethod > RewriteMethodPtr
Definition LuceneTypes.h:425
boost::shared_ptr< FilteredTermEnum > FilteredTermEnumPtr
Definition LuceneTypes.h:365
boost::shared_ptr< IndexReader > IndexReaderPtr
Definition LuceneTypes.h:157

clucene.sourceforge.net