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


SimilarityDelegator.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 SIMILARITYDELEGATOR_H
8 #define SIMILARITYDELEGATOR_H
9 
10 #include "Similarity.h"
11 
12 namespace Lucene {
13 
16 class LPPAPI SimilarityDelegator : public Similarity {
17 public:
20 
22 
23 protected:
25 
26 public:
27  virtual double computeNorm(const String& field, const FieldInvertStatePtr& state);
28  virtual double lengthNorm(const String& fieldName, int32_t numTokens);
29  virtual double queryNorm(double sumOfSquaredWeights);
30  virtual double tf(double freq);
31  virtual double sloppyFreq(int32_t distance);
32  virtual double idf(int32_t docFreq, int32_t numDocs);
33  virtual double coord(int32_t overlap, int32_t maxOverlap);
34  virtual double scorePayload(int32_t docId, const String& fieldName, int32_t start, int32_t end, ByteArray payload, int32_t offset, int32_t length);
35 };
36 
37 }
38 
39 #endif
#define LUCENE_CLASS(Name)
Definition: LuceneObject.h:24
Delegating scoring implementation. Useful in Query#getSimilarity(Searcher) implementations,...
Definition: SimilarityDelegator.h:16
virtual double idf(int32_t docFreq, int32_t numDocs)
Computes a score factor based on a term's document frequency (the number of documents which contain t...
virtual double computeNorm(const String &field, const FieldInvertStatePtr &state)
Compute the normalization value for a field, given the accumulated state of term processing for this ...
virtual double coord(int32_t overlap, int32_t maxOverlap)
Computes a score factor based on the fraction of all query terms that a document contains....
virtual double queryNorm(double sumOfSquaredWeights)
Computes the normalization value for a query given the sum of the squared weights of each of the quer...
virtual double scorePayload(int32_t docId, const String &fieldName, int32_t start, int32_t end, ByteArray payload, int32_t offset, int32_t length)
Calculate a scoring factor based on the data in the payload. Overriding implementations are responsib...
SimilarityDelegator(const SimilarityPtr &delegee)
virtual double lengthNorm(const String &fieldName, int32_t numTokens)
Computes the normalization value for a field given the total number of terms contained in a field....
virtual double tf(double freq)
Computes a score factor based on a term or phrase's frequency in a document. This value is multiplied...
virtual double sloppyFreq(int32_t distance)
Computes the amount of a sloppy phrase match, based on an edit distance. This value is summed for eac...
SimilarityPtr delegee
Definition: SimilarityDelegator.h:21
Scoring API.
Definition: Similarity.h:427
Definition: AbstractAllTermDocs.h:12
boost::shared_ptr< FieldInvertState > FieldInvertStatePtr
Definition: LuceneTypes.h:128
boost::shared_ptr< Similarity > SimilarityPtr
Definition: LuceneTypes.h:435

clucene.sourceforge.net