- Issue created by @bcizej
- First commit to issue fork.
- Status changed to Needs work
about 1 year ago 1:27pm 11 September 2023 Moved the facets logic to a submodule and using the
search_api_facets
option set by the facets module.But I don't understand this part
Generate facets based on facets configuration received in the search api query via facets api
since the same data is returned when correctly using facets attribute when searching. That data can then be passed into the query results and it will correctly format everything.
Figured out why this has to be done
Generate facets based on facets configuration received in the search api query via facets api
but this leads to a new problem, meilisearch facets can't be numerical.
So let's say you are indexing a field that is a reference to some other data (example created by), by default you will only index reference id (in example uid), this field will be numerical.
From documentation:
Meilisearch does not support facet search on numbers. Convert numeric facets to strings to make them searchable.
Internally, Meilisearch represents numbers as float64. This means they lack precision and can be represented in different ways, making it difficult to search facet values effectively.
That said if admins change field type to string for ids, it works fine. So maybe there should be some documentation that explains this to users.
- @admirlju opened merge request.
I misunderstood what @bcizej meant with this issue. He wanted like other backends to show all facet values even if the query and filter would result in zero hits, but the count next to it should show zero.
Sadly Meilisearch doesn't have a good way of getting facets in this way, so for now, there must be two requests to facets API, but I have made a feature request for them to add this option.
- Status changed to Needs review
about 1 year ago 8:20am 13 September 2023 Added tests to the submodule. While the solution is not perfect, I hope the feature requests get accepted and it can be simplified.
Removed QueryPreExecuteSubscriber because there was no need to update any query configurations for the module to work correctly.
- Status changed to Needs work
about 1 year ago 10:19am 14 September 2023 - Status changed to Needs review
about 1 year ago 11:33am 14 September 2023 Using dependency injection for the service instead of extending and some CS fixes. Ready for review.
- First commit to issue fork.
- 🇸🇮Slovenia DeaOm
The getting the config part was working only in the instance your server name was meilisearch, if you named it anything else, the config was empty and therefore an error was thrown as there was no backend_config which means the master key was set to null. Added a helper backend trait that basically gets the backend configuration to then set the meilisearch api with the backed configuration host and key.
I did add the facets under filter criteria of the search view and tested the functionality and it seems it's working correctly. I added a fulltext type to a title in search api, the facets are also set up to a field title. If there is no term in the search box, all the facets are shown with the results in the brackets (basically all need to have a number higher then 0). Then once I enter a search term in the search box, I again get all the facets, but this time the brackets number changes to the "result hits".
- Status changed to RTBC
about 1 year ago 7:22am 15 September 2023 Tested the changes and everything is passing Since I only added @throws tags to a few PHPdocs, I'll change the status to RTBC.
- Status changed to Needs work
about 1 year ago 10:12pm 22 September 2023 - Status changed to Needs review
about 1 year ago 8:53am 25 September 2023 -
bcizej →
committed d374ee41 on 2.x authored by
admirlju →
Issue #3386270 by admirlju, DeaOm, bcizej: Facets do not generate based...
-
bcizej →
committed d374ee41 on 2.x authored by
admirlju →
- Status changed to Fixed
about 1 year ago 12:18pm 30 September 2023 - 🇸🇮Slovenia bcizej
Merged, thanks. Any issues regarding facets can use the "Facets" option from "Component" dropdown.
Automatically closed - issue fixed for 2 weeks with no activity.