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

Loading...
Searching...
No Matches
PayloadNearQuery.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 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_CLASS
#define LUCENE_CLASS(Name)
Definition LuceneObject.h:24
SpanNearQuery.h
SpanScorer.h
SpanWeight.h
Lucene::Collection
Utility template class to handle collections that can be safely copied and shared.
Definition Collection.h:17
Lucene::PayloadNearQuery::clone
virtual LuceneObjectPtr clone(const LuceneObjectPtr &other=LuceneObjectPtr())
Returns a clone of this query.
Lucene::PayloadNearQuery::toString
virtual String toString(const String &field)
Prints a query to a string, with field assumed to be the default field and omitted.
Lucene::PayloadNearQuery::hashCode
virtual int32_t hashCode()
Return hash code for this object.
Lucene::PayloadNearQuery::PayloadNearSpanWeight
friend class PayloadNearSpanWeight
Definition PayloadNearQuery.h:48
Lucene::PayloadNearQuery::PayloadNearSpanScorer
friend class PayloadNearSpanScorer
Definition PayloadNearQuery.h:49
Lucene::PayloadNearQuery::createWeight
virtual WeightPtr createWeight(const SearcherPtr &searcher)
Constructs an appropriate Weight implementation for this query. Only implemented by primitive queries...
Lucene::PayloadNearQuery::equals
virtual bool equals(const LuceneObjectPtr &other)
Return whether two objects are equal.
Lucene::PayloadNearQuery::~PayloadNearQuery
virtual ~PayloadNearQuery()
Lucene::PayloadNearQuery::PayloadNearQuery
PayloadNearQuery(Collection< SpanQueryPtr > clauses, int32_t slop, bool inOrder)
Lucene::PayloadNearQuery::function
PayloadFunctionPtr function
Definition PayloadNearQuery.h:36
Lucene::PayloadNearQuery::fieldName
String fieldName
Definition PayloadNearQuery.h:35
Lucene::PayloadNearQuery::PayloadNearQuery
PayloadNearQuery(Collection< SpanQueryPtr > clauses, int32_t slop, bool inOrder, const PayloadFunctionPtr &function)
Lucene::PayloadNearSpanScorer::explain
virtual ExplanationPtr explain(int32_t doc)
This method is no longer an official member of Scorer, but it is needed by SpanWeight to build an exp...
Lucene::PayloadNearSpanScorer::similarity
SimilarityPtr similarity
Definition PayloadNearQuery.h:72
Lucene::PayloadNearSpanScorer::spans
SpansPtr spans
Definition PayloadNearQuery.h:71
Lucene::PayloadNearSpanScorer::processPayloads
void processPayloads(Collection< ByteArray > payLoads, int32_t start, int32_t end)
By default, uses the PayloadFunction to score the payloads, but can be overridden to do other things.
Lucene::PayloadNearSpanScorer::getPayloads
void getPayloads(Collection< SpansPtr > subSpans)
Get the payloads associated with all underlying subspans.
Lucene::PayloadNearSpanScorer::payloadScore
double payloadScore
Definition PayloadNearQuery.h:75
Lucene::PayloadNearSpanScorer::payloadsSeen
int32_t payloadsSeen
Definition PayloadNearQuery.h:76
Lucene::PayloadNearSpanScorer::PayloadNearSpanScorer
PayloadNearSpanScorer(const SpansPtr &spans, const WeightPtr &weight, const SimilarityPtr &similarity, ByteArray norms)
Lucene::PayloadNearSpanScorer::~PayloadNearSpanScorer
virtual ~PayloadNearSpanScorer()
Lucene::PayloadNearSpanScorer::score
virtual double score()
Returns the score of the current document matching the query. Initially invalid, until nextDoc() or a...
Lucene::PayloadNearSpanScorer::setFreqCurrentDoc
virtual bool setFreqCurrentDoc()
Lucene::PayloadNearSpanWeight::PayloadNearSpanWeight
PayloadNearSpanWeight(const SpanQueryPtr &query, const SearcherPtr &searcher)
Lucene::PayloadNearSpanWeight::~PayloadNearSpanWeight
virtual ~PayloadNearSpanWeight()
Lucene::PayloadNearSpanWeight::scorer
virtual ScorerPtr scorer(const IndexReaderPtr &reader, bool scoreDocsInOrder, bool topScorer)
Returns a Scorer which scores documents in/out-of order according to scoreDocsInOrder.
Lucene::SpanNearQuery::clauses
Collection< SpanQueryPtr > clauses
Definition SpanNearQuery.h:27
Lucene::SpanNearQuery::toString
virtual String toString(const String &field)
Prints a query to a string, with field assumed to be the default field and omitted.
Lucene::SpanNearQuery::SpanNearQuery
SpanNearQuery(Collection< SpanQueryPtr > clauses, int32_t slop, bool inOrder, bool collectPayloads=true)
Construct a SpanNearQuery. Matches spans matching a span from each clause, with up to slop total unma...
Lucene::SpanNearQuery::field
String field
Definition SpanNearQuery.h:31
Lucene::SpanNearQuery::slop
int32_t slop
Definition SpanNearQuery.h:28
Lucene::SpanNearQuery::inOrder
bool inOrder
Definition SpanNearQuery.h:29
Lucene::SpanScorer::norms
ByteArray norms
Definition SpanScorer.h:25
Lucene::SpanScorer::weight
WeightPtr weight
Definition SpanScorer.h:24
Lucene::SpanScorer::SpanScorer
SpanScorer(const SpansPtr &spans, const WeightPtr &weight, const SimilarityPtr &similarity, ByteArray norms)
Lucene::SpanScorer::doc
int32_t doc
Definition SpanScorer.h:28
Lucene::SpanWeight::query
SpanQueryPtr query
Definition SpanWeight.h:30
Lucene::SpanWeight::SpanWeight
SpanWeight(const SpanQueryPtr &query, const SearcherPtr &searcher)
Lucene
Definition AbstractAllTermDocs.h:12
Lucene::WeightPtr
boost::shared_ptr< Weight > WeightPtr
Definition LuceneTypes.h:480
Lucene::SpansPtr
boost::shared_ptr< Spans > SpansPtr
Definition LuceneTypes.h:453
Lucene::PayloadFunctionPtr
boost::shared_ptr< PayloadFunction > PayloadFunctionPtr
Definition LuceneTypes.h:402
Lucene::ExplanationPtr
boost::shared_ptr< Explanation > ExplanationPtr
Definition LuceneTypes.h:333
Lucene::SimilarityPtr
boost::shared_ptr< Similarity > SimilarityPtr
Definition LuceneTypes.h:435
Lucene::SearcherPtr
boost::shared_ptr< Searcher > SearcherPtr
Definition LuceneTypes.h:434
Lucene::LuceneObjectPtr
boost::shared_ptr< LuceneObject > LuceneObjectPtr
Definition LuceneTypes.h:539
Lucene::ScorerPtr
boost::shared_ptr< Scorer > ScorerPtr
Definition LuceneTypes.h:429
Lucene::SpanQueryPtr
boost::shared_ptr< SpanQuery > SpanQueryPtr
Definition LuceneTypes.h:450
Lucene::IndexReaderPtr
boost::shared_ptr< IndexReader > IndexReaderPtr
Definition LuceneTypes.h:157

clucene.sourceforge.net