Is there a way to boost based on value of an index property in Hybris solr?

491 views Asked by At

We have a requirement wherein we need to make boosting for a field dynamic. Let's say that we have an indexed property foo, we need to perform a mathematical calculation on foo to determine its boost value which would be different for every product.

Is this doable in Hybris Solr?

Note: I'm using SAP CX 2105 and Solr 8.9.0 with Dismax Query Parse. And above requirement can be done in standalone Solr application as following.

@Resource
private SolrQuery solrQuery;

private void addBoosts()
{
    solrQuery.add("boost", "sub(20, sqrt(field(foo)))");
}

In Hybris, I have tried following

@Resource
private SearchQuery searchQuery;

private void addBoosts()
{
    searchQuery.addQuery("boost", "sub(20, sqrt(field(foo)))");
}

And also this

@Resource
private SearchQuery searchQuery;

private void addBoosts()
{
    searchQuery.addQuery("boost", "sub(20, sqrt(field(foo)))");
}

Both don't affect search order of the result.

0

There are 0 answers