What's the attribute name in algolia Instant search to list down the objectIDs (Product ID)

Hi Team,

I need to find out the attribute name which has the list of objectIDs (i.e) SKU ID of the products from algolia dashboard. (Instantsearch)

Need to implement the script that should be called automatically whenever the Search Results Page loads (user hit the page with query) and also should render the list of objectIDs.

The script was already designed, just need to modify the attribute that will fetch the list of ObjectIDs from algolia dashboard.

According to the documentation, ‘items’ and ‘hits’ are the major attribute that is rendering the list of product details. But not getting the result as expected.

The below is the script which was designed based on solr search and it’s rendering the list of objectIDs,

try {
(function() {
var code = $(“input[name=‘productCodePost’]”).val(),
prefix = “”,
hash = “3hV4pMz0K0VWttYMUpvi”,
rtbhTags = ;
rtbhTags.push(“pr_” + hash + “listing<c:forEach items=”${searchPageData.results}" var=“product” begin=“0” end=“4” varStatus=“loop”>${product.code}<c:if test=“${!loop.last}”>,</c:if></c:forEach>");
})();
} catch (e) {}

Inorder to achieve the same result from algoila dashboard, need some modification on these attributes, I have tried fetching the {{objectID}} by iterating ‘items’. but it seems there is some error by achieving the result.

rtbhTags.push(“pr_” + hash + “listing<c:forEach items={{items}} begin=“0” end=“4” varStatus=“loop”>{{objectID}}<c:if test=”${!loop.last}“>,</c:if></c:forEach>”);

Please let me know how can I fetch the list of productIDs from algolia dashboard?

Thank you!

If you are looking to export the index in it’s entirety, you’ll want to instead use the browse functionality:

For example:

const algoliasearch = require('algoliasearch');

// Use an API key with `browse` ACL
const client = algoliasearch('S1LT74WI4D', 'YourAPIKey');
const index = client.initIndex('indexName');

let hits = [];

// Get all records as an iterator
index.browseObjects({
  batch: batch => {
    hits = hits.concat(batch);
  }
}).then(() => console.log(hits.map(hit => hit.objectID));