cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Solr result

former_member630758
Discoverer
0 Likes
663

We have a new requirement that is not to show in the results of solr the products with price 0, we are not sure which is the best to solve it.

Thank you very much in advance.

Accepted Solutions (1)

Accepted Solutions (1)

aimprosoft
Participant

Hello, César.
Best way to achieve required result and make process configurable is to use FacetSearchListener
(detailed information can be found here: https://help.sap.com/viewer/d0224eca81e249cb821f2cdf45a82ace/1905/en-US/8c547232866910149b829fe3ca8e...)
For example:

@Override
public void beforeSearch(final FacetSearchContext facetSearchContext)
{
   .....
   final QueryField greaterThanQuery = new QueryField(MY_PRICE_FIELD, 
   SearchQuery.Operator.AND, SearchQuery.QueryOperator.GREATER_THAN, "0");
facetSearchContext.getSearchQuery().addFilterQuery(greaterThanQuery);
..... }
former_member630758
Discoverer
0 Likes

Hi Igor,

Works perfectly.

Thanks!

Answers (1)

Answers (1)

KarthikKomar
Participant
0 Likes

Thanks Igor. Very helpful.