question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to dynamically update searchParameters?

See original GitHub issue

I want to update the SearchParameter restrictSearchableAttributes according to a user selection in a dropdown next to the search box.

Updating search.searchParameters like search.restrictSearchableAttributes = 'mynumbers' does not work.

How can I set searchParameters after the initial setup:

var search = instantsearch({
    ...
    searchParameters: {
        restrictSearchableAttributes: 'text',
    }
})

$('#x').on('click', function() {
    // How to update "restrictSearchableAttributes" here (and start a new search)?
    // ?

    // This does NOT work:
    search.restrictSearchableAttributes = 'mynumbers';
    search.start();
})

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Reactions:4
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
vvocommented, Mar 21, 2016

You would have to build your own custom widget:

var customWidget = {
  init: function(options) {
    $('x').onClick(function() {
      options.helper.setQueryParameter('restrictSearchableAttributes', ...);
    });
  }
};

search.addWidget(customWidget);

Let me know.

0reactions
powtaccommented, Mar 21, 2016

options.helper.search(); did the job! Thanks for your help, @vvo! I’ll come back to your offer and contact you via the support forms later this week.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Adding search parameters dynamically
You can change/withdrawal by clicking on Cookie Settings in the website footer. Accept All Cookies. Cookies Settings.
Read more >
How to dynamically change search parameter in angular ...
I am using <ais-configure [searchParameters]="{ aroundLatLng: '0, 0' }"></ais-configure> , and dynamically updating the { aroundLatLng: '23, ...
Read more >
Dynamic Search Conditions in T-SQL
Or you can use dynamic SQL to build a query string which includes only the search conditions ... (An interesting behaviour is that...
Read more >
Search UI Dynamically Change Facets Search parameters ...
Hi, I am trying to dynamically modify the geo center in the range search for the National Parks codesandbox example.
Read more >
dynamically change the dimensions in your view and sort ...
Parameters: dynamically change the dimensions in your view and sort by multiple measures. by Andrew Lehm. This post will show you how to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found