full-text-searchmeilisearch

Meilisearch - what's the differences & relationship among: searchableAttributes, filterableAttributes, faceting


searchableAttributes, filterableAttributes, faceting. I've read the documents, but a bit confused.

Please give some insights about:


Solution

  • Both searchableAttributes and filterableAttributes are part of Meilisearch settings. An attribute doesn't necessarily have to be searchable for it to be filterable, so no relation between both.

    The response should include a facetDistribution object with the information:

    {
      "hits": [
        …
      ],
      …
      "facetDistribution": {
        "genres": {
          "action": 273,
          "animation": 118,
          "adventure": 132,
          "fantasy": 67,
          "comedy": 475,
          "mystery": 70,
          "thriller": 217
        }
      }
    }
    

    In order to have the facets information about an attribute, it must be first present in the filterableAttributes list.