reactjsalgolia

is it possible to make an search using algolia without using its ui?


I want to do an algolia search using react instant search or instantsearch.js and want to store the result in an array instead of showing it using the ui , how can i do this ? I tried looking for the docs but there it is only mentioned to show the hits using the ui


Solution

  • Yes you can call Algolia search and not use the UI components.

    For example, you can use the package algoliasearch more information here.

    const algoliasearch = require('algoliasearch');
    
    const client = algoliasearch('YourApplicationID', 'YourAdminAPIKey');
    const index = client.initIndex('your_index_name');
    
    index.search('Fo')
      .then(({ hits }) => {
        console.log(hits);
      });