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


 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
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 
10 #include "DisjunctionSumScorer.h"
11 #include "ConjunctionScorer.h"
12 
13 namespace Lucene {
14 
20 class BooleanScorer2 : public Scorer {
21 public:
34 
35  virtual ~BooleanScorer2();
36 
38 
39 protected:
43 
45 
48 
50  int32_t doc;
51 
52 public:
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 
65 protected:
66  ScorerPtr countingDisjunctionSumScorer(Collection<ScorerPtr> scorers, int32_t minNrShouldMatch);
68  ScorerPtr dualConjunctionSumScorer(const ScorerPtr& req1, const ScorerPtr& req2);
69 
75 
79  ScorerPtr addProhibitedScorers(const ScorerPtr& requiredCountingSumScorer);
80 
83 };
84 
85 class Coordinator : public LuceneObject {
86 public:
87  Coordinator(const BooleanScorer2Ptr& scorer);
88  virtual ~Coordinator();
89 
91 
92 public:
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 
98 public:
99  void init(); // use after all scorers have been added.
100 
101  friend class BooleanScorer2;
102 };
103 
105 class SingleMatchScorer : public Scorer {
106 public:
108  virtual ~SingleMatchScorer();
109 
111 
112 protected:
115  int32_t lastScoredDoc;
116  double lastDocScore;
117 
118 public:
119  virtual double score();
120  virtual int32_t docID();
121  virtual int32_t nextDoc();
122  virtual int32_t advance(int32_t target);
123 };
124 
126 public:
129 
131 
132 protected:
134  int32_t lastScoredDoc;
135 
136  // Save the score of lastScoredDoc, so that we don't compute it more than once in score().
137  double lastDocScore;
138 
139 public:
140  virtual double score();
141 
142  friend class BooleanScorer2;
143 };
144 
146 public:
149 
151 
152 protected:
154  int32_t lastScoredDoc;
156 
157  // Save the score of lastScoredDoc, so that we don't compute it more than once in score().
158  double lastDocScore;
159 
160 public:
161  virtual double score();
162 };
163 
164 }
165 
166 #endif

clucene.sourceforge.net