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


TermScorer.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 TERMSCORER_H
8 #define TERMSCORER_H
9 
10 #include "Scorer.h"
11 
12 namespace Lucene {
13 
15 class LPPAPI TermScorer : public Scorer {
16 public:
22  TermScorer(const WeightPtr& weight, const TermDocsPtr& td, const SimilarityPtr& similarity, ByteArray norms);
23 
24  virtual ~TermScorer();
25 
27 
28 protected:
31  ByteArray norms;
32  double weightValue;
33  int32_t doc;
34 
35  Collection<int32_t> docs; // buffered doc numbers
36  Collection<int32_t> freqs; // buffered term freqs
37 
38  int32_t freq;
39  int32_t pointer;
40  int32_t pointerMax;
41 
42  static const int32_t SCORE_CACHE_SIZE;
44 
45 
46 
47 public:
48  virtual void score(const CollectorPtr& collector);
49  virtual int32_t docID();
50 
55  virtual int32_t nextDoc();
56 
57  virtual double score();
58 
63  virtual int32_t advance(int32_t target);
64 
66  virtual String toString();
67 
68  virtual float termFreq(){
69  return freq;
70  }
71 
72 protected:
74 
75  virtual bool score(const CollectorPtr& collector, int32_t max, int32_t firstDocID);
76 };
77 
78 }
79 
80 #endif
#define LUCENE_CLASS(Name)
Definition: LuceneObject.h:24
Common scoring functionality for different types of queries.
Definition: Scorer.h:33
A Scorer for documents matching a Term.
Definition: TermScorer.h:15
Collection< int32_t > docs
Definition: TermScorer.h:35
WeightPtr weight
Definition: TermScorer.h:26
TermScorer(const WeightPtr &weight, const TermDocsPtr &td, const SimilarityPtr &similarity, ByteArray norms)
Construct a TermScorer.
virtual void score(const CollectorPtr &collector)
Scores and collects all matching documents.
virtual ~TermScorer()
double weightValue
Definition: TermScorer.h:32
virtual int32_t docID()
Returns the following:
virtual int32_t nextDoc()
Advances to the next document matching the query. The iterator over the matching documents is buffere...
virtual int32_t advance(int32_t target)
Advances to the first match beyond the current whose document number is greater than or equal to a gi...
virtual double score()
Returns the score of the current document matching the query. Initially invalid, until {} or #advanc...
int32_t doc
Definition: TermScorer.h:33
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...
int32_t freq
Definition: TermScorer.h:38
virtual float termFreq()
Definition: TermScorer.h:68
Collection< double > scoreCache
Definition: TermScorer.h:43
virtual String toString()
Returns a string representation of this TermScorer.
TermDocsPtr termDocs
Definition: TermScorer.h:30
ByteArray norms
Definition: TermScorer.h:31
static const int32_t SCORE_CACHE_SIZE
Definition: TermScorer.h:42
int32_t pointerMax
Definition: TermScorer.h:40
int32_t pointer
Definition: TermScorer.h:39
Collection< int32_t > freqs
Definition: TermScorer.h:36
static const Collection< double > SIM_NORM_DECODER()
Definition: AbstractAllTermDocs.h:12
boost::shared_ptr< TermDocs > TermDocsPtr
Definition: LuceneTypes.h:236
boost::shared_ptr< Similarity > SimilarityPtr
Definition: LuceneTypes.h:435
boost::shared_ptr< Collector > CollectorPtr
Definition: LuceneTypes.h:295
boost::shared_ptr< Weight > WeightPtr
Definition: LuceneTypes.h:480

clucene.sourceforge.net