@nosto/autocomplete

    Function search

    • Parameters

      • query: SearchQuery

        Query object.

      • options: Options = {}

        Options object.

      Returns Promise<
          {
              query: SearchQuery;
              response: {
                  abTests?: ABTest[];
                  autocorrect?: SearchAutocorrect;
                  explain?: SearchExplain;
                  keywords?: SearchKeywords;
                  products: {
                      categoryId?: string;
                      categoryPath?: string;
                      collapse?: string;
                      facets?: SearchFacet[];
                      from?: number;
                      fuzzy?: boolean;
                      hits: SearchProduct[];
                      size?: number;
                      total: number;
                  };
                  query?: string;
                  redirect?: string;
              };
          },
      >

      Promise of search response.

      import { search } from "@nosto/autocomplete"

      search({
      query: "shoes",
      products: {
      fields: ["name", "price"],
      facets: ["brand", "category"],
      size: 10,
      from: 0,
      }
      }).then((state) => {
      console.log(state.response)
      })
    MMNEPVFCICPMFPCPTTAAATR