Constructor MultiFieldQueryParser
MultiFieldQueryParser(LuceneVersion, String[], Analyzer, IDictionary<String, Single>)
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) 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 DefaultOperator is set to AND_OPERATOR, 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.
Declaration
public MultiFieldQueryParser(LuceneVersion matchVersion, string[] fields, Analyzer analyzer, IDictionary<string, float> boosts)
Parameters
Type | Name | Description |
---|---|---|
LuceneVersion | matchVersion | |
System.String[] | fields | |
Analyzer | analyzer | |
System.Collections.Generic.IDictionary<System.String, System.Single> | boosts |
MultiFieldQueryParser(LuceneVersion, String[], Analyzer)
Creates a MultiFieldQueryParser.
It will, when Parse(String) 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 DefaultOperator is set to AND_OPERATOR, 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.
Declaration
public MultiFieldQueryParser(LuceneVersion matchVersion, string[] fields, Analyzer analyzer)
Parameters
Type | Name | Description |
---|---|---|
LuceneVersion | matchVersion | |
System.String[] | fields | |
Analyzer | analyzer |