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

Loading...
Searching...
No Matches
Query.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 QUERY_H
8#define QUERY_H
9
10#include "LuceneObject.h"
11
12 namespace Lucene {
13
31 class LPPAPI Query : public LuceneObject {
32 public:
33 Query();
34 virtual ~Query();
35
36 LUCENE_CLASS(Query);
37
38 protected:
39 double boost; // query boost factor
40
41 public:
44 virtual void setBoost(double b);
45
48 virtual double getBoost();
49
61 virtual String toString(const String& field);
62
64 virtual String toString();
65
68 virtual WeightPtr createWeight(const SearcherPtr& searcher);
69
71 virtual WeightPtr weight(const SearcherPtr& searcher);
72
75 virtual QueryPtr rewrite(const IndexReaderPtr& reader);
76
84 virtual QueryPtr combine(Collection<QueryPtr> queries);
85
88 virtual void extractTerms(SetTerm terms);
89
93 static QueryPtr mergeBooleanQueries(Collection<BooleanQueryPtr> queries);
94
98 virtual SimilarityPtr getSimilarity(const SearcherPtr& searcher);
99
101 virtual LuceneObjectPtr clone(const LuceneObjectPtr& other = LuceneObjectPtr());
102
103 virtual int32_t hashCode();
104 virtual bool equals(const LuceneObjectPtr& other);
105
107 String boostString();
108};
109
110}
111
112#endif
LuceneObject.h
LUCENE_CLASS
#define LUCENE_CLASS(Name)
Definition LuceneObject.h:24
Lucene::Collection
Utility template class to handle collections that can be safely copied and shared.
Definition Collection.h:17
Lucene::LuceneObject::LuceneObject
LuceneObject()
Lucene::Query::boost
double boost
Definition Query.h:39
Lucene::Query::~Query
virtual ~Query()
Lucene::Query::getSimilarity
virtual SimilarityPtr getSimilarity(const SearcherPtr &searcher)
Returns the Similarity implementation to be used for this query. Subclasses may override this method ...
Lucene::Query::clone
virtual LuceneObjectPtr clone(const LuceneObjectPtr &other=LuceneObjectPtr())
Returns a clone of this query.
Lucene::Query::mergeBooleanQueries
static QueryPtr mergeBooleanQueries(Collection< BooleanQueryPtr > queries)
Merges the clauses of a set of BooleanQuery's into a single BooleanQuery.
Lucene::Query::equals
virtual bool equals(const LuceneObjectPtr &other)
Return whether two objects are equal.
Lucene::Query::toString
virtual String toString()
Prints a query to a string.
Lucene::Query::hashCode
virtual int32_t hashCode()
Return hash code for this object.
Lucene::Query::Query
Query()
Lucene::Query::rewrite
virtual QueryPtr rewrite(const IndexReaderPtr &reader)
Called to re-write queries into primitive queries. For example, a PrefixQuery will be rewritten into ...
Lucene::Query::extractTerms
virtual void extractTerms(SetTerm terms)
Adds all terms occurring in this query to the terms set. Only works if this query is in its rewritten...
Lucene::Query::toString
virtual String toString(const String &field)
Prints a query to a string, with field assumed to be the default field and omitted.
Lucene::Query::boostString
String boostString()
Return given boost value as a string.
Lucene::Query::weight
virtual WeightPtr weight(const SearcherPtr &searcher)
Constructs and initializes a Weight for a top-level query.
Lucene::Query::combine
virtual QueryPtr combine(Collection< QueryPtr > queries)
Called when re-writing queries under MultiSearcher.
Lucene::Query::getBoost
virtual double getBoost()
Gets the boost for this clause. Documents matching this clause will (in addition to the normal weight...
Lucene::Query::createWeight
virtual WeightPtr createWeight(const SearcherPtr &searcher)
Constructs an appropriate Weight implementation for this query. Only implemented by primitive queries...
Lucene::Query::setBoost
virtual void setBoost(double b)
Sets the boost for this query clause to b. Documents matching this clause will (in addition to the no...
Lucene
Definition AbstractAllTermDocs.h:12
Lucene::QueryPtr
boost::shared_ptr< Query > QueryPtr
Definition LuceneTypes.h:420
Lucene::WeightPtr
boost::shared_ptr< Weight > WeightPtr
Definition LuceneTypes.h:480
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::IndexReaderPtr
boost::shared_ptr< IndexReader > IndexReaderPtr
Definition LuceneTypes.h:157

clucene.sourceforge.net