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 // Copyright (c) 2009-2011 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  {
22  public:
35 
36  virtual ~BooleanScorer2();
37 
39 
40  protected:
44 
46 
49 
51  int32_t doc;
52 
53  public:
54  virtual void initialize();
55 
58  virtual void score(CollectorPtr collector);
59 
60  virtual bool score(CollectorPtr collector, int32_t max, int32_t firstDocID);
61  virtual int32_t docID();
62  virtual int32_t nextDoc();
63  virtual double score();
64  virtual int32_t advance(int32_t target);
65 
66  protected:
67  ScorerPtr countingDisjunctionSumScorer(Collection<ScorerPtr> scorers, int32_t minNrShouldMatch);
70 
76 
80  ScorerPtr addProhibitedScorers(ScorerPtr requiredCountingSumScorer);
81 
84  };
85 
86  class Coordinator : public LuceneObject
87  {
88  public:
90  virtual ~Coordinator();
91 
93 
94  public:
97  int32_t maxCoord; // to be increased for each non prohibited scorer
98  int32_t nrMatchers; // to be increased by score() of match counting scorers.
99 
100  public:
101  void init(); // use after all scorers have been added.
102 
103  friend class BooleanScorer2;
104  };
105 
107  class SingleMatchScorer : public Scorer
108  {
109  public:
111  virtual ~SingleMatchScorer();
112 
114 
115  protected:
118  int32_t lastScoredDoc;
119  double lastDocScore;
120 
121  public:
122  virtual double score();
123  virtual int32_t docID();
124  virtual int32_t nextDoc();
125  virtual int32_t advance(int32_t target);
126  };
127 
129  {
130  public:
133 
135 
136  protected:
138  int32_t lastScoredDoc;
139 
140  // Save the score of lastScoredDoc, so that we don't compute it more than once in score().
141  double lastDocScore;
142 
143  public:
144  virtual double score();
145 
146  friend class BooleanScorer2;
147  };
148 
150  {
151  public:
154 
156 
157  protected:
159  int32_t lastScoredDoc;
161 
162  // Save the score of lastScoredDoc, so that we don't compute it more than once in score().
163  double lastDocScore;
164 
165  public:
166  virtual double score();
167  };
168 }
169 
170 #endif

clucene.sourceforge.net