Resolving Index Error with Typesense in InstantSearch
TLDR Jamshid experienced errors during a multi-index search using Typesense due to a discrepancy in indices. Jason fixed the issue by suggesting the use of ais-index
to avoid the error.
1
Jul 17, 2023 (2 months ago)
Jamshid
07:38 PM<ais-refinement-list attribute="countryofresidence" />
is not working in this situation. The reason is that I have countryofresidence
in my index 1 (collection 1) but not in my index 2. Is there a way make it that instantsearch ignores if index 2 doesn’t have that field or any other solutions?Jason
07:40 PMcollectionSpecificSearchParameters
config as described under this section: https://github.com/typesense/typesense-instantsearch-adapter#indexJamshid
07:43 PMcountryofresidence
in my index 1, but not in index 2. In this situation, the search returns error, saying countryofresidence
is not present in index 2.Jason
07:44 PMJamshid
07:47 PMconst typesenseInstantsearchAdapter = new TypesenseInstantSearchAdapter({
server: {
apiKey: import.meta.env.VITE_TYPESENSE_API_KEY, // Be sure to use an API key that only allows search operations
nodes: [
{
host: "x",
path: "", // Optional. Example: If you have your typesense mounted in localhost:8108/typesense, path should be equal to '/typesense'
port: "443",
protocol: "https",
},
],
cacheSearchResultsForSeconds: 2 * 60, // Cache search results from server. Defaults to 2 minutes. Set to 0 to disable caching.
},
// The following parameters are directly passed to Typesense's search API endpoint.
// So you can pass any parameters supported by the search endpoint below.
// query_by is required.
// Search parameters that are common to all collections/indices go here:
additionalSearchParameters: {},
// Search parameters that need to be *overridden* on a per-collection-basis go here:
collectionSpecificSearchParameters: {
main: {
query_by:
"Given Name, country of birth, countryofresidence, selfidentifiedasrefugee, mainoccupation, education, email 1, gender, jobpositions, language, last name",
},
kobo_updated: {
query_by: "group_un4zf56/Name, group_un4zf56/Last_Name_Family_last_Name",
},
},
});
const searchClient = typesenseInstantsearchAdapter.searchClient;
Jason
07:48 PMindex
widget? That’s the one that lets you scope refinement lists to the correct indexJason
07:49 PMJamshid
07:54 PMAs I am starting this way:
<ais-instant-search :search-client="searchClient" index-name="main">
I didn’t see a need to use
ais-index
but only when adding the next collection.Jason
07:56 PMais-index
is what gets Instantsearch to send the requests to multiple collections…Jason
07:57 PM<ais-index>
Jamshid
07:58 PM
```<ais-instant-search
:search-client="searchClient"
index-name="instant_search_price_desc"
>```
and later with the second index, they are using
ais-index`.Jason
07:59 PMJamshid
08:01 PM<ais-instant-search :search-client="searchClient" index-name="main">
<ais-index index-name="main">
1
Typesense
Indexed 2776 threads (79% resolved)
Similar Threads
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.
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.
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.
Issues with Search UI for Vector Search
WL is building a search UI for vector search and having issues with syntax, while Jason provides context on the issue.
Resolving Typesense Setup Issues with VueJS
A sought help with setting up Typesense in a CDN VueJS application. Jason guided him to adjust the initialization and provided a solution to an undefined item warning, resulting in a successful setup.