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


Scorer.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 SCORER_H
8 #define SCORER_H
9 
10 #include "DocIdSetIterator.h"
11 #include "BooleanClause.h"
12 #include "Weight.h"
13 
14 namespace Lucene {
15 
16 
17  class LPPAPI ScorerVisitor{
18  public:
19  virtual void visitOptional(QueryPtr parent,QueryPtr child,ScorerPtr scorer)=0;
20  virtual void visitRequired(QueryPtr parent,QueryPtr child,ScorerPtr scorer)=0;
21  virtual void visitProhibited(QueryPtr parent,QueryPtr child,ScorerPtr scorer)=0;
22 
23  };
24 
33 class LPPAPI Scorer : public DocIdSetIterator {
34 public:
37  Scorer(const SimilarityPtr& similarity);
38  Scorer(const WeightPtr& weight);
39  virtual ~Scorer();
40 
43 
44 protected:
46 
47 public:
50 
53  virtual void score(const CollectorPtr& collector);
54 
58  virtual double score() = 0;
59 
60  void visitSubScorers(QueryPtr parent, BooleanClause::Occur relationship,
61  ScorerVisitor *visitor);
62 
63  void visitScorers(ScorerVisitor *visitor);
64 
65  virtual float termFreq(){
66  boost::throw_exception(RuntimeException(L"Freq not implemented"));
67  }
68 
69 protected:
77  virtual bool score(const CollectorPtr& collector, int32_t max, int32_t firstDocID);
78 
79  friend class BooleanScorer;
81 };
82 
83 
84 }
85 
86 #endif
LUCENE_CLASS
#define LUCENE_CLASS(Name)
Definition: LuceneObject.h:24
Lucene::ScoreCachingWrappingScorer
A Scorer which wraps another scorer and caches the score of the current document. Successive calls to...
Definition: ScoreCachingWrappingScorer.h:22
Lucene::ScorerVisitor::visitProhibited
virtual void visitProhibited(QueryPtr parent, QueryPtr child, ScorerPtr scorer)=0
Lucene::QueryPtr
boost::shared_ptr< Query > QueryPtr
Definition: LuceneTypes.h:420
Lucene::Scorer::visitSubScorers
void visitSubScorers(QueryPtr parent, BooleanClause::Occur relationship, ScorerVisitor *visitor)
Lucene::Scorer::score
virtual void score(const CollectorPtr &collector)
Scores and collects all matching documents.
Lucene::BooleanScorer
BooleanScorer uses a ~16k array to score windows of docs. So it scores docs 0-16k first,...
Definition: BooleanScorer.h:30
Lucene::Scorer::termFreq
virtual float termFreq()
Definition: Scorer.h:65
BooleanClause.h
Lucene::Scorer::score
virtual double score()=0
Returns the score of the current document matching the query. Initially invalid, until {} or #advanc...
Lucene
Definition: AbstractAllTermDocs.h:12
Lucene::WeightPtr
boost::shared_ptr< Weight > WeightPtr
Definition: LuceneTypes.h:480
Lucene::Scorer::Scorer
Scorer(const SimilarityPtr &similarity)
Constructs a Scorer.
Lucene::RuntimeException
ExceptionTemplate< LuceneException, LuceneException::Runtime > RuntimeException
Definition: LuceneException.h:73
Lucene::Scorer::score
virtual bool score(const CollectorPtr &collector, int32_t max, int32_t firstDocID)
Collects matching documents in a range. Hook for optimization. Note, firstDocID is added to ensure th...
Lucene::Scorer
Common scoring functionality for different types of queries.
Definition: Scorer.h:33
Lucene::ScorerVisitor
Definition: Scorer.h:17
Lucene::CollectorPtr
boost::shared_ptr< Collector > CollectorPtr
Definition: LuceneTypes.h:295
Lucene::ScorerPtr
boost::shared_ptr< Scorer > ScorerPtr
Definition: LuceneTypes.h:429
Lucene::ScorerVisitor::visitOptional
virtual void visitOptional(QueryPtr parent, QueryPtr child, ScorerPtr scorer)=0
Lucene::Scorer::similarity
SimilarityPtr similarity
Definition: Scorer.h:45
Lucene::Scorer::Scorer
Scorer(const WeightPtr &weight)
Lucene::Scorer::visitScorers
void visitScorers(ScorerVisitor *visitor)
Lucene::Scorer::~Scorer
virtual ~Scorer()
Lucene::DocIdSetIterator
This abstract class defines methods to iterate over a set of non-decreasing doc ids....
Definition: DocIdSetIterator.h:17
DocIdSetIterator.h
Weight.h
Lucene::SimilarityPtr
boost::shared_ptr< Similarity > SimilarityPtr
Definition: LuceneTypes.h:435
Lucene::Scorer::weight
WeightPtr weight
Definition: Scorer.h:41
Lucene::Scorer::getSimilarity
SimilarityPtr getSimilarity()
Returns the Similarity implementation used by this scorer.
Lucene::BooleanClause::Occur
Occur
Specifies how clauses are to occur in matching documents.
Definition: BooleanClause.h:18
Lucene::ScorerVisitor::visitRequired
virtual void visitRequired(QueryPtr parent, QueryPtr child, ScorerPtr scorer)=0

clucene.sourceforge.net