Hybris 5.2
I was doing some analysis to exclude Facet Value from the Solr Search so that those products will not come in the search result.
Suppose I have lots of Color T-Shirts (Don't know how many colors) and someone told me to not show Red color T-Shirts in the search result.
There are two options which I can think
Option 1 : I have to get all the T-Shirt's colors available in the System then add a Filter in Solr Result
For Example
List<String> colorList = getAllColorsExceptRed(); //Get all colors except red
for(String color : colorList) {
searchQuery.addFacetValue("color", color);
}
This will add a filter of color SolrIndexedProperty and will solve the problem.
But I am not curious to pickup this approach.
Option 2 : Exclude Red Color property from Solr Search result rather than applying filter on all the colors.
Solr Query would be like this ..
q= *:* AND -color_string:red
//in case of multiple color exclude
q= *:* AND -color_string: (red white)
This will exclude red T-Shirt from the result. But I am not able to find which Service or Method I should choose to make a query like this.
Can anybody know how to achieve this Query (q= *:* AND -color_string:red)
with service/method/searchQuery in Hybris ?