Skip to content

Commit 6a97984

Browse files
meili-bors[bot]meili-botamit-kshmdubuscurquiza
authored
Merge #1640
1640: Changes related to the next Meilisearch release (v1.8.0) r=brunoocasali a=meili-bot Related to this issue: meilisearch/integration-guides#299 This PR: - gathers the changes related to the next Meilisearch release (v1.8.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.8.0 is out. ⚠️ This PR should NOT be merged until the next release of Meilisearch (v1.8.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: amit-ksh <[email protected]> Co-authored-by: Morgane Dubus <[email protected]> Co-authored-by: curquiza <[email protected]> Co-authored-by: Morgane Dubus <[email protected]>
2 parents 406b689 + d4a7648 commit 6a97984

File tree

10 files changed

+723
-7
lines changed

10 files changed

+723
-7
lines changed

.code-samples.meilisearch.yaml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,8 @@ update_settings_1: |-
199199
},
200200
faceting: {
201201
maxValuesPerFacet: 200
202-
}
202+
},
203+
searchCutoffMs: 150
203204
})
204205
reset_settings_1: |-
205206
client.index('movies').resetSettings()
@@ -636,6 +637,12 @@ update_proximity_precision_settings_1: |-
636637
client.index('books').updateProximityPrecision('byAttribute')
637638
reset_proximity_precision_settings_1: |-
638639
client.index('books').resetProximityPrecision()
640+
get_search_cutoff_1: |-
641+
client.index('movies').getSearchCutoffMs()
642+
update_search_cutoff_1: |-
643+
client.index('movies').updateSearchCutoffMs(150)
644+
reset_search_cutoff_1: |-
645+
client.index('movies').resetSearchCutoffMs()
639646
search_parameter_guide_facet_stats_1: |-
640647
client.index('movie_ratings').search('Batman', { facets: ['genres', 'rating'] })
641648
geosearch_guide_filter_settings_1: |-
@@ -743,3 +750,7 @@ facet_search_3: |-
743750
})
744751
search_parameter_guide_show_ranking_score_details_1: |-
745752
client.index('movies').search('dragon', { showRankingScoreDetails: true })
753+
negative_search_1: |-
754+
client.index('movies').search('-escape')
755+
negative_search_2: |-
756+
client.index('movies').search('-"escape"')

README.md

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -983,7 +983,7 @@ client.index('myIndex').resetProximityPrecision(): Promise<EnqueuedTask>
983983

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

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)
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)
987987

988988
#### [Get embedders](https://www.meilisearch.com/docs/reference/api/settings#get-embedders)
989989

@@ -1003,6 +1003,26 @@ client.index('myIndex').updateEmbedders(embedders: Embedders): Promise<EnqueuedT
10031003
client.index('myIndex').resetEmbedders(): Promise<EnqueuedTask>
10041004
```
10051005

1006+
### SearchCutoffMs <!-- omit in toc -->
1007+
1008+
#### [Get SearchCutoffMs](https://www.meilisearch.com/docs/reference/api/settings#get-search-cutoff-ms)
1009+
1010+
```ts
1011+
client.index('myIndex').getSearchCutoffMs(): Promise<SearchCutoffMs>
1012+
```
1013+
1014+
#### [Update SearchCutoffMs](https://www.meilisearch.com/docs/reference/api/settings#update-search-cutoff-ms)
1015+
1016+
```ts
1017+
client.index('myIndex').updateSearchCutoffMs(searchCutoffMs: SearchCutoffMs): Promise<EnqueuedTask>
1018+
```
1019+
1020+
#### [Reset SearchCutoffMs](https://www.meilisearch.com/docs/reference/api/settings#reset-search-cutoff-ms)
1021+
1022+
```ts
1023+
client.index('myIndex').resetSearchCutoffMs(): Promise<EnqueuedTask>
1024+
```
1025+
10061026
### Keys <!-- omit in toc -->
10071027

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

src/indexes.ts

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ import {
5252
Dictionary,
5353
ProximityPrecision,
5454
Embedders,
55+
SearchCutoffMs,
5556
} from './types'
5657
import { removeUndefinedFromObject } from './utils'
5758
import { HttpRequests } from './http-requests'
@@ -1334,6 +1335,47 @@ class Index<T extends Record<string, any> = Record<string, any>> {
13341335

13351336
return task
13361337
}
1338+
1339+
///
1340+
/// SEARCHCUTOFFMS SETTINGS
1341+
///
1342+
1343+
/**
1344+
* Get the SearchCutoffMs settings.
1345+
*
1346+
* @returns Promise containing object of SearchCutoffMs settings
1347+
*/
1348+
async getSearchCutoffMs(): Promise<SearchCutoffMs> {
1349+
const url = `indexes/${this.uid}/settings/search-cutoff-ms`
1350+
return await this.httpRequest.get<SearchCutoffMs>(url)
1351+
}
1352+
1353+
/**
1354+
* Update the SearchCutoffMs settings.
1355+
*
1356+
* @param searchCutoffMs - Object containing SearchCutoffMsSettings
1357+
* @returns Promise containing an EnqueuedTask
1358+
*/
1359+
async updateSearchCutoffMs(
1360+
searchCutoffMs: SearchCutoffMs
1361+
): Promise<EnqueuedTask> {
1362+
const url = `indexes/${this.uid}/settings/search-cutoff-ms`
1363+
const task = await this.httpRequest.put(url, searchCutoffMs)
1364+
1365+
return new EnqueuedTask(task)
1366+
}
1367+
1368+
/**
1369+
* Reset the SearchCutoffMs settings.
1370+
*
1371+
* @returns Promise containing an EnqueuedTask
1372+
*/
1373+
async resetSearchCutoffMs(): Promise<EnqueuedTask> {
1374+
const url = `indexes/${this.uid}/settings/search-cutoff-ms`
1375+
const task = await this.httpRequest.delete(url)
1376+
1377+
return new EnqueuedTask(task)
1378+
}
13371379
}
13381380

13391381
export { Index }

src/types/types.ts

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,6 @@ export type SearchResponse<
215215
query: string
216216
facetDistribution?: FacetDistribution
217217
facetStats?: FacetStats
218-
vector?: number[]
219218
} & (undefined extends S
220219
? Partial<FinitePagination & InfinitePagination>
221220
: true extends IsFinitePagination<NonNullable<S>>
@@ -335,30 +334,64 @@ export type NonSeparatorTokens = string[] | null
335334
export type Dictionary = string[] | null
336335
export type ProximityPrecision = 'byWord' | 'byAttribute'
337336

337+
export type Distribution = {
338+
mean: number
339+
sigma: number
340+
}
341+
338342
export type OpenAiEmbedder = {
339343
source: 'openAi'
340344
model?: string
341345
apiKey?: string
342346
documentTemplate?: string
343347
dimensions?: number
348+
distribution?: Distribution
344349
}
345350

346351
export type HuggingFaceEmbedder = {
347352
source: 'huggingFace'
348353
model?: string
349354
revision?: string
350355
documentTemplate?: string
356+
distribution?: Distribution
351357
}
352358

353359
export type UserProvidedEmbedder = {
354360
source: 'userProvided'
355361
dimensions: number
362+
distribution?: Distribution
363+
}
364+
365+
export type RestEmbedder = {
366+
source: 'rest'
367+
url: string
368+
apiKey?: string
369+
dimensions?: number
370+
documentTemplate?: string
371+
inputField?: string[] | null
372+
inputType?: 'text' | 'textArray'
373+
query?: Record<string, any> | null
374+
pathToEmbeddings?: string[] | null
375+
embeddingObject?: string[] | null
376+
distribution?: Distribution
377+
}
378+
379+
export type OllamaEmbedder = {
380+
source: 'ollama'
381+
url?: string
382+
apiKey?: string
383+
model?: string
384+
documentTemplate?: string
385+
distribution?: Distribution
356386
}
357387

358388
export type Embedder =
359389
| OpenAiEmbedder
360390
| HuggingFaceEmbedder
361391
| UserProvidedEmbedder
392+
| RestEmbedder
393+
| OllamaEmbedder
394+
| null
362395

363396
export type Embedders = Record<string, Embedder> | null
364397

@@ -373,6 +406,8 @@ export type PaginationSettings = {
373406
maxTotalHits?: number | null
374407
}
375408

409+
export type SearchCutoffMs = number | null
410+
376411
export type Settings = {
377412
filterableAttributes?: FilterableAttributes
378413
distinctAttribute?: DistinctAttribute
@@ -390,6 +425,7 @@ export type Settings = {
390425
dictionary?: Dictionary
391426
proximityPrecision?: ProximityPrecision
392427
embedders?: Embedders
428+
searchCutoffMs?: SearchCutoffMs
393429
}
394430

395431
/*
@@ -930,6 +966,9 @@ export const ErrorStatusCode = {
930966
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#invalid_settings_pagination */
931967
INVALID_SETTINGS_PAGINATION: 'invalid_settings_pagination',
932968

969+
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#invalid_settings_search_cutoff_ms */
970+
INVALID_SETTINGS_SEARCH_CUTOFF_MS: 'invalid_settings_search_cutoff_ms',
971+
933972
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#invalid_task_before_enqueued_at */
934973
INVALID_TASK_BEFORE_ENQUEUED_AT: 'invalid_task_before_enqueued_at',
935974

0 commit comments

Comments
 (0)