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


FuzzyQuery.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 FUZZYQUERY_H
8 #define FUZZYQUERY_H
9 
10 #include "MultiTermQuery.h"
11 
12 namespace Lucene {
13 
19 class LPPAPI FuzzyQuery : public MultiTermQuery {
20 public:
29  FuzzyQuery(const TermPtr& term, double minimumSimilarity, int32_t prefixLength);
30  FuzzyQuery(const TermPtr& term, double minimumSimilarity);
31  FuzzyQuery(const TermPtr& term);
32 
33  virtual ~FuzzyQuery();
34 
36 
37 protected:
39  int32_t prefixLength;
41 
43 
44 public:
45  static double defaultMinSimilarity();
46  static const int32_t defaultPrefixLength;
47 
48 public:
50 
53  double getMinSimilarity();
54 
57  int32_t getPrefixLength();
58 
61 
62  virtual void setRewriteMethod(const RewriteMethodPtr& method);
63  virtual QueryPtr rewrite(const IndexReaderPtr& reader);
64 
66  virtual String toString(const String& field);
67  virtual int32_t hashCode();
68  virtual bool equals(const LuceneObjectPtr& other);
69 
70 protected:
71  void ConstructQuery(const TermPtr& term, double minimumSimilarity, int32_t prefixLength);
72 
73  virtual FilteredTermEnumPtr getEnum(const IndexReaderPtr& reader);
74 };
75 
76 }
77 
78 #endif
Lucene::FuzzyQuery::toString
virtual String toString(const String &field)
Prints a query to a string, with field assumed to be the default field and omitted.
Lucene::FuzzyQuery::term
TermPtr term
Definition: FuzzyQuery.h:42
LUCENE_CLASS
#define LUCENE_CLASS(Name)
Definition: LuceneObject.h:24
Lucene::TermPtr
boost::shared_ptr< Term > TermPtr
Definition: LuceneTypes.h:233
Lucene::LuceneObjectPtr
boost::shared_ptr< LuceneObject > LuceneObjectPtr
Definition: LuceneTypes.h:539
Lucene::QueryPtr
boost::shared_ptr< Query > QueryPtr
Definition: LuceneTypes.h:420
Lucene::FuzzyQuery::~FuzzyQuery
virtual ~FuzzyQuery()
Lucene::FuzzyQuery::FuzzyQuery
FuzzyQuery(const TermPtr &term)
Lucene::FuzzyQuery::minimumSimilarity
double minimumSimilarity
Definition: FuzzyQuery.h:35
Lucene::FuzzyQuery::getEnum
virtual FilteredTermEnumPtr getEnum(const IndexReaderPtr &reader)
Construct the enumeration to be used, expanding the pattern term.
Lucene::FuzzyQuery::FuzzyQuery
FuzzyQuery(const TermPtr &term, double minimumSimilarity)
Lucene
Definition: AbstractAllTermDocs.h:12
Lucene::FuzzyQuery
Implements the fuzzy search query. The similarity measurement is based on the Levenshtein (edit dista...
Definition: FuzzyQuery.h:19
Lucene::FuzzyQuery::rewrite
virtual QueryPtr rewrite(const IndexReaderPtr &reader)
Called to re-write queries into primitive queries. For example, a PrefixQuery will be rewritten into ...
Lucene::FuzzyQuery::FuzzyQuery
FuzzyQuery(const TermPtr &term, double minimumSimilarity, int32_t prefixLength)
Create a new FuzzyQuery that will match terms with a similarity of at least minimumSimilarity to term...
Lucene::RewriteMethodPtr
boost::shared_ptr< RewriteMethod > RewriteMethodPtr
Definition: LuceneTypes.h:425
Lucene::FuzzyQuery::prefixLength
int32_t prefixLength
Definition: FuzzyQuery.h:39
Lucene::IndexReaderPtr
boost::shared_ptr< IndexReader > IndexReaderPtr
Definition: LuceneTypes.h:157
Lucene::FuzzyQuery::clone
virtual LuceneObjectPtr clone(const LuceneObjectPtr &other=LuceneObjectPtr())
Returns a clone of this query.
Lucene::FuzzyQuery::termLongEnough
bool termLongEnough
Definition: FuzzyQuery.h:40
Lucene::FuzzyQuery::ConstructQuery
void ConstructQuery(const TermPtr &term, double minimumSimilarity, int32_t prefixLength)
Lucene::FuzzyQuery::hashCode
virtual int32_t hashCode()
Return hash code for this object.
Lucene::FuzzyQuery::setRewriteMethod
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...
Lucene::FuzzyQuery::defaultMinSimilarity
static double defaultMinSimilarity()
Lucene::FuzzyQuery::getPrefixLength
int32_t getPrefixLength()
Returns the non-fuzzy prefix length. This is the number of characters at the start of a term that mus...
Lucene::FuzzyQuery::defaultPrefixLength
static const int32_t defaultPrefixLength
Definition: FuzzyQuery.h:46
Lucene::FuzzyQuery::getMinSimilarity
double getMinSimilarity()
Returns the minimum similarity that is required for this query to match.
Lucene::MultiTermQuery
An abstract Query that matches documents containing a subset of terms provided by a {} enumeration.
Definition: MultiTermQuery.h:31
Lucene::Query::toString
virtual String toString()
Prints a query to a string.
Lucene::FuzzyQuery::getTerm
TermPtr getTerm()
Returns the pattern term.
Lucene::FuzzyQuery::equals
virtual bool equals(const LuceneObjectPtr &other)
Return whether two objects are equal.
MultiTermQuery.h
Lucene::FilteredTermEnumPtr
boost::shared_ptr< FilteredTermEnum > FilteredTermEnumPtr
Definition: LuceneTypes.h:365

clucene.sourceforge.net