Skip to content

Commit 1a9c032

Browse files
meili-bors[bot]meili-botmdubuscurquiza
authored
Merge #1614
1614: Changes related to the next Meilisearch release (v1.6.0) r=curquiza a=meili-bot Related to this issue: meilisearch/integration-guides#294 This PR: - gathers the changes related to the next Meilisearch release (v1.6.0) so that this package is ready when the official release is out. - should pass the tests against the [latest pre-release of Meilisearch](https://github.com/meilisearch/meilisearch/releases). - might eventually contain test failures until the Meilisearch v1.6.0 is out. ⚠️ This PR should NOT be merged until the next release of Meilisearch (v1.6.0) is out. _This PR is auto-generated for the [pre-release week](https://github.com/meilisearch/integration-guides/blob/main/resources/pre-release-week.md) purpose._ Co-authored-by: meili-bot <[email protected]> Co-authored-by: Morgane Dubus <[email protected]> Co-authored-by: Clémentine U. - curqui <[email protected]> Co-authored-by: Morgane Dubus <[email protected]>
2 parents be57d84 + e598d94 commit 1a9c032

File tree

10 files changed

+557
-18
lines changed

10 files changed

+557
-18
lines changed

.code-samples.meilisearch.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -630,6 +630,12 @@ update_non_separator_tokens_1: |-
630630
client.index('books').updateNonSeparatorTokens(['@', '#'])
631631
reset_non_separator_tokens_1: |-
632632
client.index('books').resetNonSeparatorTokens()
633+
get_proximity_precision_settings_1: |-
634+
client.index('books').getProximityPrecision()
635+
update_proximity_precision_settings_1: |-
636+
client.index('books').updateProximityPrecision('byAttribute')
637+
reset_proximity_precision_settings_1: |-
638+
client.index('books').resetProximityPrecision()
633639
search_parameter_guide_facet_stats_1: |-
634640
client.index('movie_ratings').search('Batman', { facets: ['genres', 'rating'] })
635641
geosearch_guide_filter_settings_1: |-

README.md

Lines changed: 51 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -903,64 +903,106 @@ client.index('myIndex').resetTypoTolerance(): Promise<EnqueuedTask>
903903

904904
### Separator tokens <!-- omit in toc -->
905905

906-
#### Get separator tokens
906+
#### [Get separator tokens](https://www.meilisearch.com/docs/reference/api/settings#get-separator-tokens)
907907

908908
```ts
909909
client.index('myIndex').getSeparatorTokens(): Promise<SeparatorTokens>
910910
```
911911

912-
#### Update separator tokens
912+
#### [Update separator tokens](https://www.meilisearch.com/docs/reference/api/settings#update-separator-tokens)
913913

914914
```ts
915915
client.index('myIndex').updateSeparatorTokens(separatorTokens: SeparatorTokens | null): Promise<EnqueuedTask>
916916
```
917917

918-
#### Reset separator tokens
918+
#### [Reset separator tokens](https://www.meilisearch.com/docs/reference/api/settings#reset-separator-tokens)
919919

920920
```ts
921921
client.index('myIndex').resetSeparatorTokens(): Promise<EnqueuedTask>
922922
```
923923

924924
### Non Separator tokens <!-- omit in toc -->
925925

926-
#### Get non separator tokens
926+
#### [Get non separator tokens](https://www.meilisearch.com/docs/reference/api/settings#get-non-separator-tokens)
927927

928928
```ts
929929
client.index('myIndex').getNonSeparatorTokens(): Promise<NonSeparatorTokens>
930930
```
931931

932-
#### Update non separator tokens
932+
#### [Update non separator tokens](https://www.meilisearch.com/docs/reference/api/settings#update-non-separator-tokens)
933933

934934
```ts
935935
client.index('myIndex').updateNonSeparatorTokens(nonSeparatorTokens: NonSeparatorTokens | null): Promise<EnqueuedTask>
936936
```
937937

938-
#### Reset non separator tokens
938+
#### [Reset non separator tokens](https://www.meilisearch.com/docs/reference/api/settings#reset-non-separator-tokens)
939939

940940
```ts
941941
client.index('myIndex').resetNonSeparatorTokens(): Promise<EnqueuedTask>
942942
```
943943

944944
### Dictionary <!-- omit in toc -->
945945

946-
#### Get dictionary
946+
#### [Get dictionary](https://www.meilisearch.com/docs/reference/api/settings#get-dictionary)
947947

948948
```ts
949949
client.index('myIndex').getDictionary(): Promise<Dictionary>
950950
```
951951

952-
#### Update dictionary
952+
#### [Update dictionary](https://www.meilisearch.com/docs/reference/api/settings#update-dictionary)
953953

954954
```ts
955955
client.index('myIndex').updateDictionary(dictionary: Dictionary | null): Promise<EnqueuedTask>
956956
```
957957

958-
#### Reset dictionary
958+
#### [Reset dictionary](https://www.meilisearch.com/docs/reference/api/settings#reset-dictionary)
959959

960960
```ts
961961
client.index('myIndex').resetDictionary(): Promise<EnqueuedTask>
962962
```
963963

964+
### Proximity Precision <!-- omit in toc -->
965+
966+
#### [Get proximity precision](https://www.meilisearch.com/docs/reference/api/settings#get-proximity-precision)
967+
968+
```ts
969+
client.index('myIndex').getProximityPrecision(): Promise<ProximityPrecision>
970+
```
971+
972+
#### [Update proximity precision](https://www.meilisearch.com/docs/reference/api/settings#update-proximity-precision)
973+
974+
```ts
975+
client.index('myIndex').updateProximityPrecision(proximityPrecision: ProximityPrecision): Promise<EnqueuedTask>
976+
```
977+
978+
#### [Reset proximity precision](https://www.meilisearch.com/docs/reference/api/settings#reset-proximity-precision)
979+
980+
```ts
981+
client.index('myIndex').resetProximityPrecision(): Promise<EnqueuedTask>
982+
```
983+
984+
### Embedders <!-- omit in toc -->
985+
986+
⚠️ This feature is experimental. Activate the `vectorStore` experimental feature to use it](https://www.meilisearch.com/docs/reference/api/experimental_features#configure-experimental-features)
987+
988+
#### [Get embedders](https://www.meilisearch.com/docs/reference/api/settings#get-embedders)
989+
990+
```ts
991+
client.index('myIndex').getEmbedders(): Promise<Embedders>
992+
```
993+
994+
#### [Update embedders](https://www.meilisearch.com/docs/reference/api/settings#update-embedders)
995+
996+
```ts
997+
client.index('myIndex').updateEmbedders(embedders: Embedders): Promise<EnqueuedTask>
998+
```
999+
1000+
#### [Reset embedders](https://www.meilisearch.com/docs/reference/api/settings#reset-embedders)
1001+
1002+
```ts
1003+
client.index('myIndex').resetEmbedders(): Promise<EnqueuedTask>
1004+
```
1005+
9641006
### Keys <!-- omit in toc -->
9651007

9661008
#### [Get keys](https://www.meilisearch.com/docs/reference/api/keys#get-all-keys)

src/indexes.ts

Lines changed: 88 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ import {
5050
SeparatorTokens,
5151
NonSeparatorTokens,
5252
Dictionary,
53+
ProximityPrecision,
54+
Embedders,
5355
} from './types'
5456
import { removeUndefinedFromObject } from './utils'
5557
import { HttpRequests } from './http-requests'
@@ -1222,7 +1224,7 @@ class Index<T extends Record<string, any> = Record<string, any>> {
12221224
}
12231225

12241226
/**
1225-
* Update the the dictionary settings. Overwrite the old settings.
1227+
* Update the dictionary settings. Overwrite the old settings.
12261228
*
12271229
* @param dictionary - Array that contains the new dictionary settings.
12281230
* @returns Promise containing an EnqueuedTask or null
@@ -1247,6 +1249,91 @@ class Index<T extends Record<string, any> = Record<string, any>> {
12471249

12481250
return task
12491251
}
1252+
1253+
///
1254+
/// PROXIMITY PRECISION
1255+
///
1256+
1257+
/**
1258+
* Get the proximity precision settings of a Meilisearch index.
1259+
*
1260+
* @returns Promise containing the proximity precision settings
1261+
*/
1262+
async getProximityPrecision(): Promise<ProximityPrecision> {
1263+
const url = `indexes/${this.uid}/settings/proximity-precision`
1264+
return await this.httpRequest.get<ProximityPrecision>(url)
1265+
}
1266+
1267+
/**
1268+
* Update the proximity precision settings. Overwrite the old settings.
1269+
*
1270+
* @param proximityPrecision - String that contains the new proximity
1271+
* precision settings.
1272+
* @returns Promise containing an EnqueuedTask or null
1273+
*/
1274+
async updateProximityPrecision(
1275+
proximityPrecision: ProximityPrecision
1276+
): Promise<EnqueuedTask> {
1277+
const url = `indexes/${this.uid}/settings/proximity-precision`
1278+
const task = await this.httpRequest.put(url, proximityPrecision)
1279+
1280+
return new EnqueuedTask(task)
1281+
}
1282+
1283+
/**
1284+
* Reset the proximity precision settings to its default value
1285+
*
1286+
* @returns Promise containing an EnqueuedTask
1287+
*/
1288+
async resetProximityPrecision(): Promise<EnqueuedTask> {
1289+
const url = `indexes/${this.uid}/settings/proximity-precision`
1290+
const task = await this.httpRequest.delete<EnqueuedTask>(url)
1291+
1292+
task.enqueuedAt = new Date(task.enqueuedAt)
1293+
1294+
return task
1295+
}
1296+
1297+
///
1298+
/// EMBEDDERS
1299+
///
1300+
1301+
/**
1302+
* Get the embedders settings of a Meilisearch index.
1303+
*
1304+
* @returns Promise containing the embedders settings
1305+
*/
1306+
async getEmbedders(): Promise<Embedders> {
1307+
const url = `indexes/${this.uid}/settings/embedders`
1308+
return await this.httpRequest.get<Embedders>(url)
1309+
}
1310+
1311+
/**
1312+
* Update the embedders settings. Overwrite the old settings.
1313+
*
1314+
* @param embedders - Object that contains the new embedders settings.
1315+
* @returns Promise containing an EnqueuedTask or null
1316+
*/
1317+
async updateEmbedders(embedders: Embedders): Promise<EnqueuedTask> {
1318+
const url = `indexes/${this.uid}/settings/embedders`
1319+
const task = await this.httpRequest.patch(url, embedders)
1320+
1321+
return new EnqueuedTask(task)
1322+
}
1323+
1324+
/**
1325+
* Reset the embedders settings to its default value
1326+
*
1327+
* @returns Promise containing an EnqueuedTask
1328+
*/
1329+
async resetEmbedders(): Promise<EnqueuedTask> {
1330+
const url = `indexes/${this.uid}/settings/embedders`
1331+
const task = await this.httpRequest.delete<EnqueuedTask>(url)
1332+
1333+
task.enqueuedAt = new Date(task.enqueuedAt)
1334+
1335+
return task
1336+
}
12501337
}
12511338

12521339
export { Index }

src/types/types.ts

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,11 @@ export type SearchForFacetValuesResponse = {
9595
processingTimeMs: number
9696
}
9797

98+
export type HybridSearch = {
99+
embedder?: string
100+
semanticRatio?: number
101+
}
102+
98103
export type SearchParams = Query &
99104
Pagination &
100105
Highlight &
@@ -113,6 +118,7 @@ export type SearchParams = Query &
113118
showRankingScore?: boolean
114119
showRankingScoreDetails?: boolean
115120
attributesToSearchOn?: string[] | null
121+
hybrid?: HybridSearch
116122
}
117123

118124
// Search parameters for searches made with the GET method
@@ -130,6 +136,8 @@ export type SearchRequestGET = Pagination &
130136
showMatchesPosition?: boolean
131137
vector?: string | null
132138
attributesToSearchOn?: string | null
139+
hybridEmbedder?: string
140+
hybridSemanticRatio?: number
133141
}
134142

135143
export type MultiSearchQuery = SearchParams & { indexUid: string }
@@ -316,6 +324,32 @@ export type TypoTolerance = {
316324
export type SeparatorTokens = string[] | null
317325
export type NonSeparatorTokens = string[] | null
318326
export type Dictionary = string[] | null
327+
export type ProximityPrecision = 'byWord' | 'byAttribute'
328+
329+
export type OpenAiEmbedder = {
330+
source: 'openAi'
331+
model?: string
332+
apiKey?: string
333+
documentTemplate?: string
334+
}
335+
336+
export type HuggingFaceEmbedder = {
337+
source: 'huggingFace'
338+
model?: string
339+
revision?: string
340+
documentTemplate?: string
341+
}
342+
343+
export type UserProvidedEmbedder = {
344+
source: 'userProvided'
345+
dimensions: number
346+
}
347+
export type Embedder =
348+
| OpenAiEmbedder
349+
| HuggingFaceEmbedder
350+
| UserProvidedEmbedder
351+
352+
export type Embedders = Record<string, Embedder> | null
319353

320354
export type FacetOrder = 'alpha' | 'count'
321355

@@ -343,6 +377,8 @@ export type Settings = {
343377
separatorTokens?: SeparatorTokens
344378
nonSeparatorTokens?: NonSeparatorTokens
345379
dictionary?: Dictionary
380+
proximityPrecision?: ProximityPrecision
381+
embedders?: Embedders
346382
}
347383

348384
/*

0 commit comments

Comments
 (0)