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


BooleanScorer2.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 BOOLEANSCORER2_H
8#define BOOLEANSCORER2_H
9
11#include "ConjunctionScorer.h"
12
13namespace Lucene {
14
20class BooleanScorer2 : public Scorer {
21public:
34
35 virtual ~BooleanScorer2();
36
38
39protected:
43
45
48
50 int32_t doc;
51
52public:
53 virtual void initialize();
54
57 virtual void score(const CollectorPtr& collector);
58
59 virtual bool score(const CollectorPtr& collector, int32_t max, int32_t firstDocID);
60 virtual int32_t docID();
61 virtual int32_t nextDoc();
62 virtual double score();
63 virtual int32_t advance(int32_t target);
64
65protected:
69
75
79 ScorerPtr addProhibitedScorers(const ScorerPtr& requiredCountingSumScorer);
80
83};
84
85class Coordinator : public LuceneObject {
86public:
88 virtual ~Coordinator();
89
91
92public:
95 int32_t maxCoord; // to be increased for each non prohibited scorer
96 int32_t nrMatchers; // to be increased by score() of match counting scorers.
97
98public:
99 void init(); // use after all scorers have been added.
100
101 friend class BooleanScorer2;
102};
103
105class SingleMatchScorer : public Scorer {
106public:
109
111
112protected:
117
118public:
119 virtual double score();
120 virtual int32_t docID();
121 virtual int32_t nextDoc();
122 virtual int32_t advance(int32_t target);
123};
124
126public:
129
131
132protected:
135
136 // Save the score of lastScoredDoc, so that we don't compute it more than once in score().
138
139public:
140 virtual double score();
141
142 friend class BooleanScorer2;
143};
144
146public:
149
151
152protected:
156
157 // Save the score of lastScoredDoc, so that we don't compute it more than once in score().
159
160public:
161 virtual double score();
162};
163
164}
165
166#endif
#define LUCENE_CLASS(Name)
Definition: LuceneObject.h:24
See the description in BooleanScorer, comparing BooleanScorer & BooleanScorer2.
Definition: BooleanScorer2.h:20
virtual int32_t nextDoc()
Advances to the next document in the set and returns the doc it is currently on, or NO_MORE_DOCS if t...
ScorerPtr makeCountingSumScorer()
Returns the scorer to be used for match counting and score summing. Uses requiredScorers,...
ScorerPtr addProhibitedScorers(const ScorerPtr &requiredCountingSumScorer)
Returns the scorer to be used for match counting and score summing. Uses the given required scorer an...
int32_t doc
Definition: BooleanScorer2.h:50
virtual double score()
Returns the score of the current document matching the query. Initially invalid, until nextDoc() or a...
CoordinatorPtr coordinator
Definition: BooleanScorer2.h:44
ScorerPtr countingSumScorer
The scorer to which all scoring will be delegated, except for computing and using the coordination fa...
Definition: BooleanScorer2.h:47
ScorerPtr dualConjunctionSumScorer(const ScorerPtr &req1, const ScorerPtr &req2)
Collection< ScorerPtr > prohibitedScorers
Definition: BooleanScorer2.h:42
ScorerPtr countingDisjunctionSumScorer(Collection< ScorerPtr > scorers, int32_t minNrShouldMatch)
virtual int32_t docID()
Returns the following:
virtual void score(const CollectorPtr &collector)
Scores and collects all matching documents.
ScorerPtr makeCountingSumScorerNoReq()
virtual void initialize()
Called directly after instantiation to create objects that depend on this object being fully construc...
BooleanScorer2(const SimilarityPtr &similarity, int32_t minNrShouldMatch, Collection< ScorerPtr > required, Collection< ScorerPtr > prohibited, Collection< ScorerPtr > optional)
Creates a Scorer with the given similarity and lists of required, prohibited and optional scorers....
ScorerPtr countingConjunctionSumScorer(Collection< ScorerPtr > requiredScorers)
virtual int32_t advance(int32_t target)
Advances to the first beyond the current whose document number is greater than or equal to target....
Collection< ScorerPtr > optionalScorers
Definition: BooleanScorer2.h:41
Collection< ScorerPtr > requiredScorers
Definition: BooleanScorer2.h:40
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...
ScorerPtr makeCountingSumScorerSomeReq()
int32_t minNrShouldMatch
Definition: BooleanScorer2.h:49
Scorer for conjunctions, sets of queries, all of which are required.
Definition: ConjunctionScorer.h:15
Collection< ScorerPtr > scorers
Definition: ConjunctionScorer.h:23
Definition: BooleanScorer2.h:85
Collection< double > coordFactors
Definition: BooleanScorer2.h:94
virtual ~Coordinator()
int32_t nrMatchers
Definition: BooleanScorer2.h:96
BooleanScorer2WeakPtr _scorer
Definition: BooleanScorer2.h:93
Coordinator(const BooleanScorer2Ptr &scorer)
int32_t maxCoord
Definition: BooleanScorer2.h:95
Definition: BooleanScorer2.h:145
int32_t requiredNrMatchers
Definition: BooleanScorer2.h:155
virtual double score()
Returns the score of the current document matching the query. Initially invalid, until nextDoc() or a...
CountingConjunctionSumScorer(const BooleanScorer2Ptr &scorer, const SimilarityPtr &similarity, Collection< ScorerPtr > scorers)
BooleanScorer2WeakPtr _scorer
Definition: BooleanScorer2.h:153
double lastDocScore
Definition: BooleanScorer2.h:158
int32_t lastScoredDoc
Definition: BooleanScorer2.h:154
Definition: BooleanScorer2.h:125
BooleanScorer2WeakPtr _scorer
Definition: BooleanScorer2.h:133
double lastDocScore
Definition: BooleanScorer2.h:137
virtual double score()
Returns the score of the current document matching the query. Initially invalid, until next() is call...
int32_t lastScoredDoc
Definition: BooleanScorer2.h:134
CountingDisjunctionSumScorer(const BooleanScorer2Ptr &scorer, Collection< ScorerPtr > subScorers, int32_t minimumNrMatchers)
A Scorer for OR like queries, counterpart of ConjunctionScorer. This Scorer implements Scorer#skipTo(...
Definition: DisjunctionSumScorer.h:16
int32_t minimumNrMatchers
The minimum number of scorers that should match.
Definition: DisjunctionSumScorer.h:31
Collection< ScorerPtr > subScorers
The subscorers.
Definition: DisjunctionSumScorer.h:28
Base class for all Lucene classes.
Definition: LuceneObject.h:31
Common scoring functionality for different types of queries.
Definition: Scorer.h:33
SimilarityPtr similarity
Definition: Scorer.h:45
Count a scorer as a single match.
Definition: BooleanScorer2.h:105
double lastDocScore
Definition: BooleanScorer2.h:116
CoordinatorPtr coordinator
Definition: BooleanScorer2.h:114
int32_t lastScoredDoc
Definition: BooleanScorer2.h:115
ScorerPtr scorer
Definition: BooleanScorer2.h:113
virtual int32_t nextDoc()
Advances to the next document in the set and returns the doc it is currently on, or NO_MORE_DOCS if t...
virtual int32_t advance(int32_t target)
Advances to the first beyond the current whose document number is greater than or equal to target....
virtual double score()
Returns the score of the current document matching the query. Initially invalid, until nextDoc() or a...
SingleMatchScorer(const ScorerPtr &scorer, const CoordinatorPtr &coordinator)
virtual int32_t docID()
Returns the following:
Definition: AbstractAllTermDocs.h:12
boost::shared_ptr< Coordinator > CoordinatorPtr
Definition: LuceneTypes.h:305
boost::shared_ptr< BooleanScorer2 > BooleanScorer2Ptr
Definition: LuceneTypes.h:282
boost::shared_ptr< Similarity > SimilarityPtr
Definition: LuceneTypes.h:435
boost::shared_ptr< Collector > CollectorPtr
Definition: LuceneTypes.h:295
boost::shared_ptr< Scorer > ScorerPtr
Definition: LuceneTypes.h:429
boost::weak_ptr< BooleanScorer2 > BooleanScorer2WeakPtr
Definition: LuceneTypes.h:282

clucene.sourceforge.net