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


 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
PayloadNearQuery.h
Go to the documentation of this file.
1 // Copyright (c) 2009-2011 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  {
27  public:
28  PayloadNearQuery(Collection<SpanQueryPtr> clauses, int32_t slop, bool inOrder);
29  PayloadNearQuery(Collection<SpanQueryPtr> clauses, int32_t slop, bool inOrder, PayloadFunctionPtr function);
30 
31  virtual ~PayloadNearQuery();
32 
34 
35  protected:
36  String fieldName;
38 
39  public:
41 
42  virtual WeightPtr createWeight(SearcherPtr searcher);
43 
44  virtual LuceneObjectPtr clone(LuceneObjectPtr other = LuceneObjectPtr());
45  virtual String toString(const String& field);
46  virtual bool equals(LuceneObjectPtr other);
47  virtual int32_t hashCode();
48 
49  friend class PayloadNearSpanWeight;
50  friend class PayloadNearSpanScorer;
51  };
52 
53  class LPPAPI PayloadNearSpanWeight : public SpanWeight
54  {
55  public:
57  virtual ~PayloadNearSpanWeight();
58 
60 
61  public:
62  virtual ScorerPtr scorer(IndexReaderPtr reader, bool scoreDocsInOrder, bool topScorer);
63  };
64 
65  class LPPAPI PayloadNearSpanScorer : public SpanScorer
66  {
67  public:
68  PayloadNearSpanScorer(SpansPtr spans, WeightPtr weight, SimilarityPtr similarity, ByteArray norms);
69  virtual ~PayloadNearSpanScorer();
70 
72 
73  public:
76 
77  protected:
78  double payloadScore;
79  int32_t payloadsSeen;
80 
81  public:
83  void getPayloads(Collection<SpansPtr> subSpans);
84 
85  virtual double score();
86 
87  protected:
94  void processPayloads(Collection<ByteArray> payLoads, int32_t start, int32_t end);
95 
96  virtual bool setFreqCurrentDoc();
97  virtual ExplanationPtr explain(int32_t doc);
98  };
99 }
100 
101 #endif

clucene.sourceforge.net