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

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

- File List
- Globals

All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
CustomScoreQuery.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 CUSTOMSCOREQUERY_H
8 #define CUSTOMSCOREQUERY_H
9
10 #include "Query.h"
11
12 namespace Lucene
13 {
21 class LPPAPI CustomScoreQuery : public Query
22 {
23 public:
26 CustomScoreQuery(QueryPtr subQuery);
27
33 CustomScoreQuery(QueryPtr subQuery, ValueSourceQueryPtr valSrcQuery);
34
40 CustomScoreQuery(QueryPtr subQuery, Collection<ValueSourceQueryPtr> valSrcQueries);
41
42 virtual ~CustomScoreQuery();
43
44 LUCENE_CLASS(CustomScoreQuery);
45
46 protected:
47 QueryPtr subQuery;
48 Collection<ValueSourceQueryPtr> valSrcQueries; // never null (empty array if there are no valSrcQueries).
49 bool strict; // if true, valueSource part of query does not take part in weights normalization.
50
51 public:
52 using Query::toString;
53
54 virtual QueryPtr rewrite(IndexReaderPtr reader);
55 virtual void extractTerms(SetTerm terms);
56 virtual LuceneObjectPtr clone(LuceneObjectPtr other = LuceneObjectPtr());
57 virtual String toString(const String& field);
58 virtual bool equals(LuceneObjectPtr other);
59 virtual int32_t hashCode();
60
69 virtual double customScore(int32_t doc, double subQueryScore, Collection<double> valSrcScores);
70
79 virtual double customScore(int32_t doc, double subQueryScore, double valSrcScore);
80
89 virtual ExplanationPtr customExplain(int32_t doc, ExplanationPtr subQueryExpl, Collection<ExplanationPtr> valSrcExpls);
90
99 virtual ExplanationPtr customExplain(int32_t doc, ExplanationPtr subQueryExpl, ExplanationPtr valSrcExpl);
100
101 virtual WeightPtr createWeight(SearcherPtr searcher);
102
109 virtual bool isStrict();
110
114 virtual void setStrict(bool strict);
115
117 virtual String name();
118
119 protected:
120 void ConstructQuery(QueryPtr subQuery, Collection<ValueSourceQueryPtr> valSrcQueries);
121
125 virtual CustomScoreProviderPtr getCustomScoreProvider(IndexReaderPtr reader);
126
127 friend class CustomWeight;
128 friend class CustomScorer;
129 };
130 }
131
132 #endif

clucene.sourceforge.net