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

Loading...
Searching...
No Matches
Scorer.h
Go to the documentation of this file.
1
2// 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
41 LUCENE_CLASS(Scorer);
42 WeightPtr weight;
43
44 protected:
45 SimilarityPtr similarity;
46
47 public:
49 SimilarityPtr getSimilarity();
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;
80 friend class ScoreCachingWrappingScorer;
81};
82
83
84}
85
86#endif
BooleanClause.h
DocIdSetIterator.h
LUCENE_CLASS
#define LUCENE_CLASS(Name)
Definition LuceneObject.h:24
Weight.h
Lucene::BooleanClause::Occur
Occur
Specifies how clauses are to occur in matching documents.
Definition BooleanClause.h:18
Lucene::DocIdSetIterator
This abstract class defines methods to iterate over a set of non-decreasing doc ids....
Definition DocIdSetIterator.h:17
Lucene::ScorerVisitor
Definition Scorer.h:17
Lucene::ScorerVisitor::visitProhibited
virtual void visitProhibited(QueryPtr parent, QueryPtr child, ScorerPtr scorer)=0
Lucene::ScorerVisitor::visitOptional
virtual void visitOptional(QueryPtr parent, QueryPtr child, ScorerPtr scorer)=0
Lucene::ScorerVisitor::visitRequired
virtual void visitRequired(QueryPtr parent, QueryPtr child, ScorerPtr scorer)=0
Lucene::Scorer::score
virtual void score(const CollectorPtr &collector)
Scores and collects all matching documents.
Lucene::Scorer::visitSubScorers
void visitSubScorers(QueryPtr parent, BooleanClause::Occur relationship, ScorerVisitor *visitor)
Lucene::Scorer::Scorer
Scorer(const WeightPtr &weight)
Lucene::Scorer::~Scorer
virtual ~Scorer()
Lucene::Scorer::similarity
SimilarityPtr similarity
Definition Scorer.h:45
Lucene::Scorer::score
virtual double score()=0
Returns the score of the current document matching the query. Initially invalid, until nextDoc() or a...
Lucene::Scorer::visitScorers
void visitScorers(ScorerVisitor *visitor)
Lucene::Scorer::BooleanScorer
friend class BooleanScorer
Definition Scorer.h:79
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::Scorer
Scorer(const SimilarityPtr &similarity)
Constructs a Scorer.
Lucene::Scorer::weight
WeightPtr weight
Definition Scorer.h:42
Lucene::Scorer::termFreq
virtual float termFreq()
Definition Scorer.h:65
Lucene::Scorer::ScoreCachingWrappingScorer
friend class ScoreCachingWrappingScorer
Definition Scorer.h:80
Lucene::Scorer::getSimilarity
SimilarityPtr getSimilarity()
Returns the Similarity implementation used by this scorer.
Lucene
Definition AbstractAllTermDocs.h:12
Lucene::QueryPtr
boost::shared_ptr< Query > QueryPtr
Definition LuceneTypes.h:420
Lucene::WeightPtr
boost::shared_ptr< Weight > WeightPtr
Definition LuceneTypes.h:480
Lucene::SimilarityPtr
boost::shared_ptr< Similarity > SimilarityPtr
Definition LuceneTypes.h:435
Lucene::RuntimeException
ExceptionTemplate< LuceneException, LuceneException::Runtime > RuntimeException
Definition LuceneException.h:73
Lucene::ScorerPtr
boost::shared_ptr< Scorer > ScorerPtr
Definition LuceneTypes.h:429
Lucene::CollectorPtr
boost::shared_ptr< Collector > CollectorPtr
Definition LuceneTypes.h:295

clucene.sourceforge.net