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


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

clucene.sourceforge.net