refinementList not returning results

I am trying to implement a refinementList widget, and it is not returning any results.

  instantsearch.widgets.refinementList({
    container: '#refine-list',
    attribute: 'institution',
  }),

What is returned is:

<div class="ais-RefinementList ais-RefinementList--noRefinement"></div>

I’m using:

    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/instantsearch.css@7.3.1/themes/reset-min.css" integrity="sha256-t2ATOGCtAIZNnzER679jwcFcKYfLlw01gli6F6oszk8=" crossorigin="anonymous">
 <script src="https://cdn.jsdelivr.net/npm/algoliasearch@4.0.0/dist/algoliasearch-lite.umd.js" integrity="sha256-MfeKq2Aw9VAkaE9Caes2NOxQf6vUa8Av0JqcUXUGkd0=" crossorigin="anonymous"></script>
      <script src="https://cdn.jsdelivr.net/npm/instantsearch.js@4.0.0/dist/instantsearch.production.min.js" integrity="sha256-6S7q0JJs/Kx4kb/fv0oMjS855QTz5Rc2hh9AkIUjUsk=" crossorigin="anonymous"></script>

I can confirm the HTML div has the right ID, the attribute is named correctly, and normal results are returned. The only thing that does not return results is the refinementList.

Any ideas?

Hi there,

You need to make sure the institution attribute is used as attributesForFaceting (https://www.algolia.com/doc/api-reference/api-parameters/attributesForFaceting/). You can do that from your Algolia Dashboard in the Indices > Configuration > Facets section.

Best,

1 Like

Thank you! This solved it.