Algolia’s sort of numeric facet by alphabetical order is wrong
- memphdutchParticipant4 years, 5 months ago #19118
Hi,
I downloaded WP Solr yesterday, and it has been a great help. Thank you so much.
I am using it with Algolia. I have a site that has facets on the sidebar that let the user find parts of the Bible. The problem I am running into is the sorting of the attributes. In the link below, I want to:
1) put the books in biblical order (Genesis, Exodus, Leviticus).
2) put the chapters in numerical order. Right now it sorts 1, 10, 119, 13, 145.
Snapshot: https://www.dropbox.com/s/2y3clmh9uttlvme/Screen%20Shot%202020-04-02%20at%208.43.52%20AM.png?dl=0
I know Algolia restricts to ordering by alphabetical or by count. In their documentation for instantsearch.js they indicate that there is a way to specify order, but that doesn’t necessarily apply here. https://discourse.algolia.com/t/sorting-in-facets/7709
What are my options?
memphdutchParticipant4 years, 5 months ago #19120In the screenshot, book is sorted by frequency.
memphdutchParticipant4 years, 5 months ago #19121I was incorrect – “book” was sorted alphabetical correctly.
https://www.dropbox.com/s/ljr09kyg9q92aef/Screen%20Shot%202020-04-02%20at%209.39.00%20AM.png?dl=0
memphdutchParticipant4 years, 5 months ago #19123How would I make the sort in WPSOLR?
memphdutchParticipant4 years, 5 months ago #19127Thank you.
wpsolrKeymaster4 years, 5 months ago #19128Here is the fix:
https://www.dropbox.com/s/wl8ugtak0uvud3p/wpsolr-pro-fix-algolia-numeric-alpha-sort.zip?dl=01) Please deactivate the WPSOLR plugin, and remove it. Upload the new version with the fix, and activate it.
2) Please change to type “Integer” for your “Chapter” field in your screen 2.2 and reindex everything, if the type was a string.
The fix is detecting fields indexed with a numeric type in screen 2.2 (“Integer” for “Chapter”) with a facet with alphabetical sort. It then reorders the facet content correctly.
You must be logged in to reply to this topic.