Skip to content

Is it possible to only query index with specific fields when using <Index /> component? #5348

Answered by Sartonon
Sartonon asked this question in Q&A
Discussion options

You must be logged in to vote

That's indeed not easy to solve. There's a couple solutions possible:

  • restructure indices to inherit parameters from root

This would be hard with your setup, as suggestions are within the layout

  • remove the filter from indices that don't have those attributes

https://codesandbox.io/s/relaxed-david-ofo3hk?file=/src/App.js:214-645

const searchClient = algoliasearch(
  "latency",
  "6be0576ff61c053d5f9a3225e2a90f76"
);
const search = searchClient.search;
searchClient.search = (queries) => {
  return search(
    queries.map(({ indexName, params }) => {
      if (indexName === "autocomplete_demo_products_query_suggestions") {
        delete params.numericFilters;
        delete params.face…

Replies: 0 comments 8 replies

Comment options

You must be logged in to vote
6 replies
@Haroenv
Comment options

@Sartonon
Comment options

@Haroenv
Comment options

@Sartonon
Comment options

@Sartonon
Comment options

Comment options

You must be logged in to vote
0 replies
Answer selected by Sartonon
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
Library: React InstantSearch ≥ 7 Issues in any of the react-instantsearch@7 packages (formerly named react-instantsearch-hooks)
2 participants