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-2011 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  {
429  public:
430  Similarity();
431  virtual ~Similarity();
432 
434 
435  protected:
436  static const int32_t NO_DOC_ID_PROVIDED;
437 
438  protected:
439  static const Collection<double> NORM_TABLE();
440 
441  public:
446  static SimilarityPtr getDefault();
447 
450  static double decodeNorm(uint8_t b);
451 
454  static const Collection<double> getNormDecoder();
455 
468  virtual double computeNorm(const String& fieldName, FieldInvertStatePtr state);
469 
485  virtual double lengthNorm(const String& fieldName, int32_t numTokens) = 0;
486 
498  virtual double queryNorm(double sumOfSquaredWeights) = 0;
499 
509  static uint8_t encodeNorm(double f);
510 
522  virtual double tf(int32_t freq);
523 
534  virtual double sloppyFreq(int32_t distance) = 0;
535 
545  virtual double tf(double freq) = 0;
546 
562  virtual IDFExplanationPtr idfExplain(TermPtr term, SearcherPtr searcher);
563 
572  virtual IDFExplanationPtr idfExplain(Collection<TermPtr> terms, SearcherPtr searcher);
573 
584  virtual double idf(int32_t docFreq, int32_t numDocs) = 0;
585 
596  virtual double coord(int32_t overlap, int32_t maxOverlap) = 0;
597 
612  virtual double scorePayload(int32_t docId, const String& fieldName, int32_t start, int32_t end, ByteArray payload, int32_t offset, int32_t length);
613  };
614 }
615 
616 #endif

clucene.sourceforge.net