Skip to content

Commit 04030ae

Browse files
committed
Add section in README about settings usage
1 parent 6172075 commit 04030ae

File tree

4 files changed

+24
-3
lines changed

4 files changed

+24
-3
lines changed

README.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,28 @@ Resulting in `categories` being transformed like this in a `restaurant` entry.
287287

288288
By transforming the `categories` into an array of names, it is now compatible with the [`filtering` feature](https://docs.meilisearch.com/reference/features/filtering_and_faceted_search.html#configuring-filters) in MeiliSearch.
289289

290+
#### 🏗 Add MeiliSearch Settings
290291

292+
Each index in MeiliSearch can be customized with specific settings. It is possible to add your [MeiliSearch settings](https://docs.meilisearch.com/reference/features/settings.html#settings) configuration to the indexes you create using `settings` field in your model's config.
293+
294+
The settings are added when either adding a whole collection to MeiliSearch or when updating a collection in MeiliSearch. The settings are not updated when documents are added through the [`listeners`](-apply-hooks).
295+
296+
**For example**
297+
```js
298+
module.exports = {
299+
meilisearch: {
300+
settings: {
301+
filterableAttributes: ['genres'],
302+
distinctAttribute: null,
303+
searchableAttributes: ['title', 'description', 'genres'],
304+
synonyms: {
305+
wolverine: ['xmen', 'logan'],
306+
logan: ['wolverine', 'xmen']
307+
}
308+
}
309+
},
310+
}
311+
```
291312

292313
### 🕵️‍♀️ Start Searching <!-- omit in toc -->
293314

resources/entries-transformers/dates-transformer.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ function dateToTimeStamp(date) {
1313

1414
module.exports = {
1515
meilisearch: {
16-
transformEntry(entry) {
16+
transformEntry({ entry }) {
1717
const transformedEntry = {
1818
...entry,
1919
// transform date format to timestamp

resources/entries-transformers/filter-compatibility.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
module.exports = {
99
meilisearch: {
10-
transformEntry(entry) {
10+
transformEntry({ entry }) {
1111
const transformedEntry = {
1212
...entry,
1313
categories: entry.categories.map(cat => cat.name), // map to only have categories name

resources/entries-transformers/remove-fields.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
module.exports = {
99
meilisearch: {
10-
transformEntry(entry) {
10+
transformEntry({ entry }) {
1111
const transformedEntry = entry
1212
// remove created by and updated by fields
1313
delete transformedEntry.created_by

0 commit comments

Comments
 (0)