Pass Keyword via URL


I am trying to pass a keyword from my homepage to the search page via URL. I found a solution that leveraged searchParameters.

const search = instantsearch({
      appId: '{{ site.algolia.application_id }}',
      indexName: '{{ site.algolia.index_name }}',
      apiKey: '{{ site.algolia.search_only_api_key }}'
      apiKey: '{{ site.algolia.search_only_api_key }}',
      searchParameters: {
        query: query

I attempted the same solution, but it is not working. It seems this may no longer be supported as it is not mentioned in v4 like it is in v3.

Here is my code:

const search = instantsearch({
  indexName: 'wf_products',
  searchParameters: { query: keyword }

Is there some other recommended way to accomplish this?

Hi @dom, to pass search parameters in instantsearch, try using the configure widget.

Thanks @cindy.cullen ! Working now. For reference, code below.

     instantsearch.widgets.configure({query: keyword}),