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

Loading...
Searching...
No Matches
SloppyPhraseScorer.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 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<PhrasePositions*> repeats;
24 Collection<PhrasePositions*> tmpPos; // for flipping repeating pps
25 bool checkedRepeats;
26
27 public:
40 virtual double phraseFreq();
41
42 protected:
45 PhrasePositions* flip(PhrasePositions* pp, PhrasePositions* pp2);
46
58 int32_t initPhrasePositions();
59
64 PhrasePositions* termPositionsDiffer(PhrasePositions* pp);
65};
66
67}
68
69#endif
LUCENE_CLASS
#define LUCENE_CLASS(Name)
Definition LuceneObject.h:24
PhraseScorer.h
Lucene::Collection
Utility template class to handle collections that can be safely copied and shared.
Definition Collection.h:17
Lucene::PhrasePositions
Position of a term in a document that takes into account the term offset within the phrase.
Definition PhrasePositions.h:15
Lucene::PhraseScorer::norms
ByteArray norms
Definition PhraseScorer.h:32
Lucene::PhraseScorer::weight
WeightPtr weight
Definition PhraseScorer.h:30
Lucene::PhraseScorer::PhraseScorer
PhraseScorer(const WeightPtr &weight, Collection< TermPositionsPtr > tps, Collection< int32_t > offsets, const SimilarityPtr &similarity, ByteArray norms)
Lucene::Scorer::similarity
SimilarityPtr similarity
Definition Scorer.h:45
Lucene::SloppyPhraseScorer::repeats
Collection< PhrasePositions * > repeats
Definition SloppyPhraseScorer.h:23
Lucene::SloppyPhraseScorer::tmpPos
Collection< PhrasePositions * > tmpPos
Definition SloppyPhraseScorer.h:24
Lucene::SloppyPhraseScorer::initPhrasePositions
int32_t initPhrasePositions()
Init PhrasePositions in place. There is a one time initialization for this scorer:
Lucene::SloppyPhraseScorer::termPositionsDiffer
PhrasePositions * termPositionsDiffer(PhrasePositions *pp)
We disallow two pp's to have the same TermPosition, thereby verifying multiple occurrences in the que...
Lucene::SloppyPhraseScorer::flip
PhrasePositions * flip(PhrasePositions *pp, PhrasePositions *pp2)
Flip pp2 and pp in the queue: pop until finding pp2, insert back all but pp2, insert pp back....
Lucene::SloppyPhraseScorer::SloppyPhraseScorer
SloppyPhraseScorer(const WeightPtr &weight, Collection< TermPositionsPtr > tps, Collection< int32_t > offsets, const SimilarityPtr &similarity, int32_t slop, ByteArray norms)
Lucene::SloppyPhraseScorer::slop
int32_t slop
Definition SloppyPhraseScorer.h:22
Lucene::SloppyPhraseScorer::phraseFreq
virtual double phraseFreq()
Score a candidate doc for all slop-valid position-combinations (matches) encountered while traversing...
Lucene::SloppyPhraseScorer::~SloppyPhraseScorer
virtual ~SloppyPhraseScorer()
Lucene::SloppyPhraseScorer::checkedRepeats
bool checkedRepeats
Definition SloppyPhraseScorer.h:25
Lucene
Definition AbstractAllTermDocs.h:12
Lucene::WeightPtr
boost::shared_ptr< Weight > WeightPtr
Definition LuceneTypes.h:480
Lucene::SimilarityPtr
boost::shared_ptr< Similarity > SimilarityPtr
Definition LuceneTypes.h:435

clucene.sourceforge.net