Hi Everyone! I've a project where I've switched f...
# community-help
c
Hi Everyone! I've a project where I've switched from Algolia to Typesense and we are very happy! It's a great project and I want to thank you for creating it! I have more of a algorythmic/logical question regarding faceting that hopefully somebody can help with - At the moment we have let's say around 5 facet groups we let the Users choose from. What we would like to do is that when the user chooses a Facet from a group - all other facets in other Groups that do not share a record with the selected Facet should be disabled. Facets from the same group should be unaffected unless they are excluded from another groups selection. We have tried a solution where in per Facet Group that has a selection we doe a separate query and then combine the facet results - this works okayish, but the more groups we selected the more cases there are where a facet is shown as available to the user even though there are no records left containing that facet. As far as I can tell InstantSearch has this capability but I'm having trouble replicating the behaviour server side - as doing this client side with InstantSearch is not an option for us at the moment. Perhaps there is a a word describing this filter behavior that I can google but I cannot for the life of me find anything similar online. Any help would be appreciated!
k
Just to confirm that we are talking about the same thing: the behavior you are describing is implemented here, correct: https://books-search.typesense.org/?b%5Bquery%5D=Phoenix%20project When you click on a particular subject, the author facets change to only those present in the subject. That's what you are looking for, correct?
c
@Ketan Ishaan Yep that's it!
k
You can inspect the queries being sent in the network inspector and customize that to your use case. Or you can implement a prototype using Instantsearch.js on your dataset and replicate the exact queries via network inspector and port them to your backend.
All our demos are open source and available here: https://github.com/typesense
c
I Inspected the queries on an InstantSearch Demo from Algolia and I think I've figured out the actual querying part - combining/excluding the individual facet results after querying has been the part that's giving me troubles. I'll check out the Book Demo on Github and try to replicate the behavior - thank you!
k
Welcome, if you're unable to figure it out, will be happy to help if you can put together a small example that isn't working as you are expecting it to.
j
@Cristopher Hornsey The books demo uses standard instantsearch with the refinementList widget, and the behavior you describe is standard out of the box behavior. Here's exactly how it's configured: https://github.com/typesense/showcase-books-search/blob/cfa46e577adeb31af9f7204848b856b2026f343c/src/app.js#L267-L302
c
Thanks for the help everyone - doing everything server side was starting to get very messy. In the end we rewrote everything to use instantsearch.js - it does make everything a lot simpler and the Typesense Adapter works very well.
👍 1