Skip to main content
  • Type: list<string>
  • Default: [](no facets)
  • Scope: settings
Faceting lets users narrow down search results by selecting attribute values, such as author, genre, or brand. To use an attribute for faceting or filtering, declare it in attributesForFaceting. To learn more, see Declare attributes for faceting.
There’s no hard limit on the number of attributes you can include, but adding too many can slow down getSettings operations and degrade performance in the Algolia dashboard.

Usage

  • Attribute names are case-sensitive
  • Declaring an attribute here enables:
  • You can use nested attributes for faceting, such as authors.mainAuthor. In this case, only mainAuthor is used for faceting.
  • Avoid colons (:) in facet attribute names faceting as the filters syntax uses colons as delimiters.

Modifiers

Use modifiers to change the behavior of faceted attributes.
filterOnly
Marks an attribute as available only for filtering—not faceting. This is useful when you want to filter by an attribute but don’t need to display its facet values. It also reduces index size and improves performance.
You can’t use filterOnly and searchable together.
searchable
Makes a facet searchable—users can type to find facet values.You can combine this modifier with afterDistinct: afterDistinct(searchable(attribute)).
You can’t use filterOnly and searchable together.
afterDistinct
Ensures facet counts reflect only unique records when using the distinct setting. Use this when deduplicating records and you want accurate facet counts.
  • Only use afterDistinct on attributes shared by all records with the same distinct key.
  • If facetingAfterDistinct is also set to true, it takes precendence and applies to all the query’s facets.
You can combine this modifier with searchable: afterDistinct(searchable(attribute)).

Example

The following example:
  • Defines some attributes as facets: author, edition, category, and publisher
  • Sets the isbn attribute as only usable for filtering
  • Allows the edition and publisher facet values to be searchable

Current API clients

var response = await client.SetSettingsAsync(
  "ALGOLIA_INDEX_NAME",
  new IndexSettings
  {
    AttributesForFaceting = new List<string>
    {
      "author",
      "filterOnly(isbn)",
      "searchable(edition)",
      "afterDistinct(category)",
      "afterDistinct(searchable(publisher))",
    },
  }
);
IndexSettings settings = new IndexSettings
{
  AttributesForFaceting = new List
  {
    "author",
    "filterOnly(isbn)",
    "searchable(edition)",
    "afterDistinct(category)",
    "afterDistinct(searchable(publisher))"
  }
};
I