I want to apply negative boosting to items, based on the value of an indexed checkbox field in order to move those items to the bottom of the search results. I am applying (positive) boosting to other fields as well which precludes me from simply ordering my results by the discontinued
field.
I am indexing the checkbox field as a string, as I believe this may be necessary in order to use boosting on this indexing field. I'm not certain of this though.
My method for adding negative boost predicates is below:
private IQueryable<IndexedItem> AddUnboostingPredicates(IQueryable<IndexedItem> queryable)
{
return queryable.Where(item => item["discontinued"].Equals("1").Boost(-1000)
|| item["discontinued"].Equals("0"));
}
This code results in the error message
{"error":{"code":"","message":"Failed to parse query string at line 1, column 70. See https://aka.ms/azure-search-full-query for supported syntax."}}
Looking at search.log file I believe this is the offending part of the query expression sent to Azure:
(product_discontinued:(1)^-1000 OR product_discontinued:(0))