TypesenseInstantsearchAdapter and Algolia Query
TLDR Jordan had issues with utilizing Algolia's helper method after creating the TypesenseInstantsearchAdapter. Jason clarified that this adapter is unnecessary with Autocomplete.js. The correct approach is to use the typesense-js library directly.
1
Mar 16, 2022 (22 months ago)
Jordan
07:28 PMgetAlgoliaResults
helper method (docs ref here) to query for results in an algolia autocomplete
widget correct? Looking at my network tab, I only see one network request and it's a query with a wildcard parameter instead of my query string in the input. Posting code in the thread...one secJordan
07:29 PMconst typesenseSearchAdapter = new TypesenseInstantsearchAdapter({
server: {
apiKey: "REDACTED",
nodes: [
{
host: "localhost",
port: 8108,
protocol: "http"
}
],
},
additionalSearchParameters: {
query_by: "title"
},
})
const searchClient = typesenseSearchAdapter.searchClient;
Jordan
07:30 PM<AutocompleteSearch
autoCompleteProps={{
searchClient,
getSources({ query }) {
return [
{
sourceId: "tracks",
getItems() {
return getAlgoliaResults({
searchClient,
queries: [
{
indexName: "tracks",
query
}
]
})
},
templates: {
item({ item, components }) {
return (
<div>response</div>
)
}
}
}
]
}
}}
/>
my
AutocompleteSearch
component is defined using the algolia example hereJason
07:32 PMWith Autocomplete.js you don't need the adapter. Instead, you want to use the typesense-js library directly inside of getItems()
Jason
07:32 PMJason
07:33 PMgetAlgoliaResults
Jordan
07:35 PM1
Typesense
Indexed 3011 threads (79% resolved)
Similar Threads
Integrating Typesense with Algolia's Autocomplete-JS Library
Metahub asks about integrating Typesense with Algolia's autocomplete-js UI library. Jason suggests using the `getSources` parameter and the Typesense JS client.
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.
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.