Skip to content

Commit

Permalink
Merge branch 'main' into meili-bot/bump-version
Browse files Browse the repository at this point in the history
  • Loading branch information
brunoocasali authored Feb 17, 2025
2 parents 15550ea + 7e095e7 commit ed8ecba
Show file tree
Hide file tree
Showing 8 changed files with 36 additions and 99 deletions.
10 changes: 10 additions & 0 deletions .code-samples.meilisearch.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -821,3 +821,13 @@ get_all_batches_1: |-
client.getBatches();
get_batch_1: |-
client.getBatch(BATCH_UID);
# Vector search
update_embedders_1: |-
client.index('INDEX_NAME').updateEmbedders({
default: {
source: 'openAi',
apiKey: 'OPEN_AI_API_KEY',
model: 'text-embedding-3-small',
documentTemplate: 'A document titled '{{doc.title}}' whose description starts with {{doc.overview|truncatewords: 20}}'
}
});
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1066,8 +1066,6 @@ client.index('myIndex').resetPrefixSearch(): Promise<EnqueuedTask>

### Embedders <!-- omit in toc -->

⚠️ This feature is experimental. Activate the [`vectorStore` experimental feature to use it](https://www.meilisearch.com/docs/reference/api/experimental_features#configure-experimental-features)

#### Get embedders

```ts
Expand Down
24 changes: 24 additions & 0 deletions tests/__snapshots__/settings.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ exports[`Test on settings > Admin key: Get default settings of an index 1`] = `
"*",
],
"distinctAttribute": null,
"embedders": {},
"facetSearch": true,
"faceting": {
"maxValuesPerFacet": 100,
Expand Down Expand Up @@ -57,6 +58,7 @@ exports[`Test on settings > Admin key: Get default settings of empty index with
"*",
],
"distinctAttribute": null,
"embedders": {},
"facetSearch": true,
"faceting": {
"maxValuesPerFacet": 100,
Expand Down Expand Up @@ -107,6 +109,7 @@ exports[`Test on settings > Admin key: Reset embedders settings 1`] = `
"*",
],
"distinctAttribute": null,
"embedders": {},
"facetSearch": true,
"faceting": {
"maxValuesPerFacet": 100,
Expand Down Expand Up @@ -157,6 +160,7 @@ exports[`Test on settings > Admin key: Reset settings 1`] = `
"*",
],
"distinctAttribute": null,
"embedders": {},
"facetSearch": true,
"faceting": {
"maxValuesPerFacet": 100,
Expand Down Expand Up @@ -207,6 +211,7 @@ exports[`Test on settings > Admin key: Reset settings of empty index 1`] = `
"*",
],
"distinctAttribute": null,
"embedders": {},
"facetSearch": true,
"faceting": {
"maxValuesPerFacet": 100,
Expand Down Expand Up @@ -316,6 +321,7 @@ exports[`Test on settings > Admin key: Update facetSearch settings on empty inde
"*",
],
"distinctAttribute": null,
"embedders": {},
"facetSearch": false,
"faceting": {
"maxValuesPerFacet": 100,
Expand Down Expand Up @@ -366,6 +372,7 @@ exports[`Test on settings > Admin key: Update prefixSearch settings on an empty
"*",
],
"distinctAttribute": null,
"embedders": {},
"facetSearch": true,
"faceting": {
"maxValuesPerFacet": 100,
Expand Down Expand Up @@ -416,6 +423,7 @@ exports[`Test on settings > Admin key: Update searchableAttributes settings on e
"*",
],
"distinctAttribute": null,
"embedders": {},
"facetSearch": true,
"faceting": {
"maxValuesPerFacet": 100,
Expand Down Expand Up @@ -466,6 +474,7 @@ exports[`Test on settings > Admin key: Update searchableAttributes settings on e
"*",
],
"distinctAttribute": null,
"embedders": {},
"facetSearch": true,
"faceting": {
"maxValuesPerFacet": 100,
Expand Down Expand Up @@ -519,6 +528,7 @@ exports[`Test on settings > Admin key: Update settings 1`] = `
"title",
],
"distinctAttribute": "title",
"embedders": {},
"facetSearch": true,
"faceting": {
"maxValuesPerFacet": 50,
Expand Down Expand Up @@ -587,6 +597,7 @@ exports[`Test on settings > Admin key: Update settings on empty index with prima
"*",
],
"distinctAttribute": "title",
"embedders": {},
"facetSearch": true,
"faceting": {
"maxValuesPerFacet": 100,
Expand Down Expand Up @@ -635,6 +646,7 @@ exports[`Test on settings > Admin key: Update settings with all null values 1`]
"*",
],
"distinctAttribute": null,
"embedders": {},
"facetSearch": true,
"faceting": {
"maxValuesPerFacet": 100,
Expand Down Expand Up @@ -685,6 +697,7 @@ exports[`Test on settings > Master key: Get default settings of an index 1`] = `
"*",
],
"distinctAttribute": null,
"embedders": {},
"facetSearch": true,
"faceting": {
"maxValuesPerFacet": 100,
Expand Down Expand Up @@ -735,6 +748,7 @@ exports[`Test on settings > Master key: Get default settings of empty index with
"*",
],
"distinctAttribute": null,
"embedders": {},
"facetSearch": true,
"faceting": {
"maxValuesPerFacet": 100,
Expand Down Expand Up @@ -785,6 +799,7 @@ exports[`Test on settings > Master key: Reset embedders settings 1`] = `
"*",
],
"distinctAttribute": null,
"embedders": {},
"facetSearch": true,
"faceting": {
"maxValuesPerFacet": 100,
Expand Down Expand Up @@ -835,6 +850,7 @@ exports[`Test on settings > Master key: Reset settings 1`] = `
"*",
],
"distinctAttribute": null,
"embedders": {},
"facetSearch": true,
"faceting": {
"maxValuesPerFacet": 100,
Expand Down Expand Up @@ -885,6 +901,7 @@ exports[`Test on settings > Master key: Reset settings of empty index 1`] = `
"*",
],
"distinctAttribute": null,
"embedders": {},
"facetSearch": true,
"faceting": {
"maxValuesPerFacet": 100,
Expand Down Expand Up @@ -994,6 +1011,7 @@ exports[`Test on settings > Master key: Update facetSearch settings on empty ind
"*",
],
"distinctAttribute": null,
"embedders": {},
"facetSearch": false,
"faceting": {
"maxValuesPerFacet": 100,
Expand Down Expand Up @@ -1044,6 +1062,7 @@ exports[`Test on settings > Master key: Update prefixSearch settings on an empty
"*",
],
"distinctAttribute": null,
"embedders": {},
"facetSearch": true,
"faceting": {
"maxValuesPerFacet": 100,
Expand Down Expand Up @@ -1094,6 +1113,7 @@ exports[`Test on settings > Master key: Update searchableAttributes settings on
"*",
],
"distinctAttribute": null,
"embedders": {},
"facetSearch": true,
"faceting": {
"maxValuesPerFacet": 100,
Expand Down Expand Up @@ -1144,6 +1164,7 @@ exports[`Test on settings > Master key: Update searchableAttributes settings on
"*",
],
"distinctAttribute": null,
"embedders": {},
"facetSearch": true,
"faceting": {
"maxValuesPerFacet": 100,
Expand Down Expand Up @@ -1197,6 +1218,7 @@ exports[`Test on settings > Master key: Update settings 1`] = `
"title",
],
"distinctAttribute": "title",
"embedders": {},
"facetSearch": true,
"faceting": {
"maxValuesPerFacet": 50,
Expand Down Expand Up @@ -1265,6 +1287,7 @@ exports[`Test on settings > Master key: Update settings on empty index with prim
"*",
],
"distinctAttribute": "title",
"embedders": {},
"facetSearch": true,
"faceting": {
"maxValuesPerFacet": 100,
Expand Down Expand Up @@ -1313,6 +1336,7 @@ exports[`Test on settings > Master key: Update settings with all null values 1`]
"*",
],
"distinctAttribute": null,
"embedders": {},
"facetSearch": true,
"faceting": {
"maxValuesPerFacet": 100,
Expand Down
18 changes: 0 additions & 18 deletions tests/documents.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -226,15 +226,6 @@ Hint: It might not be working because maybe you're not up to date with the Meili
const client = await getClient(permission);
const adminKey = await getKey("Admin");

await fetch(`${HOST}/experimental-features`, {
body: JSON.stringify({ vectorStore: true }),
headers: {
Authorization: `Bearer ${adminKey}`,
"Content-Type": "application/json",
},
method: "PATCH",
});

const { taskUid } = await client
.index(indexPk.uid)
.addDocuments(dataset);
Expand Down Expand Up @@ -269,15 +260,6 @@ Hint: It might not be working because maybe you're not up to date with the Meili
const client = await getClient(permission);
const adminKey = await getKey("Admin");

await fetch(`${HOST}/experimental-features`, {
body: JSON.stringify({ vectorStore: true }),
headers: {
Authorization: `Bearer ${adminKey}`,
"Content-Type": "application/json",
},
method: "PATCH",
});

const { taskUid } = await client
.index(indexPk.uid)
.addDocuments(dataset);
Expand Down
16 changes: 2 additions & 14 deletions tests/embedders.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,9 @@ import type { Embedders } from "../src/types.js";
import {
clearAllIndexes,
config,
HOST,
BAD_HOST,
MeiliSearch,
getClient,
getKey,
} from "./utils/meilisearch-test-utils.js";

const index = {
Expand Down Expand Up @@ -58,16 +56,6 @@ describe.each([{ permission: "Master" }, { permission: "Admin" }])(
beforeEach(async () => {
await clearAllIndexes(config);
const client = await getClient(permission);
const key = await getKey(permission);

await fetch(`${HOST}/experimental-features`, {
body: JSON.stringify({ vectorStore: true }),
headers: {
Authorization: `Bearer ${key}`,
"Content-Type": "application/json",
},
method: "PATCH",
});

const task = await client.createIndex(index.uid);
await client.waitForTask(task.taskUid);
Expand All @@ -77,7 +65,7 @@ describe.each([{ permission: "Master" }, { permission: "Admin" }])(
const client = await getClient(permission);
const response: Embedders = await client.index(index.uid).getEmbedders();

expect(response).toEqual(null);
expect(response).toEqual({});
});

test(`${permission} key: Update embedders with 'userProvided' source`, async () => {
Expand Down Expand Up @@ -273,7 +261,7 @@ describe.each([{ permission: "Master" }, { permission: "Admin" }])(

const response: Embedders = await client.index(index.uid).getEmbedders();

expect(response).toEqual(null);
expect(response).toEqual({});
});

test(`${permission} key: search (POST) with vectors`, async () => {
Expand Down
22 changes: 0 additions & 22 deletions tests/get_search.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ import {
BAD_HOST,
MeiliSearch,
getClient,
HOST,
getKey,
} from "./utils/meilisearch-test-utils.js";

const index = {
Expand Down Expand Up @@ -520,16 +518,6 @@ describe.each([

test(`${permission} key: search with retrieveVectors to true`, async () => {
const client = await getClient(permission);
const adminKey = await getKey("Admin");

await fetch(`${HOST}/experimental-features`, {
body: JSON.stringify({ vectorStore: true }),
headers: {
Authorization: `Bearer ${adminKey}`,
"Content-Type": "application/json",
},
method: "PATCH",
});

const response = await client.index(index.uid).searchGet("prince", {
retrieveVectors: true,
Expand All @@ -542,16 +530,6 @@ describe.each([

test(`${permission} key: search without retrieveVectors`, async () => {
const client = await getClient(permission);
const adminKey = await getKey("Admin");

await fetch(`${HOST}/experimental-features`, {
body: JSON.stringify({ vectorStore: true }),
headers: {
Authorization: `Bearer ${adminKey}`,
"Content-Type": "application/json",
},
method: "PATCH",
});

const response = await client.index(index.uid).searchGet("prince");

Expand Down
21 changes: 0 additions & 21 deletions tests/search.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import {
MeiliSearch,
getClient,
datasetWithNests,
HOST,
getKey,
} from "./utils/meilisearch-test-utils.js";

Expand Down Expand Up @@ -1148,16 +1147,6 @@ describe.each([

test(`${permission} key: search with retrieveVectors to true`, async () => {
const client = await getClient(permission);
const adminKey = await getKey("Admin");

await fetch(`${HOST}/experimental-features`, {
body: JSON.stringify({ vectorStore: true }),
headers: {
Authorization: `Bearer ${adminKey}`,
"Content-Type": "application/json",
},
method: "PATCH",
});

const response = await client.index(index.uid).search("prince", {
retrieveVectors: true,
Expand All @@ -1170,16 +1159,6 @@ describe.each([

test(`${permission} key: search without retrieveVectors`, async () => {
const client = await getClient(permission);
const adminKey = await getKey("Admin");

await fetch(`${HOST}/experimental-features`, {
body: JSON.stringify({ vectorStore: true }),
headers: {
Authorization: `Bearer ${adminKey}`,
"Content-Type": "application/json",
},
method: "PATCH",
});

const response = await client.index(index.uid).search("prince");

Expand Down
Loading

0 comments on commit ed8ecba

Please sign in to comment.