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


Explanation.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 EXPLANATION_H
8 #define EXPLANATION_H
9 
10 #include "LuceneObject.h"
11 
12 namespace Lucene {
13 
15 class LPPAPI Explanation : public LuceneObject {
16 public:
17  Explanation(double value = 0, const String& description = EmptyString);
18  virtual ~Explanation();
19 
21 
22 protected:
23  double value; // the value of this node
24  String description; // what it represents
25  Collection<ExplanationPtr> details; // sub-explanations
26 
27 public:
33  virtual bool isMatch();
34 
36  virtual double getValue();
37 
39  virtual void setValue(double value);
40 
42  virtual String getDescription();
43 
45  virtual void setDescription(const String& description);
46 
49 
51  virtual void addDetail(const ExplanationPtr& detail);
52 
54  virtual String toString();
55 
57  virtual String toHtml();
58 
59 protected:
62  virtual String getSummary();
63 
64  virtual String toString(int32_t depth);
65 };
66 
70 class LPPAPI IDFExplanation : public LuceneObject {
71 public:
72  virtual ~IDFExplanation();
74 
75 public:
77  virtual double getIdf() = 0;
78 
81  virtual String explain() = 0;
82 };
83 
84 }
85 
86 #endif
#define LUCENE_CLASS(Name)
Definition: LuceneObject.h:24
Describes the score computation for document and query.
Definition: Explanation.h:15
virtual void setValue(double value)
Sets the value assigned to this explanation node.
virtual String toString(int32_t depth)
virtual bool isMatch()
Indicates whether or not this Explanation models a good match.
virtual void addDetail(const ExplanationPtr &detail)
Adds a sub-node to this explanation node.
Collection< ExplanationPtr > details
Definition: Explanation.h:25
virtual String toHtml()
Render an explanation as HTML.
virtual Collection< ExplanationPtr > getDetails()
The sub-nodes of this explanation node.
virtual void setDescription(const String &description)
Sets the description of this explanation node.
virtual String getSummary()
A short one line summary which should contain all high level information about this Explanation,...
Explanation(double value=0, const String &description=EmptyString)
virtual ~Explanation()
String description
Definition: Explanation.h:24
virtual String toString()
Render an explanation as text.
virtual double getValue()
The value assigned to this explanation node.
virtual String getDescription()
A description of this explanation node.
double value
Definition: Explanation.h:20
Small Util class used to pass both an idf factor as well as an explanation for that factor.
Definition: Explanation.h:70
virtual double getIdf()=0
virtual String explain()=0
This should be calculated lazily if possible.
Base class for all Lucene classes.
Definition: LuceneObject.h:31
Definition: AbstractAllTermDocs.h:12
boost::shared_ptr< Explanation > ExplanationPtr
Definition: LuceneTypes.h:333

clucene.sourceforge.net