Hi,

I want to clarify few things in search API sorts.

Is that possible to sort the search api result using "weight module" and "content type" ?

Which means I want sort by content by first (Ex: First list the page content type result and then story type ). Then I want to sort basis on weight (using weight module).

Kindly let me know your thoughts.

Thanks in advance.

Comments

Anonymous’s picture

Priority: Major » Normal

Just index both values in Search API. Did you try?

preethivv’s picture

Ok I will Check. Thank you for the information.

pol’s picture

Weight value is not available in search API.

I think we need to implement a hook to make it discoverable.

jason.fisher’s picture

I do this by using aggregate fields -- aggregating content type and date together gives me a single field I can use to display table groupings of type, with the newest at the top of each table.

However, aggregate fields does not let you specify the order of aggregation, and it's only luck if it works out in your favor.

I would recommend using Computed Fields to generate a single compound field ahead of time that you can index for sorting.

Anonymous’s picture

Issue summary: View changes
Status: Active » Closed (works as designed)

As designed.

jeroen dost’s picture

I have the same problem: not finding the weight in the list of fields to index, resulting in not being able to sort on weight in my search api result view. You say it works as designed, but how is it designed to being able to use the weight module for sorting search results?

Thanks in advance.