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


PhraseScorer.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 PHRASESCORER_H
8#define PHRASESCORER_H
9
10#include "Scorer.h"
11
12namespace Lucene {
13
21class PhraseScorer : public Scorer {
22public:
24 virtual ~PhraseScorer();
25
27
28protected:
30 ByteArray norms;
31 double value;
32
34 bool more;
38
39 double freq; // phrase frequency in current doc as computed by phraseFreq().
40
41public:
42 virtual int32_t docID();
43 virtual int32_t nextDoc();
44 virtual double score();
45 virtual int32_t advance(int32_t target);
46
48 double currentFreq();
49 virtual float termFreq(){
50 return currentFreq();
51 }
52
53 virtual String toString();
54
55protected:
57 bool doNext();
58
64 virtual double phraseFreq() = 0;
65
66 void init();
67 void sort();
68 void pqToList();
70};
71
72}
73
74#endif
#define LUCENE_CLASS(Name)
Definition: LuceneObject.h:24
Utility template class to handle collections that can be safely copied and shared.
Definition: Collection.h:17
Scoring functionality for phrase queries. A document is considered matching if it contains the phrase...
Definition: PhraseScorer.h:21
virtual float termFreq()
Definition: PhraseScorer.h:49
ByteArray norms
Definition: PhraseScorer.h:30
WeightPtr weight
Definition: PhraseScorer.h:29
PhrasePositionsPtr last
Definition: PhraseScorer.h:37
virtual int32_t docID()
Returns the following:
PhraseQueuePtr pq
Definition: PhraseScorer.h:35
virtual double phraseFreq()=0
For a document containing all the phrase query terms, compute the frequency of the phrase in that doc...
double currentFreq()
Phrase frequency in current doc as computed by phraseFreq().
virtual double score()
Returns the score of the current document matching the query. Initially invalid, until nextDoc() or a...
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...
bool firstTime
Definition: PhraseScorer.h:33
PhraseScorer(const WeightPtr &weight, Collection< TermPositionsPtr > tps, Collection< int32_t > offsets, const SimilarityPtr &similarity, ByteArray norms)
bool doNext()
Next without initial increment.
bool more
Definition: PhraseScorer.h:34
double value
Definition: PhraseScorer.h:31
PhrasePositionsPtr first
Definition: PhraseScorer.h:36
double freq
Definition: PhraseScorer.h:39
virtual String toString()
Returns a string representation of the object.
virtual int32_t advance(int32_t target)
Advances to the first beyond the current whose document number is greater than or equal to target....
Common scoring functionality for different types of queries.
Definition: Scorer.h:33
SimilarityPtr similarity
Definition: Scorer.h:45
Definition: AbstractAllTermDocs.h:12
boost::shared_ptr< PhrasePositions > PhrasePositionsPtr
Definition: LuceneTypes.h:410
boost::shared_ptr< Similarity > SimilarityPtr
Definition: LuceneTypes.h:435
boost::shared_ptr< PhraseQueue > PhraseQueuePtr
Definition: LuceneTypes.h:412
boost::shared_ptr< Weight > WeightPtr
Definition: LuceneTypes.h:480

clucene.sourceforge.net