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


Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes
Lucene::MultiFieldQueryParser Class Reference

A QueryParser which constructs queries to search multiple fields. More...

#include <MultiFieldQueryParser.h>

+ Inheritance diagram for Lucene::MultiFieldQueryParser:

Public Member Functions

 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 to each term.
 
 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 this (assuming the query consists of two terms and you specify the two fields title and body):
 
virtual ~MultiFieldQueryParser ()
 
virtual String getClassName ()
 
boost::shared_ptr< MultiFieldQueryParsershared_from_this ()
 
QueryPtr parse (const String &query)
 Parses a query string, returning a Query.
 
- Public Member Functions inherited from Lucene::QueryParser
 QueryParser (LuceneVersion::Version matchVersion, const String &field, const AnalyzerPtr &analyzer)
 Constructs a query parser.
 
 QueryParser (const QueryParserCharStreamPtr &stream)
 Constructor with user supplied QueryParserCharStream.
 
 QueryParser (const QueryParserTokenManagerPtr &tokenMgr)
 Constructor with generated Token Manager.
 
virtual ~QueryParser ()
 
boost::shared_ptr< QueryParsershared_from_this ()
 
QueryPtr parse (const String &query)
 Parses a query string, returning a Query.
 
AnalyzerPtr getAnalyzer ()
 
String getField ()
 
double getFuzzyMinSim ()
 Get the minimal similarity for fuzzy queries.
 
void setFuzzyMinSim (double fuzzyMinSim)
 Set the minimum similarity for fuzzy queries. Default is 0.5.
 
int32_t getFuzzyPrefixLength ()
 Get the prefix length for fuzzy queries.
 
void setFuzzyPrefixLength (int32_t fuzzyPrefixLength)
 Set the prefix length for fuzzy queries. Default is 0.
 
void setPhraseSlop (int32_t phraseSlop)
 Sets the default slop for phrases. If zero, then exact phrase matches are required. Default value is zero.
 
int32_t getPhraseSlop ()
 Gets the default slop for phrases.
 
void setAllowLeadingWildcard (bool allowLeadingWildcard)
 Set to true to allow leading wildcard characters.
 
bool getAllowLeadingWildcard ()
 
void setEnablePositionIncrements (bool enable)
 Set to true to enable position increments in result query.
 
bool getEnablePositionIncrements ()
 
void setDefaultOperator (Operator op)
 Sets the boolean operator of the QueryParser. In default mode (OR_OPERATOR) terms without any modifiers are considered optional: for example capital of Hungary is equal to capital OR of OR Hungary. In AND_OPERATOR mode terms are considered to be in conjunction: the above mentioned query is parsed as capital AND of AND Hungary.
 
Operator getDefaultOperator ()
 Gets implicit operator setting, which will be either AND_OPERATOR or OR_OPERATOR.
 
void setLowercaseExpandedTerms (bool lowercaseExpandedTerms)
 Whether terms of wildcard, prefix, fuzzy and range queries are to be automatically lower-cased or not. Default is true.
 
bool getLowercaseExpandedTerms ()
 
void setMultiTermRewriteMethod (const RewriteMethodPtr &method)
 By default QueryParser uses MultiTermQuery#CONSTANT_SCORE_AUTO_REWRITE_DEFAULT when creating a PrefixQuery, WildcardQuery or RangeQuery. This implementation is generally preferable because it a) Runs faster b) Does not have the scarcity of terms unduly influence score c) avoids any "TooManyClauses" exception. However, if your application really needs to use the old- fashioned BooleanQuery expansion rewriting and the above points are not relevant then use this to change the rewrite method.
 
RewriteMethodPtr getMultiTermRewriteMethod ()
 
void setLocale (std::locale locale)
 Set locale used by date range parsing.
 
std::locale getLocale ()
 Returns current locale, allowing access by subclasses.
 
void setDateResolution (DateTools::Resolution dateResolution)
 Sets the default date resolution used by RangeQueries for fields for which no specific date resolutions has been set. Field specific resolutions can be set with setDateResolution(const String&, DateTools::Resolution).
 
void setDateResolution (const String &fieldName, DateTools::Resolution dateResolution)
 Sets the date resolution used by RangeQueries for a specific field.
 
DateTools::Resolution getDateResolution (const String &fieldName)
 Returns the date resolution that is used by RangeQueries for the given field. Returns null, if no default or field specific date resolution has been set for the given field.
 
void setRangeCollator (const CollatorPtr &rc)
 Sets the collator used to determine index term inclusion in ranges for RangeQuerys.
 
CollatorPtr getRangeCollator ()
 
int32_t Conjunction ()
 Query ::= ( Clause )* Clause ::= ["+", "-"] [ ":"] ( | "(" Query ")" )
 
int32_t Modifiers ()
 
virtual QueryPtr TopLevelQuery (const String &field)
 This makes sure that there is no garbage after the query string.
 
virtual QueryPtr ParseQuery (const String &field)
 
virtual QueryPtr ParseClause (const String &field)
 
virtual QueryPtr ParseTerm (const String &field)
 
virtual void ReInit (const QueryParserCharStreamPtr &stream)
 Reinitialise.
 
virtual void ReInit (const QueryParserTokenManagerPtr &tokenMgr)
 Reinitialise.
 
virtual QueryParserTokenPtr getNextToken ()
 Get the next Token.
 
virtual QueryParserTokenPtr getToken (int32_t index)
 Get the specific Token.
 
virtual void generateParseException ()
 Generate QueryParserError exception.
 
virtual void enable_tracing ()
 Enable tracing.
 
virtual void disable_tracing ()
 Disable tracing.
 
- Public Member Functions inherited from Lucene::QueryParserConstants
virtual ~QueryParserConstants ()
 
- Public Member Functions inherited from Lucene::LuceneObject
virtual ~LuceneObject ()
 
virtual void initialize ()
 Called directly after instantiation to create objects that depend on this object being fully constructed.
 
virtual LuceneObjectPtr clone (const LuceneObjectPtr &other=LuceneObjectPtr())
 Return clone of this object.
 
virtual int32_t hashCode ()
 Return hash code for this object.
 
virtual bool equals (const LuceneObjectPtr &other)
 Return whether two objects are equal.
 
virtual int32_t compareTo (const LuceneObjectPtr &other)
 Compare two objects.
 
virtual String toString ()
 Returns a string representation of the object.
 
- Public Member Functions inherited from Lucene::LuceneSync
virtual ~LuceneSync ()
 
virtual SynchronizePtr getSync ()
 Return this object synchronize lock.
 
virtual LuceneSignalPtr getSignal ()
 Return this object signal.
 
virtual void lock (int32_t timeout=0)
 Lock this object using an optional timeout.
 
virtual void unlock ()
 Unlock this object.
 
virtual bool holdsLock ()
 Returns true if this object is currently locked by current thread.
 
virtual void wait (int32_t timeout=0)
 Wait for signal using an optional timeout.
 
virtual void notifyAll ()
 Notify all threads waiting for signal.
 

Static Public Member Functions

static String _getClassName ()
 
static QueryPtr parse (LuceneVersion::Version matchVersion, Collection< String > queries, Collection< String > fields, const AnalyzerPtr &analyzer)
 Parses a query which searches on the fields specified.
 
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 required, and others as prohibited.
 
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 required, and others as prohibited.
 
- Static Public Member Functions inherited from Lucene::QueryParser
static String _getClassName ()
 
static int main (Collection< String > args)
 Command line tool to test QueryParser, using SimpleAnalyzer.
 
- Static Public Member Functions inherited from Lucene::QueryParserConstants
static String _getClassName ()
 

Protected Member Functions

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 overridden, for example, to return a SpanNearQuery instead of a PhraseQuery.
 
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 the term count.
 
void applySlop (const QueryPtr &query, int32_t slop)
 
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 input term token that has the fuzzy suffix (~) appended.
 
virtual QueryPtr getPrefixQuery (const String &field, const String &termStr)
 Factory method for generating a query (similar to getWildcardQuery). Called when parser parses an input term token that uses prefix notation; that is, contains a single '*' wildcard character as its last character. Since this is a special case of generic wildcard term, and such a query can be optimized easily, this usually results in a different query object.
 
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 one or more wildcard characters (? and *), but is not a prefix term token (one that has just a single * character at the end)
 
virtual QueryPtr getRangeQuery (const String &field, const String &part1, const String &part2, bool inclusive)
 Builds a new TermRangeQuery instance for given min/max parts.
 
- Protected Member Functions inherited from Lucene::QueryParser
void ConstructParser (const QueryParserCharStreamPtr &stream, const QueryParserTokenManagerPtr &tokenMgr)
 Construct query parser with supplied QueryParserCharStream or TokenManager.
 
virtual void addClause (Collection< BooleanClausePtr > clauses, int32_t conj, int32_t mods, const QueryPtr &q)
 
BooleanQueryPtr newBooleanQuery (bool disableCoord)
 Builds a new BooleanQuery instance.
 
BooleanClausePtr newBooleanClause (const QueryPtr &q, BooleanClause::Occur occur)
 Builds a new BooleanClause instance.
 
QueryPtr newTermQuery (const TermPtr &term)
 Builds a new TermQuery instance.
 
PhraseQueryPtr newPhraseQuery ()
 Builds a new PhraseQuery instance.
 
MultiPhraseQueryPtr newMultiPhraseQuery ()
 Builds a new MultiPhraseQuery instance.
 
QueryPtr newPrefixQuery (const TermPtr &prefix)
 Builds a new PrefixQuery instance.
 
QueryPtr newFuzzyQuery (const TermPtr &term, double minimumSimilarity, int32_t prefixLength)
 Builds a new FuzzyQuery instance.
 
QueryPtr newRangeQuery (const String &field, const String &part1, const String &part2, bool inclusive)
 Builds a new TermRangeQuery instance.
 
QueryPtr newMatchAllDocsQuery ()
 Builds a new MatchAllDocsQuery instance.
 
QueryPtr newWildcardQuery (const TermPtr &term)
 Builds a new WildcardQuery instance.
 
virtual QueryPtr getBooleanQuery (Collection< BooleanClausePtr > clauses)
 Factory method for generating query, given a set of clauses. By default creates a boolean query composed of clauses passed in.
 
virtual QueryPtr getBooleanQuery (Collection< BooleanClausePtr > clauses, bool disableCoord)
 Factory method for generating query, given a set of clauses. By default creates a boolean query composed of clauses passed in.
 
String discardEscapeChar (const String &input)
 Returns a String where the escape char has been removed, or kept only once if there was a double escape. Supports escaped unicode characters, eg. translates \u0041 to A.
 
bool jj_2_1 (int32_t xla)
 
bool jj_3R_2 ()
 
bool jj_3_1 ()
 
bool jj_3R_3 ()
 
QueryParserTokenPtr jj_consume_token (int32_t kind)
 
bool jj_scan_token (int32_t kind)
 
int32_t jj_ntk ()
 
void jj_add_error_token (int32_t kind, int32_t pos)
 
void jj_rescan_token ()
 
void jj_save (int32_t index, int32_t xla)
 
- Protected Member Functions inherited from Lucene::QueryParserConstants
 QueryParserConstants ()
 
- Protected Member Functions inherited from Lucene::LuceneObject
 LuceneObject ()
 

Protected Attributes

Collection< String > fields
 
MapStringDouble boosts
 
- Protected Attributes inherited from Lucene::QueryParser
Operator _operator
 The actual operator that parser uses to combine query terms.
 
int32_t _jj_ntk
 Next token.
 
QueryParserTokenPtr jj_scanpos
 
QueryParserTokenPtr jj_lastpos
 
int32_t jj_la
 
int32_t jj_gen
 
Collection< int32_t > jj_la1
 
Collection< JJCallsPtrjj_2_rtns
 
bool jj_rescan
 
int32_t jj_gc
 
Collection< Collection< int32_t > > jj_expentries
 
Collection< int32_t > jj_expentry
 
int32_t jj_kind
 
Collection< int32_t > jj_lasttokens
 
int32_t jj_endpos
 
- Protected Attributes inherited from Lucene::LuceneSync
SynchronizePtr objectLock
 
LuceneSignalPtr objectSignal
 

Additional Inherited Members

- Public Types inherited from Lucene::QueryParser
enum  Operator { OR_OPERATOR , AND_OPERATOR }
 The default operator for parsing queries. Use QueryParser#setDefaultOperator to change it. More...
 
- Public Types inherited from Lucene::QueryParserConstants
enum  RegularExpressionId {
  _EOF = 0 , _NUM_CHAR = 1 , _ESCAPED_CHAR = 2 , _TERM_START_CHAR = 3 ,
  _TERM_CHAR = 4 , _WHITESPACE = 5 , _QUOTED_CHAR = 6 , AND = 8 ,
  OR = 9 , NOT = 10 , PLUS = 11 , MINUS = 12 ,
  LPAREN = 13 , RPAREN = 14 , COLON = 15 , STAR = 16 ,
  CARAT = 17 , QUOTED = 18 , TERM = 19 , FUZZY_SLOP = 20 ,
  PREFIXTERM = 21 , WILDTERM = 22 , RANGEIN_START = 23 , RANGEEX_START = 24 ,
  NUMBER = 25 , RANGEIN_TO = 26 , RANGEIN_END = 27 , RANGEIN_QUOTED = 28 ,
  RANGEIN_GOOP = 29 , RANGEEX_TO = 30 , RANGEEX_END = 31 , RANGEEX_QUOTED = 32 ,
  RANGEEX_GOOP = 33
}
 
enum  LexicalState { Boost = 0 , RangeEx = 1 , RangeIn = 2 , DEFAULT = 3 }
 
- Data Fields inherited from Lucene::QueryParser
bool lowercaseExpandedTerms
 
RewriteMethodPtr multiTermRewriteMethod
 
bool allowLeadingWildcard
 
bool enablePositionIncrements
 
AnalyzerPtr analyzer
 
String field
 
int32_t phraseSlop
 
double fuzzyMinSim
 
int32_t fuzzyPrefixLength
 
std::locale locale
 
DateTools::Resolution dateResolution
 
MapStringResolution fieldToDateResolution
 
CollatorPtr rangeCollator
 
QueryParserTokenManagerPtr token_source
 Generated Token Manager.
 
QueryParserTokenPtr token
 Current token.
 
QueryParserTokenPtr jj_nt
 Next token.
 
- Static Public Attributes inherited from Lucene::QueryParserConstants
static Collection< String > tokenImage
 Literal token values.
 
- Protected Types inherited from Lucene::QueryParser
typedef boost::shared_ptr< JJCallsJJCallsPtr
 
- Static Protected Member Functions inherited from Lucene::QueryParser
static int32_t hexToInt (wchar_t c)
 Returns the numeric value of the hexadecimal character.
 
static String escape (const String &s)
 Returns a String where those characters that QueryParser expects to be escaped are escaped by a preceding .
 
- Static Protected Attributes inherited from Lucene::QueryParser
static const int32_t CONJ_NONE
 
static const int32_t CONJ_AND
 
static const int32_t CONJ_OR
 
static const int32_t MOD_NONE
 
static const int32_t MOD_NOT
 
static const int32_t MOD_REQ
 
static const int32_t jj_la1_0 []
 
static const int32_t jj_la1_1 []
 
- Static Protected Attributes inherited from Lucene::QueryParserConstants
static const wchar_t * _tokenImage []
 Literal token values.
 

Detailed Description

A QueryParser which constructs queries to search multiple fields.

Constructor & Destructor Documentation

◆ MultiFieldQueryParser() [1/2]

Lucene::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 to each term.

It will, when parse(String query) is called, construct a query like this (assuming the query consists of two terms and you specify the two fields title and body):

(title:term1 body:term1) (title:term2 body:term2)

When setDefaultOperator(AND_OPERATOR) is set, the result will be:

+(title:term1 body:term1) +(title:term2 body:term2)

When you pass a boost (title=>5 body=>10) you can get:

+(title:term1^5.0 body:term1^10.0) +(title:term2^5.0 body:term2^10.0)

In other words, all the query's terms must appear, but it doesn't matter in what fields they appear.

◆ MultiFieldQueryParser() [2/2]

Lucene::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 this (assuming the query consists of two terms and you specify the two fields title and body):

(title:term1 body:term1) (title:term2 body:term2)

When setDefaultOperator(AND_OPERATOR) is set, the result will be:

+(title:term1 body:term1) +(title:term2 body:term2)

In other words, all the query's terms must appear, but it doesn't matter in what fields they appear.

◆ ~MultiFieldQueryParser()

virtual Lucene::MultiFieldQueryParser::~MultiFieldQueryParser ( )
virtual

Member Function Documentation

◆ _getClassName()

static String Lucene::MultiFieldQueryParser::_getClassName ( )
inlinestatic

◆ applySlop()

void Lucene::MultiFieldQueryParser::applySlop ( const QueryPtr query,
int32_t  slop 
)
protected

◆ getClassName()

virtual String Lucene::MultiFieldQueryParser::getClassName ( )
inlinevirtual

Reimplemented from Lucene::QueryParser.

◆ getFieldQuery() [1/2]

virtual QueryPtr Lucene::MultiFieldQueryParser::getFieldQuery ( const String &  field,
const String &  queryText 
)
protectedvirtual

Use the analyzer to get all the tokens, and then build a TermQuery, PhraseQuery, or nothing based on the term count.

Reimplemented from Lucene::QueryParser.

◆ getFieldQuery() [2/2]

virtual QueryPtr Lucene::MultiFieldQueryParser::getFieldQuery ( const String &  field,
const String &  queryText,
int32_t  slop 
)
protectedvirtual

Base implementation delegates to getFieldQuery(const String&, const String&). This method may be overridden, for example, to return a SpanNearQuery instead of a PhraseQuery.

Reimplemented from Lucene::QueryParser.

◆ getFuzzyQuery()

virtual QueryPtr Lucene::MultiFieldQueryParser::getFuzzyQuery ( const String &  field,
const String &  termStr,
double  minSimilarity 
)
protectedvirtual

Factory method for generating a query (similar to getWildcardQuery). Called when parser parses an input term token that has the fuzzy suffix (~) appended.

Parameters
fieldName of the field query will use.
termStrTerm token to use for building term for the query
Returns
Resulting Query built for the term

Reimplemented from Lucene::QueryParser.

◆ getPrefixQuery()

virtual QueryPtr Lucene::MultiFieldQueryParser::getPrefixQuery ( const String &  field,
const String &  termStr 
)
protectedvirtual

Factory method for generating a query (similar to getWildcardQuery). Called when parser parses an input term token that uses prefix notation; that is, contains a single '*' wildcard character as its last character. Since this is a special case of generic wildcard term, and such a query can be optimized easily, this usually results in a different query object.

Depending on settings, a prefix term may be lower-cased automatically. It will not go through the default Analyzer, however, since normal Analyzers are unlikely to work properly with wildcard templates.

Can be overridden by extending classes, to provide custom handling for wild card queries, which may be necessary due to missing analyzer calls.

Parameters
fieldName of the field query will use.
termStrTerm token to use for building term for the query (without trailing '*' character)
Returns
Resulting Query built for the term

Reimplemented from Lucene::QueryParser.

◆ getRangeQuery()

virtual QueryPtr Lucene::MultiFieldQueryParser::getRangeQuery ( const String &  field,
const String &  part1,
const String &  part2,
bool  inclusive 
)
protectedvirtual

Builds a new TermRangeQuery instance for given min/max parts.

Reimplemented from Lucene::QueryParser.

◆ getWildcardQuery()

virtual QueryPtr Lucene::MultiFieldQueryParser::getWildcardQuery ( const String &  field,
const String &  termStr 
)
protectedvirtual

Factory method for generating a query. Called when parser parses an input term token that contains one or more wildcard characters (? and *), but is not a prefix term token (one that has just a single * character at the end)

Depending on settings, prefix term may be lower-cased automatically. It will not go through the default Analyzer, however, since normal Analyzers are unlikely to work properly with wildcard templates.

Can be overridden by extending classes, to provide custom handling for wildcard queries, which may be necessary due to missing analyzer calls.

Parameters
fieldName of the field query will use.
termStrTerm token that contains one or more wild card characters (? or *), but is not simple prefix term
Returns
Resulting Query built for the term

Reimplemented from Lucene::QueryParser.

◆ parse() [1/4]

QueryPtr Lucene::QueryParser::parse ( const String &  query)

Parses a query string, returning a Query.

Parameters
queryThe query string to be parsed.

◆ parse() [2/4]

static QueryPtr Lucene::MultiFieldQueryParser::parse ( LuceneVersion::Version  matchVersion,
Collection< String >  queries,
Collection< String >  fields,
Collection< BooleanClause::Occur flags,
const AnalyzerPtr analyzer 
)
static

Parses a query, searching on the fields specified. Use this if you need to specify certain fields as required, and others as prohibited.

Usage:
Collection<String> query = newCollection<String>(L"query1", L"query2", L"query3");
Collection<String> fields = newCollection<String>(L"filename", L"contents", L"description");
Collection<BooleanClause::Occur> flags = newCollection<BooleanClause::Occur>(BooleanClause::SHOULD, BooleanClause::MUST, BooleanClause::MUST_NOT);
MultiFieldQueryParser::parse(query, fields, flags, analyzer);

The code above would construct a query:

(filename:query1) +(contents:query2) -(description:query3)
Parameters
matchVersionLucene version to match; this is passed through to QueryParser.
queriesQueries string to parse
fieldsFields to search on
flagsFlags describing the fields
analyzerAnalyzer to use

◆ parse() [3/4]

static QueryPtr Lucene::MultiFieldQueryParser::parse ( LuceneVersion::Version  matchVersion,
Collection< String >  queries,
Collection< String >  fields,
const AnalyzerPtr analyzer 
)
static

Parses a query which searches on the fields specified.

If x fields are specified, this effectively constructs:

(field1:query1) (field2:query2) (field3:query3)...(fieldx:queryx)
Parameters
matchVersionLucene version to match; this is passed through to QueryParser.
queriesQueries strings to parse
fieldsFields to search on
analyzerAnalyzer to use

◆ parse() [4/4]

static QueryPtr Lucene::MultiFieldQueryParser::parse ( LuceneVersion::Version  matchVersion,
const String &  query,
Collection< String >  fields,
Collection< BooleanClause::Occur flags,
const AnalyzerPtr analyzer 
)
static

Parses a query, searching on the fields specified. Use this if you need to specify certain fields as required, and others as prohibited.

Usage:
Collection<String> fields = newCollection<String>(L"filename", L"contents", L"description");
Collection<BooleanClause::Occur> flags = newCollection<BooleanClause::Occur>(BooleanClause::SHOULD, BooleanClause::MUST, BooleanClause::MUST_NOT);
MultiFieldQueryParser::parse(L"query", fields, flags, analyzer);

The code above would construct a query:

(filename:query) +(contents:query) -(description:query)
Parameters
matchVersionLucene version to match; this is passed through to QueryParser.
queryQuery string to parse
fieldsFields to search on
flagsFlags describing the fields
analyzerAnalyzer to use

◆ shared_from_this()

boost::shared_ptr< MultiFieldQueryParser > Lucene::MultiFieldQueryParser::shared_from_this ( )
inline

Field Documentation

◆ boosts

MapStringDouble Lucene::MultiFieldQueryParser::boosts
protected

◆ fields

Collection<String> Lucene::MultiFieldQueryParser::fields
protected

The documentation for this class was generated from the following file:

clucene.sourceforge.net