Skip to content

Add the filterableAttributes field to the Strapi interface #1076

@DoctorPok42

Description

@DoctorPok42

Description
After selecting a collection to index, you can select the fields in the collection to filter.

Basic example
For example, with this ‘posts’ collection.
Once indexed, I would like to have a ‘filter’ submenu with the attributes of the collection that I could check.
Once the submenu is expanded, I can check the slug attribute in the categories element.

After that, if I run this query:
GET http://localhost:7700/indexes/post/settings/filterable-attributes

it will give me this:

[
  "categories.slug"
]

The collection schema:

{
  "kind": "collectionType",
  "collectionName": "posts",
  "info": {
    "singularName": "post",
    "pluralName": "posts",
    "displayName": "Post"
  },
  "options": {
    "draftAndPublish": true
  },
  "pluginOptions": {
    "i18n": {
      "localized": true
    }
  },
  "attributes": {
    "..."
    "categories": {
      "type": "relation",
      "relation": "manyToMany",
      "target": "api::category.category",
      "mappedBy": "posts"
    },
    "..."
}
{
  "kind": "collectionType",
  "collectionName": "categories",
  "info": {
    "singularName": "category",
    "pluralName": "categories",
    "displayName": "Category"
  },
  "options": {
    "draftAndPublish": true
  },
  "pluginOptions": {
    "i18n": {
      "localized": true
    }
  },
  "attributes": {
    "name": {
      "type": "string",
      "pluginOptions": {
        "i18n": {
          "localized": true
        }
      },
      "minLength": 3,
      "required": true
    },
    "slug": {
      "type": "uid",
      "pluginOptions": {
        "i18n": {
          "localized": true
        }
      },
      "targetField": "name",
      "required": true,
      "minLength": 3
    },
  }
}

I would like to develop this feature.
Could a maintainer check if it would be useful to you before I get started?

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestquestionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions