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


 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Similarity.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 SIMILARITY_H
8 #define SIMILARITY_H
9 
10 #include "Explanation.h"
11 
12 namespace Lucene {
13 
427 class LPPAPI Similarity : public LuceneObject {
428 public:
429  Similarity();
430  virtual ~Similarity();
431 
433 
434 protected:
435  static const int32_t NO_DOC_ID_PROVIDED;
436 
437 protected:
438  static const Collection<double> NORM_TABLE();
439 
440 public:
445  static SimilarityPtr getDefault();
446 
449  static double decodeNorm(uint8_t b);
450 
453  static const Collection<double> getNormDecoder();
454 
467  virtual double computeNorm(const String& fieldName, const FieldInvertStatePtr& state);
468 
484  virtual double lengthNorm(const String& fieldName, int32_t numTokens) = 0;
485 
497  virtual double queryNorm(double sumOfSquaredWeights) = 0;
498 
508  static uint8_t encodeNorm(double f);
509 
521  virtual double tf(int32_t freq);
522 
533  virtual double sloppyFreq(int32_t distance) = 0;
534 
544  virtual double tf(double freq) = 0;
545 
561  virtual IDFExplanationPtr idfExplain(const TermPtr& term, const SearcherPtr& searcher);
562 
571  virtual IDFExplanationPtr idfExplain(Collection<TermPtr> terms, const SearcherPtr& searcher);
572 
583  virtual double idf(int32_t docFreq, int32_t numDocs) = 0;
584 
595  virtual double coord(int32_t overlap, int32_t maxOverlap) = 0;
596 
611  virtual double scorePayload(int32_t docId, const String& fieldName, int32_t start, int32_t end, ByteArray payload, int32_t offset, int32_t length);
612 };
613 
614 }
615 
616 #endif
boost::shared_ptr< IDFExplanation > IDFExplanationPtr
Definition: LuceneTypes.h:372
boost::shared_ptr< Term > TermPtr
Definition: LuceneTypes.h:233
boost::shared_ptr< Searcher > SearcherPtr
Definition: LuceneTypes.h:434
Scoring API.
Definition: Similarity.h:427
boost::shared_ptr< FieldInvertState > FieldInvertStatePtr
Definition: LuceneTypes.h:128
Base class for all Lucene classes.
Definition: LuceneObject.h:31
#define LUCENE_CLASS(Name)
Definition: LuceneObject.h:24
Definition: AbstractAllTermDocs.h:12
boost::shared_ptr< Similarity > SimilarityPtr
Definition: LuceneTypes.h:435

clucene.sourceforge.net