Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changes related to the next Meilisearch release (v0.28.0) #437

Merged
merged 7 commits into from
Jul 12, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -533,7 +533,7 @@ If you are using [Strapi v3](https://github.com/strapi/strapi/tree/v3.6.9), plea

**Supported Meilisearch versions**:

This package only guarantees the compatibility with the [version v0.27.0 of Meilisearch](https://github.com/meilisearch/meilisearch/releases/tag/v0.27.0).
This package only guarantees the compatibility with the [version v0.28.0 of Meilisearch](https://github.com/meilisearch/meilisearch/releases/tag/v0.28.0).

**Node / NPM versions**:

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
],
"dependencies": {
"@strapi/utils": "^4.2.2",
"meilisearch": "^0.25.1"
"meilisearch": "^0.27.0"
},
"peerDependencies": {},
"author": {
Expand Down
2 changes: 1 addition & 1 deletion server/__tests__/meilisearch.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const deleteDocuments = jest.fn(() => {
return [{ uid: 1 }, { uid: 2 }]
})
const getIndexes = jest.fn(() => {
return [{ uid: 'my_restaurant' }, { uid: 'restaurant' }]
return { results: [{ uid: 'my_restaurant' }, { uid: 'restaurant' }] }
})

const getTasks = jest.fn(() => {
Expand Down
7 changes: 6 additions & 1 deletion server/services/meilisearch/client.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
'use strict'
const { MeiliSearch: Meilisearch } = require('meilisearch')
const packageJson = require('../../../package.json')

/**
* Create a Meilisearch client instance.
Expand All @@ -8,4 +9,8 @@ const { MeiliSearch: Meilisearch } = require('meilisearch')
*
* @returns { object } - Meilisearch client instance.
*/
module.exports = config => new Meilisearch(config)
module.exports = config =>
new Meilisearch({
...config,
clientAgents: [`Meilisearch Strapi ${packageJson.version}`],
})
4 changes: 2 additions & 2 deletions server/services/meilisearch/connector.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ module.exports = ({ strapi, adapter, config }) => {
try {
const { apiKey, host } = await store.getCredentials()
const client = Meilisearch({ apiKey, host })
const indexes = await client.getIndexes()
const { results: indexes } = await client.getIndexes()
return indexes
} catch (e) {
strapi.log.error(`meilisearch: ${e.message}`)
Expand Down Expand Up @@ -280,7 +280,7 @@ module.exports = ({ strapi, adapter, config }) => {
// Add documents in Meilisearch
const task = await client.index(indexUid).addDocuments(documents)

return task.uid
return task.taskUid
}

const tasksUids = await contentTypeService.actionInBatches({
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3140,10 +3140,10 @@ makeerror@1.0.12:
dependencies:
tmpl "1.0.5"

meilisearch@^0.25.1:
version "0.25.1"
resolved "https://registry.yarnpkg.com/meilisearch/-/meilisearch-0.25.1.tgz#0dc25ffad64e6e50eb3da6c0691b0ff54f8578bf"
integrity sha512-20jO0pK9BhghxHSkOLbdoYn58h/Z0PNL3JQcRq7ipNIeqrxkAetCZZ6ttJC3uxcz0jVglmiFoSXu3Z/lEOLOLQ==
meilisearch@^0.27.0:
version "0.27.0"
resolved "https://registry.yarnpkg.com/meilisearch/-/meilisearch-0.27.0.tgz#8bd57ddb77b975f93e054cb977b951c488ece297"
integrity sha512-kZOZFIuSO7c6xRf+Y2/9/h6A9pl0sCl/G44X4KuaSwxGbruOZPhmxbeVEgLHBv4pUFvQ56rNVTA/2d/5GCU1YA==
dependencies:
cross-fetch "^3.1.5"

Expand Down