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

- Main Page
- Related Pages
- Namespaces
- Data Structures
- Files

- File List
- Globals

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

clucene.sourceforge.net