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

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

- File List
- Globals

SloppyPhraseScorer.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 SLOPPYPHRASESCORER_H
8 #define SLOPPYPHRASESCORER_H
9
10 #include "PhraseScorer.h"
11
12 namespace Lucene {
13
14 class SloppyPhraseScorer : public PhraseScorer {
15 public:
16 SloppyPhraseScorer(const WeightPtr& weight, Collection<TermPositionsPtr> tps, Collection<int32_t> offsets, const SimilarityPtr& similarity, int32_t slop, ByteArray norms);
17 virtual ~SloppyPhraseScorer();
18
19 LUCENE_CLASS(SloppyPhraseScorer);
20
21 protected:
22 int32_t slop;
23 Collection<PhrasePositionsPtr> repeats;
24 Collection<PhrasePositionsPtr> tmpPos; // for flipping repeating pps
25 bool checkedRepeats;
26
27 public:
40 virtual double phraseFreq();
41
42 protected:
45 PhrasePositionsPtr flip(const PhrasePositionsPtr& pp, const PhrasePositionsPtr& pp2);
46
58 int32_t initPhrasePositions();
59
64 PhrasePositionsPtr termPositionsDiffer(const PhrasePositionsPtr& pp);
65 };
66
67 }
68
69 #endif
PhraseScorer.h
Lucene::SloppyPhraseScorer::slop
int32_t slop
Definition: SloppyPhraseScorer.h:19
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::SloppyPhraseScorer::repeats
Collection< PhrasePositionsPtr > repeats
Definition: SloppyPhraseScorer.h:23
Lucene::Scorer::similarity
SimilarityPtr similarity
Definition: Scorer.h:29
Lucene::PhraseScorer::norms
ByteArray norms
Definition: PhraseScorer.h:30
Lucene::SloppyPhraseScorer::phraseFreq
virtual double phraseFreq()
Score a candidate doc for all slop-valid position-combinations (matches) encountered while traversing...
Lucene::SloppyPhraseScorer::tmpPos
Collection< PhrasePositionsPtr > tmpPos
Definition: SloppyPhraseScorer.h:24
Lucene::SloppyPhraseScorer::SloppyPhraseScorer
SloppyPhraseScorer(const WeightPtr &weight, Collection< TermPositionsPtr > tps, Collection< int32_t > offsets, const SimilarityPtr &similarity, int32_t slop, ByteArray norms)
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::SloppyPhraseScorer::checkedRepeats
bool checkedRepeats
Definition: SloppyPhraseScorer.h:25
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::SloppyPhraseScorer::~SloppyPhraseScorer
virtual ~SloppyPhraseScorer()
Lucene::SloppyPhraseScorer::initPhrasePositions
int32_t initPhrasePositions()
Init PhrasePositions in place. There is a one time initialization for this scorer: ...
Lucene::SloppyPhraseScorer::termPositionsDiffer
PhrasePositionsPtr termPositionsDiffer(const PhrasePositionsPtr &pp)
We disallow two pp's to have the same TermPosition, thereby verifying multiple occurrences in the que...
Lucene::SimilarityPtr
boost::shared_ptr< Similarity > SimilarityPtr
Definition: LuceneTypes.h:435
Lucene::SloppyPhraseScorer
Definition: SloppyPhraseScorer.h:14
Lucene::SloppyPhraseScorer::flip
PhrasePositionsPtr flip(const PhrasePositionsPtr &pp, const PhrasePositionsPtr &pp2)
Flip pp2 and pp in the queue: pop until finding pp2, insert back all but pp2, insert pp back...

clucene.sourceforge.net