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

DefaultSimilarity.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 DEFAULTSIMILARITY_H
8 #define DEFAULTSIMILARITY_H
9
10 #include "Similarity.h"
11
12 namespace Lucene {
13
15 class LPPAPI DefaultSimilarity : public Similarity {
16 public:
17 DefaultSimilarity();
18 virtual ~DefaultSimilarity();
19
20 LUCENE_CLASS(DefaultSimilarity);
21
22 protected:
23 bool discountOverlaps; // Default false
24
25 public:
29 virtual double computeNorm(const String& fieldName, const FieldInvertStatePtr& state);
30
32 virtual double lengthNorm(const String& fieldName, int32_t numTokens);
33
35 virtual double queryNorm(double sumOfSquaredWeights);
36
38 virtual double tf(double freq);
39
41 virtual double sloppyFreq(int32_t distance);
42
44 virtual double idf(int32_t docFreq, int32_t numDocs);
45
47 virtual double coord(int32_t overlap, int32_t maxOverlap);
48
52 void setDiscountOverlaps(bool v);
53
55 bool getDiscountOverlaps();
56 };
57
58 }
59
60 #endif
LUCENE_CLASS
#define LUCENE_CLASS(Name)
Definition: LuceneObject.h:24
Similarity.h
Lucene::DefaultSimilarity
Default scoring implementation.
Definition: DefaultSimilarity.h:15
Lucene::DefaultSimilarity::computeNorm
virtual double computeNorm(const String &fieldName, const FieldInvertStatePtr &state)
Implemented as state->getBoost() * lengthNorm(numTerms), where numTerms is {} if #setDiscountOverlap...
Lucene::DefaultSimilarity::setDiscountOverlaps
void setDiscountOverlaps(bool v)
Determines whether overlap tokens (Tokens with 0 position increment) are ignored when computing norm....
Lucene::DefaultSimilarity::tf
virtual double tf(double freq)
Implemented as sqrt(freq).
Lucene::DefaultSimilarity::getDiscountOverlaps
bool getDiscountOverlaps()
Lucene::DefaultSimilarity::lengthNorm
virtual double lengthNorm(const String &fieldName, int32_t numTokens)
Implemented as 1 / sqrt(numTerms).
Lucene::DefaultSimilarity::DefaultSimilarity
DefaultSimilarity()
Lucene::DefaultSimilarity::idf
virtual double idf(int32_t docFreq, int32_t numDocs)
Implemented as log(numDocs / (docFreq + 1)) + 1.
Lucene::DefaultSimilarity::sloppyFreq
virtual double sloppyFreq(int32_t distance)
Implemented as 1 / (distance + 1).
Lucene::DefaultSimilarity::discountOverlaps
bool discountOverlaps
Definition: DefaultSimilarity.h:20
Lucene::DefaultSimilarity::coord
virtual double coord(int32_t overlap, int32_t maxOverlap)
Implemented as overlap / maxOverlap.
Lucene::DefaultSimilarity::queryNorm
virtual double queryNorm(double sumOfSquaredWeights)
Implemented as 1 / sqrt(sumOfSquaredWeights).
Lucene::DefaultSimilarity::~DefaultSimilarity
virtual ~DefaultSimilarity()
Lucene::Similarity
Scoring API.
Definition: Similarity.h:427
Lucene
Definition: AbstractAllTermDocs.h:12
Lucene::FieldInvertStatePtr
boost::shared_ptr< FieldInvertState > FieldInvertStatePtr
Definition: LuceneTypes.h:128

clucene.sourceforge.net