Using Algolia simply as Search rather than InstantSearch

I am attempting to integrate Algolia into my React project. Is there a way to disable the instant search so that it only searches after you click a button? Also how would you then apply categories and filter those results? I used a function to handle submits and it seems to be working fine.

handleSubmit = (event) => {
    event.preventDefault();
    const searchQuery = this.state.searchQuery;

    index.search(searchQuery).then(({ hits }) => {
      this.setState({ data: hits });
    });
  };

Is there a way to implement filters then or am I using Algolia wrong?

Hi there,

When you say InstantSearch, are you instead referring to the “search as you type” feature? When Algolia uses the term “InstantSearch” it refers to a set of UI components that have been made available to ease development efforts:

Within our InstantSearch components, we do have the ability to disable the “search as you type” feature. I have included the React documentation on the relevant parameter below:

There are also different methods of refining the results which can be seen under the “Refinements” section of the same documentation:

This includes category lists, range sliders, etc. You can also create custom widgets.

Is this what you were looking for?

1 Like

Thank you so much. This is exactly what I was looking for!

You are very welcome! Happy building!

1 Like