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
20 LUCENE_CLASS(Explanation);
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
48 virtual Collection<ExplanationPtr> getDetails();
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();
73 LUCENE_CLASS(IDFExplanation);
74
75 public:
77 virtual double getIdf() = 0;
78
81 virtual String explain() = 0;
82 };
83
84 }
85
86 #endif
LuceneObject.h
LUCENE_CLASS
#define LUCENE_CLASS(Name)
Definition: LuceneObject.h:24
Lucene::Collection< ExplanationPtr >
Lucene::Explanation
Describes the score computation for document and query.
Definition: Explanation.h:15
Lucene::Explanation::setValue
virtual void setValue(double value)
Sets the value assigned to this explanation node.
Lucene::Explanation::toString
virtual String toString(int32_t depth)
Lucene::Explanation::isMatch
virtual bool isMatch()
Indicates whether or not this Explanation models a good match.
Lucene::Explanation::addDetail
virtual void addDetail(const ExplanationPtr &detail)
Adds a sub-node to this explanation node.
Lucene::Explanation::details
Collection< ExplanationPtr > details
Definition: Explanation.h:25
Lucene::Explanation::toHtml
virtual String toHtml()
Render an explanation as HTML.
Lucene::Explanation::getDetails
virtual Collection< ExplanationPtr > getDetails()
The sub-nodes of this explanation node.
Lucene::Explanation::setDescription
virtual void setDescription(const String &description)
Sets the description of this explanation node.
Lucene::Explanation::getSummary
virtual String getSummary()
A short one line summary which should contain all high level information about this Explanation,...
Lucene::Explanation::Explanation
Explanation(double value=0, const String &description=EmptyString)
Lucene::Explanation::~Explanation
virtual ~Explanation()
Lucene::Explanation::description
String description
Definition: Explanation.h:24
Lucene::Explanation::toString
virtual String toString()
Render an explanation as text.
Lucene::Explanation::getValue
virtual double getValue()
The value assigned to this explanation node.
Lucene::Explanation::getDescription
virtual String getDescription()
A description of this explanation node.
Lucene::Explanation::value
double value
Definition: Explanation.h:20
Lucene::IDFExplanation
Small Util class used to pass both an idf factor as well as an explanation for that factor.
Definition: Explanation.h:70
Lucene::IDFExplanation::~IDFExplanation
virtual ~IDFExplanation()
Lucene::IDFExplanation::getIdf
virtual double getIdf()=0
Lucene::IDFExplanation::explain
virtual String explain()=0
This should be calculated lazily if possible.
Lucene::LuceneObject
Base class for all Lucene classes.
Definition: LuceneObject.h:31
Lucene
Definition: AbstractAllTermDocs.h:12
Lucene::ExplanationPtr
boost::shared_ptr< Explanation > ExplanationPtr
Definition: LuceneTypes.h:333

clucene.sourceforge.net