Skip to content

Extend the meilisearch object with MeiliSearch settings #327

@ghost

Description

Description
Currently it is only possible to change the MeiliSearch settings of an index by making an API request to MeiliSearch after a collection type is indexed. It would be nice to extend the MeiliSearch object that was added with the 0.4.0 release with optional MeiliSearch settings.

Basic example
With the 0.4.0 release it is now possible to transform the content-types before inserting them into MeiliSearch by using the following code.

module.exports = {
  meilisearch: {
    transformEntry({ entry, model }) {
      return sanitizeEntity(entry, { model })
    },
  },
}

By adding a settings property it would be possible to update the MeiliSearch settings after a content type gets indexed. For example:

module.exports = {
  meilisearch: {
    transformEntry({ entry, model }) {
      return sanitizeEntity(entry, { model })
    },
    settings: {
      rankingRules: ['typo', 'words', 'proximity', 'attribute', 'wordsPosition', 'exactness', 'desc(release_date)'],
      filterableAttributes: ['genres'],
      distinctAttribute: null,
      searchableAttributes: ['title', 'description', 'genres'],
      displayedAttributes: ['title', 'description', 'genre', 'release_date'],
      stopWords: null,
      synonyms: {
        wolverine: ['xmen', 'logan'],
        logan: ['wolverine', 'xmen']
      }
    }
  },
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions