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
13 namespace Lucene {
14
16 class LPPAPI MultiFieldQueryParser : public QueryParser {
17 public:
39 MultiFieldQueryParser(LuceneVersion::Version matchVersion, Collection<String> fields, const AnalyzerPtr& analyzer, MapStringDouble boosts);
40
55 MultiFieldQueryParser(LuceneVersion::Version matchVersion, Collection<String> fields, const AnalyzerPtr& analyzer);
56
57 virtual ~MultiFieldQueryParser();
58
59 LUCENE_CLASS(MultiFieldQueryParser);
60
61 protected:
62 Collection<String> fields;
63 MapStringDouble boosts;
64
65 public:
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
123 static QueryPtr parse(LuceneVersion::Version matchVersion, Collection<String> queries, Collection<String> fields, Collection<BooleanClause::Occur> flags, const AnalyzerPtr& analyzer);
124
125 protected:
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
BooleanClause.h
LUCENE_CLASS
#define LUCENE_CLASS(Name)
Definition LuceneObject.h:24
QueryParser.h
Lucene::Collection
Utility template class to handle collections that can be safely copied and shared.
Definition Collection.h:17
Lucene::LuceneVersion::Version
Version
Definition Constants.h:40
Lucene::MultiFieldQueryParser::parse
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 ...
Lucene::MultiFieldQueryParser::fields
Collection< String > fields
Definition MultiFieldQueryParser.h:62
Lucene::MultiFieldQueryParser::getFieldQuery
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...
Lucene::MultiFieldQueryParser::applySlop
void applySlop(const QueryPtr &query, int32_t slop)
Lucene::MultiFieldQueryParser::MultiFieldQueryParser
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...
Lucene::MultiFieldQueryParser::boosts
MapStringDouble boosts
Definition MultiFieldQueryParser.h:63
Lucene::MultiFieldQueryParser::getWildcardQuery
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...
Lucene::MultiFieldQueryParser::parse
static QueryPtr parse(LuceneVersion::Version matchVersion, Collection< String > queries, Collection< String > fields, const AnalyzerPtr &analyzer)
Parses a query which searches on the fields specified.
Lucene::MultiFieldQueryParser::getPrefixQuery
virtual QueryPtr getPrefixQuery(const String &field, const String &termStr)
Factory method for generating a query (similar to getWildcardQuery). Called when parser parses an inp...
Lucene::MultiFieldQueryParser::getFieldQuery
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 ...
Lucene::MultiFieldQueryParser::MultiFieldQueryParser
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 ...
Lucene::MultiFieldQueryParser::parse
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 ...
Lucene::MultiFieldQueryParser::getFuzzyQuery
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...
Lucene::MultiFieldQueryParser::~MultiFieldQueryParser
virtual ~MultiFieldQueryParser()
Lucene::MultiFieldQueryParser::getRangeQuery
virtual QueryPtr getRangeQuery(const String &field, const String &part1, const String &part2, bool inclusive)
Builds a new TermRangeQuery instance for given min/max parts.
Lucene::QueryParser::QueryParser
QueryParser(LuceneVersion::Version matchVersion, const String &field, const AnalyzerPtr &analyzer)
Constructs a query parser.
Lucene::QueryParser::analyzer
AnalyzerPtr analyzer
Definition QueryParser.h:146
Lucene::QueryParser::parse
QueryPtr parse(const String &query)
Parses a query string, returning a Query.
Lucene::QueryParser::field
String field
Definition QueryParser.h:147
Lucene
Definition AbstractAllTermDocs.h:12
Lucene::QueryPtr
boost::shared_ptr< Query > QueryPtr
Definition LuceneTypes.h:420
Lucene::AnalyzerPtr
boost::shared_ptr< Analyzer > AnalyzerPtr
Definition LuceneTypes.h:20

clucene.sourceforge.net