Closed (fixed)
Project:
Search API sorts
Version:
7.x-1.4
Component:
Miscellaneous
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
18 Feb 2013 at 17:32 UTC
Updated:
3 Sep 2016 at 19:24 UTC
Jump to comment: Most recent
Comments
Comment #1
luke_nuke commentedThe fact that one sort for price have "(Max)" and second "(Min)" at the end, has something to do with min and max values of price for multi value entity reference that is product? If so how can I create that kind of sorts for fields in objects under multi value entity references? (programatically at least)
Comment #2
Anonymous (not verified) commentedAre these multi-value fields? You can't sort multi-value fields. So you would need to add a field with a single value that you wish to sort by.
Comment #3
luke_nuke commentedSituation is like this:
Product Display has multi-value Product reference field, price is a field of Product, not Product Display, Product Display is indexed by Search API, and there is possibility of indexing Min and Max price from all possible products in Product reference field of Product Display. So the fields alone are not multi-value, but there is "multi-valuity" on the way. This has something to do with indexing and I'm wondering how is it possible to index other fields just the way price is, to be able to sort by them. I would gladly imitate the way the price was enabled in sorts, but I don't know where is a code for it. As I think about it now, it is more question about how to index fields of entities in multi-value field of reference, so If you think it would be better, I can post in in "search api" issues, but it is somehow related to sorts, and is important mainly for using sorts so my first thought was to ask here.
Comment #4
stijn.blomme commentedI had the exact same problem and fixed it by adding a 'sort price' property to my node entity.
This field contains the lowest price of the referenced products.
The sort price property can be indexed by search api and sorted by search api sorts.
Comment #5
Anonymous (not verified) commented#4 fixes the issue hopefully?
Comment #7
borisson_This can be fixed by adding the search_api_ranges module and enabling the filter 'Search API ranges' on the field you want to sort on.
Comment #8
pslcbs commented#4 works for me as @stijn.blomme said
Thanks a lot!!
Comment #9
interdruper commentedIf you build an aggregated field on the index using the UI, there is no need to add a custom property (#4) or install additional modules. Just go to 'Filters' tab, enable aggregated fields and add a new one of type 'Minimum' over the Price field ('amount').