Implementing State Export Feature Using Typesense InstantSearch.js on Node.js Backend
TLDR 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.
1
Aug 23, 2021 (29 months ago)
Kyle
08:13 PMadditionalSearchParameters
from TypesenseInstantsearchAdapter.configureation
and the search state from search.helper.state
.Checking if there's a canonical / easier way 🙂 the backend is in Node fwiw
Kyle
08:17 PMJason
10:53 PMSo if you're not using text-based queries and only filters, then that would work. Otherwise, you would have to use search endpoint on the backend as well.
Jason
10:54 PMIn fact, this is what the Typesense-Instantsearch adapter itself uses to send the search state to a Typesense backend
Jason
10:54 PMI think this should work... but let me know if you run into any issues with getting the adapter to work in a node environment.
Kyle
10:56 PM1
Sep 13, 2021 (28 months ago)
Kyle
09:30 PMsearch.getUiState
on the client and search.setUiState
on the server. But I couldn't figure out how to respond to a search request without setting an arbitrary timeout to wait for results (it's "instant" after all 🙂 )The Algolia docs were helpful but use their API client on the server vs. the InstantSearch lib. It seems the TS client and Algolia client are not compatible.
For my use case I need to run and process the results on the server vs. passing back to the client (similar to export with full query).
For now, my searches are fairly straightforward so I'm just going to translate the instant search format to something the TS client can use on the server
Jason
11:06 PM> so I'm just going to translate the instant search format to something the TS client can use on the server
This is what the InstantSearch adapter does, specifically this class: https://github.com/typesense/typesense-instantsearch-adapter/blob/0c9af2a2e0cec64b31bd5c3717f7289b5bbbe737/src/SearchRequestAdapter.js#L218
You might be able to use just that class, instead of the full adapter...
Sep 22, 2021 (28 months ago)
Kyle
07:38 PMadditionalSearchParameters
and collectionSpecificSearchParameters
in addition to the instantSearchRequest
but was able to get the format the TS server needs. Thank you! 🙏Jason
07:59 PMTypesense
Indexed 3005 threads (79% resolved)
Similar Threads
Typesense Sorting Query and Bug Report
michtio is new to Typesense and is querying sorting implementation. Jason shares resources and suggests use of specific adapters. However, michtio shares a bug found when applying a filter on Typesense. Jason asks for a GitHub issue to be opened for the bug.
Discussion on the Use of `TypesenseInstantSearchAdapter`
DavidLo sought advice to retrieve search results using `TypesenseInstantSearchAdapter`. Carl and Jason advised using `typesense-js` and features like `documents/export`, `documents/search`, `multisearch`, and pagination. The potential server-side solution and bundle size issues concerning the exposure of the search client were also discussed.
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.
Implementing Search Suggestion/Autocomplete Functionality in Typesense
Denis needed advice on implementing search suggestions in Typesense. Jason provided a solution for fetching after 3+ letters. However, questions on design pattern and passing hooks remain unanswered.
Resolving Issues with 'React-InstantSearch'
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.