Index Not Present

Hi There,

We are working on Instant Algolia search, integrated one demo for it.
But the demo is saying.

sort-by-selector.js:65 Uncaught Error: [sortBySelector]: Index instant_search not present in indices

You can have a look at the demo at -
http://magento2.sourcefuse.com/algolia/e-commerce/index.html

Hi @virender.sharma. This might be because the instant_search index hasn’t been created and populated with data for that application ID. Can you confirm that the index exists from the Algolia dashboard?

Yes, instant_search exists in my indices

Question - does it work if you remove this block from the search.js file?

search.addWidget(
  instantsearch.widgets.sortBySelector({
    container: '#sort-by-selector',
    indices: [
      {name: 'ikea', label: 'Featured'},
      {name: 'ikea_price_asc', label: 'Price asc.'},
      {name: 'ikea_price_desc', label: 'Price desc.'}
    ],
    label:'sort by'
  })
);

How you can solve this problem? What indices mean? i have same problem

I’m having this issue as well and it’s specific to the sortBySelector widget. If I remove the call to that widget it works fine.

I’m having the same issue in here.

Without the widget it works fine. In fact, I’m using other widgets for searching, hits, pagination and refinementlist.

The indeces seem to be created correctly in the dashboard. I’ve created replicas with different names to see if there was a naming error.

I’m using the rails gem algoliasearch-rails:

algoliasearch index_name: name + '_' + ENV['ALGOLIA_INDEX_NAME'], 
  disable_indexing: Rails.env.test? do
  attribute(
    :name
  )

  searchableAttributes(
    [
      'unordered(name)'
    ]
  )

  add_replica "product_name_asc" do
    customRanking ['asc(name)']
  end

  add_replica "product_name_desc" do
    customRanking ['desc(name)']
  end
end  

My coffeescript looks like:

  search.addWidget(
    instantsearch.widgets.sortBySelector
      container: '#sortBySelector'
      indices: [
        { name: 'product_name_asc', label: 'Name asc' },
        { name: 'product_name_desc', label: 'Name desc' }
      ],
      label: 'Name'
  )

Finally, I get the error:

Uncaught Error: [sortBySelector]: Index Product_development not present in indices

My Dashboard:

OK, folks, it seems like I got it working now. Not sure why, though…

This is my final coffeescript:

  search.addWidget(
    instantsearch.widgets.sortBySelector
      container: '#sortBySelector'
      indices: [
        { name: 'Product_development', label: 'Name' },
        { name: 'product_name_asc', label: 'Name asc' },
        { name: 'product_name_desc', label: 'Name desc' }
      ],
      label: 'Name'
  )

Perhaps someone can help with an explanation