Resolving Issues with 'React-InstantSearch'
TLDR robert was having trouble merging results from different collections using react-instantsearch
and was facing issues with undefined highlight results. After much discussion, Jason provided a solution using collectionSpecificSearchParameters
and highlight_full_fields
to solve the problem.
3
Aug 03, 2022 (15 months ago)
robert
09:24 PMreact-instantsearch
? I have two collections that I would like to combine results for. They have different fields in each collection though. Do I need to do some kind of overriding of the react-instantsearch-hooks-web
to support federated multisearch? Any ideas on where I would want to inject in this call?I see support for this was built into the typesense react instant search adapter but I don't see any documentation on how to make a federated search possible. Is there documentation I can look at or could someone perhaps point me in the right direction?
robert
09:33 PMhttps://github.com/typesense/typesense-instantsearch-adapter/issues/38#issuecomment-823752445
robert
09:39 PM // Search parameters that are common to all collections/indices go here:
additionalSearchParameters: {
query_by: "",
},
// Search parameters that need to be *overridden* on a per-collection-basis go here:
collectionSpecificSearchParameters: {
snippets: {
query_by: "answer,name",
query_by_weights: "2,1",
},
searchable: {
query_by: "text,context",
query_by_weights: "2,1",
},
},
Now I'm working out some of the kinks in having multiple
Index
within the InstantSearch
robert
09:47 PMrobert
09:48 PMJason
10:21 PMcollectionSpecificSearchParameters
is the way to go.The undefined behavior sounds strange. Could you try using the latest version of the instantsearch adapter and at least Typesense 0.23.1 to see if you can replicate the issue?
Jason
10:21 PMrobert
10:59 PMJason
11:01 PMrobert
11:01 PM1
Jason
11:05 PMJason
11:05 PMrobert
11:15 PMJason
11:23 PMrobert
11:32 PMJason
11:39 PMrobert
11:41 PM1
robert
11:42 PM1
Jason
11:49 PM<Highlight />
component. By default Typesense snippets results. So when you use <Highlight />
, the field it’s looking for doesn’t exist in the Typesense response and it displays as undefined.If you add a param called
highlight_full_fields
like below, you should then start seeing the highlights instead of undefined.collectionSpecificSearchParameters: {
snippets: {
query_by: "answer,name",
query_by_weights: "2,1",
highlight_full_fields: "answer,name",
},
searchable: {
query_by: "text,context",
query_by_weights: "2,1",
highlight_full_fields: "text,context",
}
}
robert
11:50 PMJason
11:51 PMrobert
11:52 PMrobert
11:52 PMquery_by
setup highlight full fields is set?Jason
11:52 PMJason
11:52 PMJason
11:58 PMI just double-checked the adapter code. We don’t set a default for highlight full fields
robert
11:59 PMquery_by
). strange edge caseAug 04, 2022 (15 months ago)
Jason
12:00 AM<Snippet />
will work by default, since Typesense snippets all query_by fields without additional configurationTypesense
Indexed 2779 threads (79% resolved)
Similar Threads
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.
Phrase Search Relevancy and Weights Fix
Jan reported an issue with phrase search relevancy using Typesense Instantsearch Adapter. The problem occurred when searching phrases with double quotes. The team identified the issue to be related to weights and implemented a fix, improving the search results.
Implementing State Export Feature Using Typesense InstantSearch.js on Node.js Backend
Kyle needed help passing search state to backend for implementing an "Export" feature, while using Typesense InstantSearch. Jason provided multiple solutions including advice on using Typesense InstantSearch adapter. The issue was resolved after some iteration.
Troubleshooting Typesense Setup and Understanding Facets and Keywords
Demitri encountered errors when exploring Typesense for the first time. Jason guided them through troubleshooting and discussed facets, keyword settings, and widget configurations. Helin shared a Python demo app and its source code to help Demitri with their project.
Typesense Capabilities and Troubleshooting Queries
A had issues with refinement lists and analytics in Typesense. Jason provided a possible solution and recommended the analytics widget. They clarified import size limits and helped identify a filter issue in A's query. Upgrade options are in Typesense's roadmap.