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

Loading...
Searching...
No Matches
TermScorer.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 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
26 LUCENE_CLASS(TermScorer);
27
28 protected:
29 WeightPtr weight;
30 TermDocsPtr termDocs; // for malloc and free
31 TermDocs* __termDocs; // for work,
32 ByteArray norms;
33 double weightValue;
34 int32_t doc;
35
36 Collection<int32_t> docs; // buffered doc numbers
37 decltype(docs.get()) __docs; //
38 Collection<int32_t> freqs; // buffered term freqs
39 decltype(freqs.get()) __freqs; //
40
41 int32_t freq;
42 int32_t pointer;
43 int32_t pointerMax;
44
45 static const int32_t SCORE_CACHE_SIZE;
46 Collection<double> scoreCache;
47
48
49
50 public:
51 virtual void score(const CollectorPtr& collector);
52 virtual int32_t docID();
53
58 virtual int32_t nextDoc();
59
60 virtual double score();
61
66 virtual int32_t advance(int32_t target);
67
69 virtual String toString();
70
71 virtual float termFreq(){
72 return freq;
73 }
74
75 protected:
76 static const Collection<double>& SIM_NORM_DECODER();
77
78 virtual bool score(const CollectorPtr& collector, int32_t max, int32_t firstDocID);
79};
80
81}
82
83#endif
LUCENE_CLASS
#define LUCENE_CLASS(Name)
Definition LuceneObject.h:24
Scorer.h
Lucene::Collection
Utility template class to handle collections that can be safely copied and shared.
Definition Collection.h:17
Lucene::Collection::get
collection_type * get()
Definition Collection.h:197
Lucene::Scorer
Common scoring functionality for different types of queries.
Definition Scorer.h:33
Lucene::TermDocs
TermDocs provides an interface for enumerating <document, frequency>; pairs for a term....
Definition TermDocs.h:19
Lucene::TermScorer
A Scorer for documents matching a Term.
Definition TermScorer.h:15
Lucene::TermScorer::docs
Collection< int32_t > docs
Definition TermScorer.h:36
Lucene::TermScorer::weight
WeightPtr weight
Definition TermScorer.h:29
Lucene::TermScorer::TermScorer
TermScorer(const WeightPtr &weight, const TermDocsPtr &td, const SimilarityPtr &similarity, ByteArray norms)
Construct a TermScorer.
Lucene::TermScorer::score
virtual void score(const CollectorPtr &collector)
Scores and collects all matching documents.
Lucene::TermScorer::~TermScorer
virtual ~TermScorer()
Lucene::TermScorer::__termDocs
TermDocs * __termDocs
Definition TermScorer.h:31
Lucene::TermScorer::weightValue
double weightValue
Definition TermScorer.h:33
Lucene::TermScorer::docID
virtual int32_t docID()
Returns the following:
Lucene::TermScorer::SIM_NORM_DECODER
static const Collection< double > & SIM_NORM_DECODER()
Lucene::TermScorer::nextDoc
virtual int32_t nextDoc()
Advances to the next document matching the query. The iterator over the matching documents is buffere...
Lucene::TermScorer::advance
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...
Lucene::TermScorer::score
virtual double score()
Returns the score of the current document matching the query. Initially invalid, until nextDoc() or a...
Lucene::TermScorer::doc
int32_t doc
Definition TermScorer.h:34
Lucene::TermScorer::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::TermScorer::freq
int32_t freq
Definition TermScorer.h:41
Lucene::TermScorer::termFreq
virtual float termFreq()
Definition TermScorer.h:71
Lucene::TermScorer::scoreCache
Collection< double > scoreCache
Definition TermScorer.h:46
Lucene::TermScorer::toString
virtual String toString()
Returns a string representation of this TermScorer.
Lucene::TermScorer::termDocs
TermDocsPtr termDocs
Definition TermScorer.h:30
Lucene::TermScorer::norms
ByteArray norms
Definition TermScorer.h:32
Lucene::TermScorer::SCORE_CACHE_SIZE
static const int32_t SCORE_CACHE_SIZE
Definition TermScorer.h:45
Lucene::TermScorer::pointerMax
int32_t pointerMax
Definition TermScorer.h:43
Lucene::TermScorer::pointer
int32_t pointer
Definition TermScorer.h:42
Lucene::TermScorer::freqs
Collection< int32_t > freqs
Definition TermScorer.h:38
Lucene
Definition AbstractAllTermDocs.h:12
Lucene::TermDocsPtr
boost::shared_ptr< TermDocs > TermDocsPtr
Definition LuceneTypes.h:236
Lucene::SimilarityPtr
boost::shared_ptr< Similarity > SimilarityPtr
Definition LuceneTypes.h:435
Lucene::CollectorPtr
boost::shared_ptr< Collector > CollectorPtr
Definition LuceneTypes.h:295
Lucene::WeightPtr
boost::shared_ptr< Weight > WeightPtr
Definition LuceneTypes.h:480

clucene.sourceforge.net