-
Notifications
You must be signed in to change notification settings - Fork 60
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SortBy Index not listed/found #754
Comments
Hi @3Descape! Unfortunately, I have not been able to reproduce your issue. We are actually using the sortBy widget in the MoMA demo. You can check the code in the demos repo |
Hey ;) I created a quick barebone setup now and I still get the same behaviour. The component of intrest is in This is a laravel project. To run the project: copy the .env.example to .env Migrate mysql database(named "meilibug", change it in the .env if you want) (Optionally if you want to compile the js and scss): in the folder of the project: I hope I didn't miss a step ^^, if so, please let me know if there is anything I can help you with. Additional Resources for setup: |
Hi again @3Descape, Thank you for the example and the thorough step explanation. It was indeed my first time running a PHP project 🥳
|
Hi again @CaroFG I tested it now, but I think I slowly start to understand where the problem comes from.. So here is my observation: If I change the So my guess based on this is: if I set the the But in only finds
So no item with By setting the So I think the issue is, that So maybe let's reprase the question/my initial goal with this setup a little bit, because maybe I am just using it wrong and there is no bug after all: Thx for the support btw ;) |
I am really sorry for the late reply 🙏 Indeed, probably the sortBy widget starts working only when you click on it. So if you need your docs to be sorted on initialization, you probably did the right thing from the beginning: setting the index name to be equal to the sortBy value. |
Hey @3Descape ! Is this still an issue? |
@bidoubiwa not sure to be honest, since I refactored my application to a custom frontend |
Description
I've set up a search client with
<ais-instant-search index-name="customers">
and sorting with
<ais-sort-by :items="[{ label: 'Access', value: 'customers:accessed_at:desc' }]">
When loading the page I get the warning:
[InstantSearch.js]: The index named "customers" is not listed in the items of sortBy.
and the sorting doesn't work(the items appear in the default order).
Putting the
:items
into the vue data object also didn't help as suggested in e.g. algolia/vue-instantsearch#575However:
When setting the index name to be equal to the sortBy value:
<ais-instant-search index-name="customers:accessed_at:desc">
it works. E.g. the items are sorted and no warning(Side node: also the router now shows the sorting in the query param, as excpected).
Expected behavior
The user should not be required to specify the sorting attributes on the index-name attribute for sorting to work.
Screenshots or Logs
Index set to "customers". A warning and no sorting(e.g. Peter Schlager was accessed after Jana Karl2 but is listed lower)
Index set to "customers:accessed_at:desc" and the sorting works.
Environment (please complete the following information):
Used in laravel 9.10 with the package laravel/scout 9.4
The text was updated successfully, but these errors were encountered: