QueryBuilders.queryString(), more than one default field to search on


(Michel Conrad) #1

Hi,

When using a QueryStringQueryBuilder through
QueryBuilders.queryString, is it be possible to include more than one
default field to search on when using prefix fields?
My use case would be by default to search on two default fields and if
the user specfies a prefix field, to search on the field the user
specified.
I was wondering if there is a better solution to this problem than
patching the query before giving it to the QueryBuilder?

Best,
Michel


(Shay Banon) #2

Yep, check QueryStringQueryBuilder#field method. It allows to add a field, and a field with boost. You can also control if dis_max will be used using #useDisMax method.
On Thursday, March 31, 2011 at 11:43 AM, Michel Conrad wrote:

Hi,

When using a QueryStringQueryBuilder through
QueryBuilders.queryString, is it be possible to include more than one
default field to search on when using prefix fields?
My use case would be by default to search on two default fields and if
the user specfies a prefix field, to search on the field the user
specified.
I was wondering if there is a better solution to this problem than
patching the query before giving it to the QueryBuilder?

Best,
Michel


(system) #3