Boost Prefix Text Query

Hi,

Any Ideas on how I can boost a field in a TextQuery, in a similar way
to a QueryStringQuery (I'm currently on 16.2):

e.g.

QueryString

QueryStringQueryBuilder queryString = new
QueryStringQueryBuilder(query);
queryString.useDisMax(false);
queryString.defaultOperator(QueryStringQueryBuilder.Operator.AND);
queryString.allowLeadingWildcard(true);
for (SearchFieldAndBoost fieldAndBoost: this.searchFieldsAndBoostSet){
queryString.field(fieldAndBoost.getSearchField(),
fieldAndBoost.getBoost());
}

TextQuery - ideally the constructor would also take a boost parameter

for (SearchFieldAndBoost fieldAndBoost: this.searchFieldsAndBoostSet){
TextQueryBuilder textQuery = new
TextQueryBuilder(fieldAndBoost.getSearchField(),
startsWithSearchTerm);
textQuery.type(TextQueryBuilder.Type.PHRASE_PREFIX);
boolQueryBuilder.should(textQuery);
}

Best Regards,

David.

Actually, just noticed that ther is a boost method, so that's fine.
thanks.

On Jul 27, 1:15 pm, davrob2 davirobe...@gmail.com wrote:

Hi,

Any Ideas on how I can boost a field in a TextQuery, in a similar way
to a QueryStringQuery (I'm currently on 16.2):

e.g.

QueryString

QueryStringQueryBuilder queryString = new
QueryStringQueryBuilder(query);
queryString.useDisMax(false);
queryString.defaultOperator(QueryStringQueryBuilder.Operator.AND);
queryString.allowLeadingWildcard(true);
for (SearchFieldAndBoost fieldAndBoost: this.searchFieldsAndBoostSet){
queryString.field(fieldAndBoost.getSearchField(),
fieldAndBoost.getBoost());

}

TextQuery - ideally the constructor would also take a boost parameter

for (SearchFieldAndBoost fieldAndBoost: this.searchFieldsAndBoostSet){
TextQueryBuilder textQuery = new
TextQueryBuilder(fieldAndBoost.getSearchField(),
startsWithSearchTerm);
textQuery.type(TextQueryBuilder.Type.PHRASE_PREFIX);
boolQueryBuilder.should(textQuery);

}

Best Regards,

David.