问题
Relationed to this post How to add Hybris Solr By for Boolean value
I need to add a kind of "nested filter": when I filter with my boolean atribute isNewProduct , inside this sort , I want to sort by relevance (number indexed property) for example :
I have this products:
Product A : isNewProduct = true , relevance = 100;
Product B : isNewProduct = false , relevance = 50;
Product C : isNewProduct = true , relevance = 300;
Product D : isNewProduct = false , relevance = 40;
When I filter by isNewProduct, the result must be :
Product C > Product A > Product B > Product D.
Is possible to make an ordenation inside another ordenation ?
回答1:
I hope you want the second field as a score. Try like this
INSERT_UPDATE SolrSortField ; sort(indexedType(identifier),code)[unique=true] ; fieldName[unique=true] ; ascending[unique=true]
; $solrIndexedType:isNewProduct ; isNewProduct ; true
; $solrIndexedType:isNewProduct ; score ; false
来源:https://stackoverflow.com/questions/57497641/how-to-sort-with-a-nested-filter-in-hybris-solr