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

PayloadNearQuery.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 PAYLOADNEARQUERY_H
8 #define PAYLOADNEARQUERY_H
9
10 #include "SpanNearQuery.h"
11 #include "SpanWeight.h"
12 #include "SpanScorer.h"
13
14 namespace Lucene {
15
25 class LPPAPI PayloadNearQuery : public SpanNearQuery {
26 public:
27 PayloadNearQuery(Collection<SpanQueryPtr> clauses, int32_t slop, bool inOrder);
28 PayloadNearQuery(Collection<SpanQueryPtr> clauses, int32_t slop, bool inOrder, const PayloadFunctionPtr& function);
29
30 virtual ~PayloadNearQuery();
31
32 LUCENE_CLASS(PayloadNearQuery);
33
34 protected:
35 String fieldName;
36 PayloadFunctionPtr function;
37
38 public:
39 using SpanNearQuery::toString;
40
41 virtual WeightPtr createWeight(const SearcherPtr& searcher);
42
43 virtual LuceneObjectPtr clone(const LuceneObjectPtr& other = LuceneObjectPtr());
44 virtual String toString(const String& field);
45 virtual bool equals(const LuceneObjectPtr& other);
46 virtual int32_t hashCode();
47
48 friend class PayloadNearSpanWeight;
49 friend class PayloadNearSpanScorer;
50 };
51
52 class LPPAPI PayloadNearSpanWeight : public SpanWeight {
53 public:
54 PayloadNearSpanWeight(const SpanQueryPtr& query, const SearcherPtr& searcher);
55 virtual ~PayloadNearSpanWeight();
56
57 LUCENE_CLASS(PayloadNearSpanWeight);
58
59 public:
60 virtual ScorerPtr scorer(const IndexReaderPtr& reader, bool scoreDocsInOrder, bool topScorer);
61 };
62
63 class LPPAPI PayloadNearSpanScorer : public SpanScorer {
64 public:
65 PayloadNearSpanScorer(const SpansPtr& spans, const WeightPtr& weight, const SimilarityPtr& similarity, ByteArray norms);
66 virtual ~PayloadNearSpanScorer();
67
68 LUCENE_CLASS(PayloadNearSpanScorer);
69
70 public:
71 SpansPtr spans;
72 SimilarityPtr similarity;
73
74 protected:
75 double payloadScore;
76 int32_t payloadsSeen;
77
78 public:
80 void getPayloads(Collection<SpansPtr> subSpans);
81
82 virtual double score();
83
84 protected:
91 void processPayloads(Collection<ByteArray> payLoads, int32_t start, int32_t end);
92
93 virtual bool setFreqCurrentDoc();
94 virtual ExplanationPtr explain(int32_t doc);
95 };
96
97 }
98
99 #endif
Lucene::SpanQueryPtr
boost::shared_ptr< SpanQuery > SpanQueryPtr
Definition: LuceneTypes.h:450
LUCENE_CLASS
#define LUCENE_CLASS(Name)
Definition: LuceneObject.h:24
Lucene::SpanScorer
Public for extension only.
Definition: SpanScorer.h:15
Lucene::Collection< SpanQueryPtr >
SpanNearQuery.h
Lucene::PayloadNearSpanScorer::payloadsSeen
int32_t payloadsSeen
Definition: PayloadNearQuery.h:76
Lucene::LuceneObjectPtr
boost::shared_ptr< LuceneObject > LuceneObjectPtr
Definition: LuceneTypes.h:539
Lucene::PayloadNearSpanScorer::payloadScore
double payloadScore
Definition: PayloadNearQuery.h:75
SpanScorer.h
Lucene::PayloadNearSpanScorer
Definition: PayloadNearQuery.h:63
Lucene
Definition: AbstractAllTermDocs.h:12
Lucene::PayloadNearSpanWeight
Definition: PayloadNearQuery.h:52
Lucene::WeightPtr
boost::shared_ptr< Weight > WeightPtr
Definition: LuceneTypes.h:480
Lucene::PayloadNearSpanScorer::spans
SpansPtr spans
Definition: PayloadNearQuery.h:68
Lucene::IndexReaderPtr
boost::shared_ptr< IndexReader > IndexReaderPtr
Definition: LuceneTypes.h:157
Lucene::SpanWeight
Public for use by other weight implementations.
Definition: SpanWeight.h:15
Lucene::ScorerPtr
boost::shared_ptr< Scorer > ScorerPtr
Definition: LuceneTypes.h:429
SpanWeight.h
Lucene::SpansPtr
boost::shared_ptr< Spans > SpansPtr
Definition: LuceneTypes.h:453
Lucene::SpanNearQuery
Matches spans which are near one another. One can specify slop, the maximum number of intervening unm...
Definition: SpanNearQuery.h:16
Lucene::SimilarityPtr
boost::shared_ptr< Similarity > SimilarityPtr
Definition: LuceneTypes.h:435
Lucene::PayloadFunctionPtr
boost::shared_ptr< PayloadFunction > PayloadFunctionPtr
Definition: LuceneTypes.h:402
Lucene::PayloadNearSpanScorer::similarity
SimilarityPtr similarity
Definition: PayloadNearQuery.h:72
Lucene::ExplanationPtr
boost::shared_ptr< Explanation > ExplanationPtr
Definition: LuceneTypes.h:333
Lucene::PayloadNearQuery
This class is very similar to SpanNearQuery except that it factors in the value of the payloads locat...
Definition: PayloadNearQuery.h:25
Lucene::Query::toString
virtual String toString()
Prints a query to a string.
Lucene::SearcherPtr
boost::shared_ptr< Searcher > SearcherPtr
Definition: LuceneTypes.h:434

clucene.sourceforge.net