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


Loading...
Searching...
No Matches
MultiFieldQueryParser.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 MULTIFIELDQUERYPARSER_H
8#define MULTIFIELDQUERYPARSER_H
9
10#include "QueryParser.h"
11#include "BooleanClause.h"
12
13namespace Lucene {
14
16class LPPAPI MultiFieldQueryParser : public QueryParser {
17public:
39 MultiFieldQueryParser(LuceneVersion::Version matchVersion, Collection<String> fields, const AnalyzerPtr& analyzer, MapStringDouble boosts);
40
56
58
60
61protected:
63 MapStringDouble boosts;
64
65public:
66 using QueryParser::parse;
67
78 static QueryPtr parse(LuceneVersion::Version matchVersion, Collection<String> queries, Collection<String> fields, const AnalyzerPtr& analyzer);
79
100 static QueryPtr parse(LuceneVersion::Version matchVersion, const String& query, Collection<String> fields, Collection<BooleanClause::Occur> flags, const AnalyzerPtr& analyzer);
101
124
125protected:
126 virtual QueryPtr getFieldQuery(const String& field, const String& queryText, int32_t slop);
127 virtual QueryPtr getFieldQuery(const String& field, const String& queryText);
128 void applySlop(const QueryPtr& query, int32_t slop);
129
130 virtual QueryPtr getFuzzyQuery(const String& field, const String& termStr, double minSimilarity);
131 virtual QueryPtr getPrefixQuery(const String& field, const String& termStr);
132 virtual QueryPtr getWildcardQuery(const String& field, const String& termStr);
133 virtual QueryPtr getRangeQuery(const String& field, const String& part1, const String& part2, bool inclusive);
134};
135
136}
137
138#endif
#define LUCENE_CLASS(Name)
Definition LuceneObject.h:24
Utility template class to handle collections that can be safely copied and shared.
Definition Collection.h:17
Version
Definition Constants.h:40
A QueryParser which constructs queries to search multiple fields.
Definition MultiFieldQueryParser.h:16
static QueryPtr parse(LuceneVersion::Version matchVersion, Collection< String > queries, Collection< String > fields, Collection< BooleanClause::Occur > flags, const AnalyzerPtr &analyzer)
Parses a query, searching on the fields specified. Use this if you need to specify certain fields as ...
Collection< String > fields
Definition MultiFieldQueryParser.h:62
virtual QueryPtr getFieldQuery(const String &field, const String &queryText, int32_t slop)
Base implementation delegates to getFieldQuery(const String&, const String&). This method may be over...
void applySlop(const QueryPtr &query, int32_t slop)
MultiFieldQueryParser(LuceneVersion::Version matchVersion, Collection< String > fields, const AnalyzerPtr &analyzer, MapStringDouble boosts)
Creates a MultiFieldQueryParser. Allows passing of a map with term to Boost, and the boost to apply t...
MapStringDouble boosts
Definition MultiFieldQueryParser.h:63
virtual QueryPtr getWildcardQuery(const String &field, const String &termStr)
Factory method for generating a query. Called when parser parses an input term token that contains on...
static QueryPtr parse(LuceneVersion::Version matchVersion, Collection< String > queries, Collection< String > fields, const AnalyzerPtr &analyzer)
Parses a query which searches on the fields specified.
virtual QueryPtr getPrefixQuery(const String &field, const String &termStr)
Factory method for generating a query (similar to getWildcardQuery). Called when parser parses an inp...
virtual QueryPtr getFieldQuery(const String &field, const String &queryText)
Use the analyzer to get all the tokens, and then build a TermQuery, PhraseQuery, or nothing based on ...
MultiFieldQueryParser(LuceneVersion::Version matchVersion, Collection< String > fields, const AnalyzerPtr &analyzer)
Creates a MultiFieldQueryParser. It will, when parse(String query) is called, construct a query like ...
static QueryPtr parse(LuceneVersion::Version matchVersion, const String &query, Collection< String > fields, Collection< BooleanClause::Occur > flags, const AnalyzerPtr &analyzer)
Parses a query, searching on the fields specified. Use this if you need to specify certain fields as ...
virtual QueryPtr getFuzzyQuery(const String &field, const String &termStr, double minSimilarity)
Factory method for generating a query (similar to getWildcardQuery). Called when parser parses an inp...
virtual QueryPtr getRangeQuery(const String &field, const String &part1, const String &part2, bool inclusive)
Builds a new TermRangeQuery instance for given min/max parts.
The most important method is parse(const String&).
Definition QueryParser.h:70
Definition AbstractAllTermDocs.h:12
boost::shared_ptr< Query > QueryPtr
Definition LuceneTypes.h:420
boost::shared_ptr< Analyzer > AnalyzerPtr
Definition LuceneTypes.h:20

clucene.sourceforge.net