@@ -78,6 +78,22 @@ export type Crop = {
7878 cropMarker ?: string
7979}
8080
81+ // `facetName` becomes mandatory when using `searchForFacetValues`
82+ export type SearchForFacetValuesParams = Omit < SearchParams , 'facetName' > & {
83+ facetName : string
84+ }
85+
86+ export type FacetHit = {
87+ value : string
88+ count : number
89+ }
90+
91+ export type SearchForFacetValuesResponse = {
92+ facetHits : FacetHit [ ]
93+ facetQuery : string | null
94+ processingTimeMs : number
95+ }
96+
8197export type SearchParams = Query &
8298 Pagination &
8399 Highlight &
@@ -90,6 +106,12 @@ export type SearchParams = Query &
90106 matchingStrategy ?: MatchingStrategies
91107 hitsPerPage ?: number
92108 page ?: number
109+ facetName ?: string
110+ facetQuery ?: string
111+ vector ?: number [ ] | null
112+ showRankingScore ?: boolean
113+ showRankingScoreDetails ?: boolean
114+ attributesToSearchOn ?: string [ ] | null
93115 }
94116
95117// Search parameters for searches made with the GET method
@@ -105,6 +127,8 @@ export type SearchRequestGET = Pagination &
105127 attributesToHighlight ?: string
106128 attributesToCrop ?: string
107129 showMatchesPosition ?: boolean
130+ vector ?: string | null
131+ attributesToSearchOn ?: string | null
108132 }
109133
110134export type MultiSearchQuery = SearchParams & { indexUid : string }
@@ -126,6 +150,39 @@ export type MatchesPosition<T> = Partial<
126150export type Hit < T = Record < string , any > > = T & {
127151 _formatted ?: Partial < T >
128152 _matchesPosition ?: MatchesPosition < T >
153+ _rankingScore ?: number
154+ _rankingScoreDetails ?: RakingScoreDetails
155+ }
156+
157+ export type RakingScoreDetails = {
158+ words ?: {
159+ order : number
160+ matchingWords : number
161+ maxMatchingWords : number
162+ score : number
163+ }
164+ typo ?: {
165+ order : number
166+ typoCount : number
167+ maxTypoCount : number
168+ score : number
169+ }
170+ proximity ?: {
171+ order : number
172+ score : number
173+ }
174+ attribute ?: {
175+ order : number
176+ attributes_ranking_order : number
177+ attributes_query_word_order : number
178+ score : number
179+ }
180+ exactness ?: {
181+ order : number
182+ matchType : string
183+ score : number
184+ }
185+ [ key : string ] : Record < string , any > | undefined
129186}
130187
131188export type Hits < T = Record < string , any > > = Array < Hit < T > >
@@ -139,9 +196,10 @@ export type SearchResponse<
139196> = {
140197 hits : Hits < T >
141198 processingTimeMs : number
142- facetDistribution ?: FacetDistribution
143199 query : string
200+ facetDistribution ?: FacetDistribution
144201 facetStats ?: FacetStats
202+ vector ?: number [ ]
145203} & ( undefined extends S
146204 ? Partial < FinitePagination & InfinitePagination >
147205 : true extends IsFinitePagination < NonNullable < S > >
@@ -255,9 +313,13 @@ export type TypoTolerance = {
255313 }
256314} | null
257315
316+ export type FacetOrder = 'alpha' | 'count'
317+
258318export type Faceting = {
259319 maxValuesPerFacet ?: number | null
320+ sortFacetValuesBy ?: Record < string , FacetOrder > | null
260321}
322+
261323export type PaginationSettings = {
262324 maxTotalHits ?: number | null
263325}
@@ -399,6 +461,7 @@ type CursorResults<T> = {
399461 limit : number
400462 from : number
401463 next : number
464+ total : number
402465}
403466
404467export type TasksResults = CursorResults < Task >
@@ -556,12 +619,15 @@ export const enum ErrorStatusCode {
556619 /** @see https://www.meilisearch.com/docs/reference/errors/error_codes#invalid_document_offset */
557620 INVALID_DOCUMENT_OFFSET = 'invalid_document_offset' ,
558621
559- /** @see https://www.meilisearch.com/docs/reference/errors/error_codes#invalid_document_offset */
622+ /** @see https://www.meilisearch.com/docs/reference/errors/error_codes#invalid_document_filter */
560623 INVALID_DOCUMENT_FILTER = 'invalid_document_filter' ,
561624
562- /** @see https://www.meilisearch.com/docs/reference/errors/error_codes#invalid_document_offset */
625+ /** @see https://www.meilisearch.com/docs/reference/errors/error_codes#missing_document_filter */
563626 MISSING_DOCUMENT_FILTER = 'missing_document_filter' ,
564627
628+ /** @see https://www.meilisearch.com/docs/reference/errors/error_codes#invalid_document_vectors_field */
629+ INVALID_DOCUMENT_VECTORS_FIELD = 'invalid_document_vectors_field' ,
630+
565631 /** @see https://www.meilisearch.com/docs/reference/errors/error_codes#payload_too_large */
566632 PAYLOAD_TOO_LARGE = 'payload_too_large' ,
567633
@@ -637,6 +703,12 @@ export const enum ErrorStatusCode {
637703 /** @see https://www.meilisearch.com/docs/reference/errors/error_codes#invalid_search_matching_strategy */
638704 INVALID_SEARCH_MATCHING_STRATEGY = 'invalid_search_matching_strategy' ,
639705
706+ /** @see https://www.meilisearch.com/docs/reference/errors/error_codes#invalid_search_vector */
707+ INVALID_SEARCH_VECTOR = 'invalid_search_vector' ,
708+
709+ /** @see https://www.meilisearch.com/docs/reference/errors/error_codes#invalid_search_attributes_to_search_on */
710+ INVALID_SEARCH_ATTRIBUTES_TO_SEARCH_ON = 'invalid_search_attributes_to_search_on' ,
711+
640712 /** @see https://www.meilisearch.com/docs/reference/errors/error_codes#bad_request */
641713 BAD_REQUEST = 'bad_request' ,
642714
@@ -816,6 +888,15 @@ export const enum ErrorStatusCode {
816888
817889 /** @see https://www.meilisearch.com/docs/reference/errors/error_codes#invalid_api_key_offset */
818890 INVALID_API_KEY_OFFSET = 'invalid_api_key_offset' ,
891+
892+ /** @see https://www.meilisearch.com/docs/reference/errors/error_codes#invalid_facet_search_facet_name */
893+ INVALID_FACET_SEARCH_FACET_NAME = 'invalid_facet_search_facet_name' ,
894+
895+ /** @see https://www.meilisearch.com/docs/reference/errors/error_codes#missing_facet_search_facet_name */
896+ MISSING_FACET_SEARCH_FACET_NAME = 'missing_facet_search_facet_name' ,
897+
898+ /** @see https://www.meilisearch.com/docs/reference/errors/error_codes#invalid_facet_search_facet_query */
899+ INVALID_FACET_SEARCH_FACET_QUERY = 'invalid_facet_search_facet_query' ,
819900}
820901
821902export type TokenIndexRules = {
0 commit comments