from algoliasearch_django import AlgoliaIndex


class ChartIndex(AlgoliaIndex):
    fields = [
        'title',
        'arrangers'
    ]
    settings = {
        'searchableAttributes': [
            'title',
            'arrangers',
        ]
    }


class GroupIndex(AlgoliaIndex):
    should_index = 'is_active'
    fields = [
        'name',
        'get_kind_display',
        'get_gender_display',
        'code',
        'image',
        'bhs_id',
    ]
    settings = {
        'searchableAttributes': [
            'name',
            'code',
            'bhs_id',
            'get_kind_display',
        ]
    }


class PersonIndex(AlgoliaIndex):
    fields = [
        'first_name',
        'middle_name',
        'last_name',
        'nick_name',
        'get_gender_display',
        'get_part_display',
        'email',
        'image',
        'bhs_id',
        'full_name',
        'common_name',
    ]
    settings = {
        'searchableAttributes': [
            'bhs_id,full_name',
            'get_gender_display',
            'get_part_display',
            'email',
        ]
    }

from algoliasearch_django import AlgoliaIndex


class ChartIndex(AlgoliaIndex):
    fields = [
        'title',
        'arrangers'
    ]
    settings = {
        'searchableAttributes': [
            'title',
            'arrangers',
        ]
    }


class GroupIndex(AlgoliaIndex):
    should_index = 'is_active'
    fields = [
        'name',
        'get_kind_display',
        'get_gender_display',
        'code',
        'image',
        'bhs_id',
    ]
    settings = {
        'searchableAttributes': [
            'name',
            'code',
            'bhs_id',
            'get_kind_display',
        ],
        'attributesForFaceting': [
            'get_kind_display',
        ]
    }


class PersonIndex(AlgoliaIndex):
    fields = [
        'first_name',
        'middle_name',
        'last_name',
        'nick_name',
        'get_gender_display',
        'get_part_display',
        'email',
        'image',
        'bhs_id',
        'full_name',
        'common_name',
    ]
    settings = {
        'searchableAttributes': [
            'bhs_id,full_name',
            'get_gender_display',
            'get_part_display',
            'email',
        ]
    }

Add faceting test to Group index
Add faceting test to Group index

  from algoliasearch_django import AlgoliaIndex
  
  
  class ChartIndex(AlgoliaIndex):
      fields = [
          'title',
          'arrangers'
      ]
      settings = {
          'searchableAttributes': [
              'title',
              'arrangers',
          ]
      }
  
  
  class GroupIndex(AlgoliaIndex):
      should_index = 'is_active'
      fields = [
          'name',
          'get_kind_display',
          'get_gender_display',
          'code',
          'image',
          'bhs_id',
      ]
      settings = {
          'searchableAttributes': [
              'name',
              'code',
              'bhs_id',
              'get_kind_display',
+         ],
+         'attributesForFaceting': [
+             'get_kind_display',
          ]
      }
  
  
  class PersonIndex(AlgoliaIndex):
      fields = [
          'first_name',
          'middle_name',
          'last_name',
          'nick_name',
          'get_gender_display',
          'get_part_display',
          'email',
          'image',
          'bhs_id',
          'full_name',
          'common_name',
      ]
      settings = {
          'searchableAttributes': [
              'bhs_id,full_name',
              'get_gender_display',
              'get_part_display',
              'email',
          ]
      }
  
Add faceting test to Group index
## Code Before:
from algoliasearch_django import AlgoliaIndex


class ChartIndex(AlgoliaIndex):
    fields = [
        'title',
        'arrangers'
    ]
    settings = {
        'searchableAttributes': [
            'title',
            'arrangers',
        ]
    }


class GroupIndex(AlgoliaIndex):
    should_index = 'is_active'
    fields = [
        'name',
        'get_kind_display',
        'get_gender_display',
        'code',
        'image',
        'bhs_id',
    ]
    settings = {
        'searchableAttributes': [
            'name',
            'code',
            'bhs_id',
            'get_kind_display',
        ]
    }


class PersonIndex(AlgoliaIndex):
    fields = [
        'first_name',
        'middle_name',
        'last_name',
        'nick_name',
        'get_gender_display',
        'get_part_display',
        'email',
        'image',
        'bhs_id',
        'full_name',
        'common_name',
    ]
    settings = {
        'searchableAttributes': [
            'bhs_id,full_name',
            'get_gender_display',
            'get_part_display',
            'email',
        ]
    }

## Instruction:
Add faceting test to Group index
## Code After:
from algoliasearch_django import AlgoliaIndex


class ChartIndex(AlgoliaIndex):
    fields = [
        'title',
        'arrangers'
    ]
    settings = {
        'searchableAttributes': [
            'title',
            'arrangers',
        ]
    }


class GroupIndex(AlgoliaIndex):
    should_index = 'is_active'
    fields = [
        'name',
        'get_kind_display',
        'get_gender_display',
        'code',
        'image',
        'bhs_id',
    ]
    settings = {
        'searchableAttributes': [
            'name',
            'code',
            'bhs_id',
            'get_kind_display',
        ],
        'attributesForFaceting': [
            'get_kind_display',
        ]
    }


class PersonIndex(AlgoliaIndex):
    fields = [
        'first_name',
        'middle_name',
        'last_name',
        'nick_name',
        'get_gender_display',
        'get_part_display',
        'email',
        'image',
        'bhs_id',
        'full_name',
        'common_name',
    ]
    settings = {
        'searchableAttributes': [
            'bhs_id,full_name',
            'get_gender_display',
            'get_part_display',
            'email',
        ]
    }
