how to prevent Algolia from updating filters automaticly

  algolia, javascript

I am in the process of integrating Algolia into my application developed in javascript, and I am facing a problem. Each time I carry out a search my filters adapt and I cannot, for example, combine the search in the same facet.

Per example I want to get two products from the same family (family 1 and family 2). I can do this kind of operation from the Algolia user interface but not in my developed application. Should I modify my configuration or something else ?

Here is my get elements method from an aloglia index

public async get(
pageNumber: Number = 0,
search: String = '',
filters: String = ''
): Promise<Services> {
// eslint-disable-next-line no-useless-catch
try {
  const products = await this.index
    .search(search, {
      page: pageNumber,
      hitsPerPage: 10,
      filters,
      facets: ['family','size','tags']
    })
    .then(({ hits, nbHits, facets }: Response) => {
      return { hits, nbHits, facets }
    })

  return products
} catch (__error) {
  // eslint-disable-next-line no-console
  // console.error(__error)
  throw __error
}
}

Source: Ask Javascript Questions

LEAVE A COMMENT