Lucene++ - a full-featured, c++ search engine
API Documentation
include
FuzzyTermEnum.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 FUZZYTERMENUM_H
8
#define FUZZYTERMENUM_H
9
10
#include "
FilteredTermEnum.h
"
11
12
namespace
Lucene
{
13
18
class
LPPAPI
FuzzyTermEnum
:
public
FilteredTermEnum
{
19
public
:
29
FuzzyTermEnum
(
const
IndexReaderPtr
& reader,
const
TermPtr
& term,
double
minSimilarity, int32_t prefixLength);
30
FuzzyTermEnum
(
const
IndexReaderPtr
& reader,
const
TermPtr
& term,
double
minSimilarity);
31
FuzzyTermEnum
(
const
IndexReaderPtr
& reader,
const
TermPtr
& term);
32
33
virtual
~FuzzyTermEnum
();
34
35
LUCENE_CLASS
(
FuzzyTermEnum
);
36
37
protected
:
39
Collection<int32_t>
p
;
40
Collection<int32_t>
d
;
41
42
double
_similarity
;
43
bool
_endEnum
;
44
45
TermPtr
searchTerm
;
46
String
field
;
47
String
text
;
48
String
prefix
;
49
50
double
minimumSimilarity
;
51
double
scale_factor
;
52
53
public
:
54
virtual
double
difference
();
55
virtual
bool
endEnum
();
56
virtual
void
close
();
57
58
protected
:
59
void
ConstructTermEnum
(
const
IndexReaderPtr
& reader,
const
TermPtr
& term,
double
minSimilarity, int32_t prefixLength);
60
63
virtual
bool
termCompare
(
const
TermPtr
& term);
64
105
double
similarity
(
const
String& target);
106
111
int32_t
calculateMaxDistance
(int32_t m);
112
};
113
114
}
115
116
#endif
Lucene::FuzzyTermEnum::termCompare
virtual bool termCompare(const TermPtr &term)
The termCompare method in FuzzyTermEnum uses Levenshtein distance to calculate the distance between t...
Lucene::FuzzyTermEnum::similarity
double similarity(const String &target)
Compute Levenshtein distance.
Lucene::FuzzyTermEnum::field
String field
Definition:
FuzzyTermEnum.h:46
LUCENE_CLASS
#define LUCENE_CLASS(Name)
Definition:
LuceneObject.h:24
Lucene::TermPtr
boost::shared_ptr< Term > TermPtr
Definition:
LuceneTypes.h:233
Lucene::Collection< int32_t >
Lucene::FilteredTermEnum
Abstract class for enumerating a subset of all terms.
Definition:
FilteredTermEnum.h:18
Lucene::FuzzyTermEnum::FuzzyTermEnum
FuzzyTermEnum(const IndexReaderPtr &reader, const TermPtr &term, double minSimilarity, int32_t prefixLength)
Constructor for enumeration of all terms from specified reader which share a prefix of length prefixL...
Lucene::FuzzyTermEnum::prefix
String prefix
Definition:
FuzzyTermEnum.h:48
Lucene::FuzzyTermEnum::~FuzzyTermEnum
virtual ~FuzzyTermEnum()
Lucene::FuzzyTermEnum::FuzzyTermEnum
FuzzyTermEnum(const IndexReaderPtr &reader, const TermPtr &term)
Lucene::FuzzyTermEnum::text
String text
Definition:
FuzzyTermEnum.h:47
Lucene::FuzzyTermEnum::difference
virtual double difference()
Equality measure on the term.
Lucene::FuzzyTermEnum::_endEnum
bool _endEnum
Definition:
FuzzyTermEnum.h:43
Lucene
Definition:
AbstractAllTermDocs.h:12
Lucene::FuzzyTermEnum::ConstructTermEnum
void ConstructTermEnum(const IndexReaderPtr &reader, const TermPtr &term, double minSimilarity, int32_t prefixLength)
FilteredTermEnum.h
Lucene::IndexReaderPtr
boost::shared_ptr< IndexReader > IndexReaderPtr
Definition:
LuceneTypes.h:157
Lucene::FuzzyTermEnum::d
Collection< int32_t > d
Definition:
FuzzyTermEnum.h:40
Lucene::FuzzyTermEnum::searchTerm
TermPtr searchTerm
Definition:
FuzzyTermEnum.h:45
Lucene::FuzzyTermEnum::calculateMaxDistance
int32_t calculateMaxDistance(int32_t m)
The max Distance is the maximum Levenshtein distance for the text compared to some other value that r...
Lucene::FuzzyTermEnum::minimumSimilarity
double minimumSimilarity
Definition:
FuzzyTermEnum.h:50
Lucene::FuzzyTermEnum::_similarity
double _similarity
Definition:
FuzzyTermEnum.h:42
Lucene::FuzzyTermEnum
Subclass of FilteredTermEnum for enumerating all terms that are similar to the specified filter term.
Definition:
FuzzyTermEnum.h:18
Lucene::FuzzyTermEnum::endEnum
virtual bool endEnum()
Indicates the end of the enumeration has been reached.
Lucene::FuzzyTermEnum::scale_factor
double scale_factor
Definition:
FuzzyTermEnum.h:51
Lucene::FuzzyTermEnum::FuzzyTermEnum
FuzzyTermEnum(const IndexReaderPtr &reader, const TermPtr &term, double minSimilarity)
Lucene::FuzzyTermEnum::close
virtual void close()
Closes the enumeration to further activity, freeing resources.
Lucene::FuzzyTermEnum::p
Collection< int32_t > p
Allows us save time required to create a new array every time similarity is called.
Definition:
FuzzyTermEnum.h:35
clucene.sourceforge.net