#community-help

Handling Two Collections in One Filter Widget with React-InstantSearch

TLDR Lina wanted to handle two collections in one filter widget. Jason suggested that react-instantsearch doesn't support this and a custom widget might be needed.

Powered by Struct AI
8
9mo
Solved
Join the chat
Mar 01, 2023 (9 months ago)
Lina
Photo of md5-cdf7e647a15aa08c6347b75c2344d9fc
Lina
12:04 PM
Hi there! How are you doing? ๐Ÿ˜„
I've got a question. I need to handle 2 collections in 1 filter widget. Could you tell, is it possible?

So I have two collections with similar fields. For example:
collection_1 : id, category, status ...
collection_2 : id, category, status ...

Category may have different values. One of the possible values is General.

I need:
1. Show General option in the filter
2. When this option is selected, show General items from collection_1, but don't show General items from collection_2
Right now I came up with this solution: I'm displaying filters from collection_1, so the General option is visible there. But when I'm selecting this option, I receive hits from collection_2 with category = General as well. I need only hits with category = General from collection_1 :melting_face: Please help
Kishore Nallan
Photo of md5-4e872368b2b2668460205b409e95c2ea
Kishore Nallan
12:40 PM
Are you writing custom code using the JS client or using the instant search adapter?
Lina
Photo of md5-cdf7e647a15aa08c6347b75c2344d9fc
Lina
12:42 PM
Kishore Nallan
Photo of md5-4e872368b2b2668460205b409e95c2ea
Kishore Nallan
12:44 PM
Jason will be able to help with this later.
Lina
Photo of md5-cdf7e647a15aa08c6347b75c2344d9fc
Lina
12:45 PM
Thank you very much !
Jason
Photo of md5-8813087cccc512313602b6d9f9ece19f
Jason
05:18 PM
Lina I donโ€™t think react-instantsearch allows you to combine data from multiple collections in a single filter widget
05:18
Jason
05:18 PM
So you might have to build a custom widget
Lina
Photo of md5-cdf7e647a15aa08c6347b75c2344d9fc
Lina
05:21 PM
Ohh gotcha. This is actually what I thought. Thank you for confirming that! ๐Ÿ™

Typesense

Lightning-fast, open source search engine for everyone | Knowledge Base powered by Struct.AI

Indexed 3011 threads (79% resolved)

Join Our Community

Similar Threads

Resolving 'stores_count' field sorting issue in Schema

em1nos encountered an issue sorting the 'stores_count' field, which was due to a field disparity in multiple collections. Upon resolving that, a subsequent issue with instant search internally managing sorting came up, which Jason addressed by releasing an updated version of the adapter.

5

41
31mo
Solved

Combining ReactInstant Search Widgets with React Hook Form Version

Uma asks if they can combine ReactInstant Search widgets with React Hook Form version widgets. Jason suggests asking in the Instantsearch github repo, but suspects they'd need to switch all widgets to the hooks version.

6
6mo

Fixing Multiple Document Retrieval in Typesense

Phil needed an efficient way to retrieve multiple documents by id. Kishore Nallan proposed a solution available in a pre-release build. After some bug fixing regarding id matching by Jason and Kishore Nallan, Phil successfully tested the solution.

4

26
26mo
Solved

Typesense Products Filtering Issue with Mixed AND+OR Filtering

Dmytro faced issues in implementing mixed AND+OR filtering for product filtering on Typesense using `'typesense-instantsearch-adapter'` despite using several approaches and facets. Jason suggested increasing the number of facets fetched and trying a different server version but the issue remains.

8
18mo

Resolving Issue with Instantsearch Sort_by in React

Edward had a problem with sorting functionality in a React component using Algolia's InstantSearch. Jason recommended a potential solution for specifying index names which resolved the issue.

2

9
18mo
Solved