This message was deleted.
# community-help
s
This message was deleted.
j
max_facet_values
is controlled by the instantsearch widgets, so you want to use the
limit
and
showMoreLimit
props for
refinementList
to control this value via instantsearch
facet_by
is also overridden by Instantsearch... and I'm not sure how to best handle this, given that Algolia does not support changing the server-side sort order like we do in Typesense at runtime. Could you try setting
attribute: 'relevant_gdpr_articles(sort_by: _alpha:asc)'
in the
refinementList
prop?
facet_query_num_typos
is fine to place in
additionalSearchParameters
... I suspect it will start working once we figure the above out
j
Thanks for your reply! We have set
limit: 0
in the refinementList because we don’t want to show any facets before the user starts searching for facets. (we also see a performance improvement if we set
limit:0
Changing
limit
and adding
showMoreLimit
unfortunately won’t help us in this case. For your understanding/context: our refinementList filter contains all GDPR chapters, articles and sub-articles (e.g. Article 8, Article 8(1), Article 8(2) etc.). So that’s why we don’t want to show anything by default, need all facets to be ordered by alpha:asc (and not count). Setting this attribute didn’t do anything unfortunately
relevant_gdpr_articles(sort_by: _alpha:asc)
facet_query_num_typos
works 👍 but the alpha sort is what I’m looking for to make our use-case work.
j
Doesn't changing just
showMoreLimit
to
999
and setting
limit: 0
handle your use-case for max facet values?
@Jan Willem Hoogstraten In
v2.8.0-1
of typesense-instantsearch-adapter, I've added the ability to pass in options into facet_by. Here's how to use it: https://github.com/typesense/typesense-instantsearch-adapter#setting-facet_by-options
j
Thanks for this update.
I’ve updated the instantsearchadapter to
v2.8.0-1
and added this to the typesenseInstantsearchAdapter config:
Copy code
facetByOptions: {
        relevant_gdpr_articles: "(sort_by: _alpha:desc)",
    },
But when I use the facet search it doesn’t work and I see this error
Copy code
Error: 400 - Facet query refers to a facet field `relevant_gdpr_articles` that is not part of `facet_by` parameter.
Thanks for pointing me out to setting`showMoreLimit` to
999
that helped! But without the alpha sorting it’s still not usable for our users.
j
Could you share your collection schema and also the curl request for the network request that throws this error (minus API key)
j
Thanks for your reply, I’ve sent you the collection scheme via DM. The curl request as well.
j
Thank you, that was helpful This is most likely a bug on the Typesense Server side. Let me get back to you on this
It's indeed a Typesense server issue: https://github.com/typesense/typesense/issues/1342 If you want to subscribe to that GitHub issue, will keep you posted there
Turns out we fixed this bug a few hours ago! If you upgrade your cluster to
0.26.0.rc26
, you shouldn't see this error any more
🙌 1
j
Wauw! That is almost perfect, we can finally use this filter with sorted facets for our clients.
That really helps us out. The only flaw (in our case) is that it’s not sorting alphabetic AND numeric at the same time (sorry don’t know how to put this in words). Our facets are for example chapters: Article 1 Article 1(1) Article 1(2) Article 2 Article 2(1) Article 2(2) etc. But Typesense is currently sorting it like this (skipping Articles 2 till Article 9) Article 1 Article 1(1) Article 1(2) Article 11 Article 11(1) Article 11(2) Article 12 Article 12(1) Article 12(2) etc.
j
Ah right, when you alpha sort numbers inside of strings, this is expected.
You might have to add a numeric field to indicate sort order for each article and then sort by that field in the facets
j
Our use-case is now working/usable. This numeric order would be a detail
Thanks for this tip!
And for the fix
👍 1