Skip to content

What function or method takes searchState and converts it to requests for api call? #5627

Answered by hadminh
hadminh asked this question in General
Discussion options

You must be logged in to vote
const algoliasearch = require("algoliasearch");
const algoliasearchHelper = require("algoliasearch-helper");
const requestBuilder = require("algoliasearch-helper/src/requestBuilder");
const client = algoliasearch("YourApplicationID", "YourSearchOnlyAPIKey");
const index = client.initIndex("YourIndexName");

const searchState = {
  range: {
    price: {
      min: 20,
      max: 3000,
    },
  },
  refinementList: {
    fruits: ["lemon", "orange"],
  },
  menu: {
    brands: "Sony",
  },
  query: "ora",
  page: 2,
};

const helper = algoliasearchHelper(client, index.indexName, {
  disjunctiveFacets: ["fruits"],
  facets: ["brands"],
  hitsPerPage: 10,
  page: searchState.page,
  numericFil…

Replies: 2 comments 4 replies

Comment options

You must be logged in to vote
0 replies
Comment options

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

@hadminh
Comment options

@Haroenv
Comment options

@hadminh
Comment options

Answer selected by hadminh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants