File tree Expand file tree Collapse file tree 2 files changed +32
-0
lines changed Expand file tree Collapse file tree 2 files changed +32
-0
lines changed Original file line number Diff line number Diff line change @@ -127,6 +127,7 @@ export type SearchParams = Query &
127127 showRankingScoreDetails ?: boolean ;
128128 attributesToSearchOn ?: string [ ] | null ;
129129 hybrid ?: HybridSearch ;
130+ rankingScoreThreshold ?: number ;
130131 } ;
131132
132133// Search parameters for searches made with the GET method
@@ -1011,6 +1012,14 @@ export const ErrorStatusCode = {
10111012
10121013 /** @see https://www.meilisearch.com/docs/reference/errors/error_codes#invalid_facet_search_facet_query */
10131014 INVALID_FACET_SEARCH_FACET_QUERY : 'invalid_facet_search_facet_query' ,
1015+
1016+ /** @see https://www.meilisearch.com/docs/reference/errors/error_codes#invalid_search_ranking_score_threshold */
1017+ INVALID_SEARCH_RANKING_SCORE_THRESHOLD :
1018+ 'invalid_search_ranking_score_threshold' ,
1019+
1020+ /** @see https://www.meilisearch.com/docs/reference/errors/error_codes#invalid_similar_ranking_score_threshold */
1021+ INVALID_SIMILAR_RANKING_SCORE_THRESHOLD :
1022+ 'invalid_similar_ranking_score_threshold' ,
10141023} ;
10151024
10161025export type ErrorStatusCode =
Original file line number Diff line number Diff line change @@ -306,6 +306,29 @@ describe.each([
306306 ] ) ;
307307 } ) ;
308308
309+ test ( `${ permission } key: search with rankingScoreThreshold filter` , async ( ) => {
310+ const client = await getClient ( permission ) ;
311+
312+ const response = await client . index ( index . uid ) . search ( 'prince' , {
313+ showRankingScore : true ,
314+ rankingScoreThreshold : 0.8 ,
315+ } ) ;
316+
317+ const hit = response . hits [ 0 ] ;
318+
319+ expect ( response ) . toHaveProperty ( 'hits' , expect . any ( Array ) ) ;
320+ expect ( response ) . toHaveProperty ( 'query' , 'prince' ) ;
321+ expect ( hit ) . toHaveProperty ( '_rankingScore' ) ;
322+ expect ( hit [ '_rankingScore' ] ) . toBeGreaterThanOrEqual ( 0.8 ) ;
323+
324+ const response2 = await client . index ( index . uid ) . search ( 'prince' , {
325+ showRankingScore : true ,
326+ rankingScoreThreshold : 0.9 ,
327+ } ) ;
328+
329+ expect ( response2 . hits . length ) . toBeLessThanOrEqual ( 0 ) ;
330+ } ) ;
331+
309332 test ( `${ permission } key: search with array options` , async ( ) => {
310333 const client = await getClient ( permission ) ;
311334
You can’t perform that action at this time.
0 commit comments