Skip to content
Discussion options

You must be logged in to vote

Solution for anyone that might be having the same issue

import { SearchClient } from "algoliasearch/lite";

const customSearchClient: SearchClient = {
    ...searchClient,
    search: (requests) => {
        if (requests.every(({ params }) => !params?.query)) {
          return Promise.resolve({
            results: requests.map(() => ({
              hits: [],
              nbHits: 0,
              nbPages: 0,
              page: 0,
              processingTimeMS: 0,
              hitsPerPage: 0,
              exhaustiveNbHits: false,
              query: '',
              params: '',
            })),
          });
        }
    
        return searchClient.search(requests);
    },
};

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by destino92
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant