Skip to content
This repository was archived by the owner on Mar 21, 2024. It is now read-only.

Commit 2d7f6ab

Browse files
committed
open api
1 parent 36d07b3 commit 2d7f6ab

1 file changed

Lines changed: 169 additions & 0 deletions

File tree

open-api.yaml

Lines changed: 169 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,157 @@ components:
117117
- start
118118
- length
119119
description: Starting position and length in bytes of the matched term in the returned value
120+
order:
121+
type: integer
122+
description: The order that this ranking rule was applied
123+
customRankingRuleDetails:
124+
type: object
125+
properties:
126+
order:
127+
$ref: '#/components/schemas/order'
128+
value:
129+
type:
130+
- string
131+
- number
132+
- point
133+
description: The value that was used for sorting this document
134+
distance:
135+
type: number
136+
description: The distance between the target point and the geoPoint in the document
137+
required:
138+
- order
139+
- value
140+
description: Custom rule in the form of either `attribute:direction` or `_geoPoint(lat, lng):direction`.
141+
score:
142+
type: number
143+
description: |
144+
The relevancy score of a document according to a ranking rule and relative to a search query. Higher is better.
145+
146+
`1.0` indicates a perfect match, `0.0` no match at all (Meilisearch should not return documents that don't match the query).
147+
rankingScoreDetails:
148+
type: object
149+
properties:
150+
words:
151+
type: object
152+
properties:
153+
order:
154+
$ref: '#/components/schemas/order'
155+
matchingWords:
156+
type: integer
157+
description: the number of words from the query found
158+
maxMatchingWords:
159+
type: integer
160+
score:
161+
$ref: '#/components/schemas/score'
162+
required:
163+
- order
164+
- matchingWords
165+
- maxMatchingWords
166+
- score
167+
typo:
168+
type: object
169+
properties:
170+
order:
171+
$ref: '#/components/schemas/order'
172+
typoCount:
173+
type: integer
174+
description: The number of typos to correct in the query to match that document.
175+
maxTypoCount:
176+
type: integer
177+
description: The maximum number of typos that can be corrected in the query to match a document.
178+
score:
179+
$ref: '#/components/schemas/score'
180+
required:
181+
- order
182+
- typoCount
183+
- maxTypoCount
184+
- score
185+
proximity:
186+
type: object
187+
properties:
188+
order:
189+
$ref: '#/components/schemas/order'
190+
score:
191+
$ref: '#/components/schemas/score'
192+
required:
193+
- order
194+
- score
195+
attribute:
196+
type: object
197+
properties:
198+
order:
199+
$ref: '#/components/schemas/order'
200+
attribute_ranking_order_score:
201+
type: number
202+
description: |
203+
Score computed depending on the first attribute each word of the query appears in.
204+
205+
The first attribute in the `searchableAttributes` list yields the highest score, the last attribute the lowest.
206+
query_word_distance_score:
207+
type: number
208+
description: |
209+
Score computed depending on the position the attributes where each word of the query appears in.
210+
211+
Words appearing in an attribute at the same position as in the query yield the highest score. The greater the distance to the position
212+
in the query, the lower the score.
213+
score:
214+
$ref: '#/components/schemas/score'
215+
required:
216+
- order
217+
- attribute_ranking_order_score
218+
- query_word_distance_score
219+
- score
220+
exactness:
221+
type: object
222+
properties:
223+
order:
224+
$ref: '#/components/schemas/order'
225+
matchType:
226+
type: string
227+
description: |
228+
One of `exactMatch`, `matchesStart` or `noExactMatch`.
229+
- `exactMatch`: the document contains an attribute that exactly matches the query.
230+
- `matchesStart`: the document contains an attribute that exactly starts with the query.
231+
- `noExactMatch`: any other document.
232+
score:
233+
$ref: '#/components/schemas/score'
234+
required:
235+
- order
236+
- matchType
237+
- score
238+
additionalProperties:
239+
$ref: '#/components/schemas/customRankingRuleDetails'
240+
description: (EXPERIMENTAL) The ranking score per ranking rule.
241+
examples:
242+
With sort:
243+
words:
244+
order: 0
245+
matchingWords: 7
246+
maxMatchingWords: 7
247+
score: 1.0
248+
"typo":
249+
"order": 1
250+
"typoCount": 0
251+
"maxTypoCount": 0
252+
"score": 1.0
253+
"proximity":
254+
"order": 2,
255+
"score": 1.0
256+
"attribute":
257+
"order": 3
258+
"attribute_ranking_order_score": 1.0
259+
"query_word_distance_score": 1.0
260+
"score": 1.0
261+
"title:asc":
262+
"order": 4
263+
"value": "batman: the dark knight returns, part 1"
264+
"release_date:desc":
265+
"order": 5
266+
"value": 1345507200.0
267+
"exactness":
268+
"order": 6
269+
"matchType": "exactMatch"
270+
"score": 1.0
120271
hit:
121272
type: object
122273
additionalProperties: true
@@ -168,6 +319,15 @@ components:
168319
properties:
169320
'':
170321
$ref: '#/components/schemas/matchesPosition'
322+
_rankingScore:
323+
type: number
324+
description: Only present if showRankingScore = `true`. The ranking score of that document.
325+
_rankingScoreDetails:
326+
type: object
327+
description: (EXPERIMENTAL) Only present if showRankingScoreDetails = `true`. The ranking score of each ranking rule for that document.
328+
properties:
329+
'':
330+
$ref: '#/components/schemas/rankingScoreDetails'
171331
attribute:
172332
type:
173333
- string
@@ -712,6 +872,14 @@ components:
712872
type: boolean
713873
description: Defines whether an `_matchesPosition` object that contains information about the matches should be returned or not.
714874
default: false
875+
showRankingScore:
876+
type: boolean
877+
description: Defines whether a `_rankingScore` number representing the relevancy score of that document should be returned or not.
878+
default: false
879+
showRankingScoreDetails:
880+
type: boolean
881+
description: (EXPERIMENTAL) Defines whether a `_rankingScoreDetails` object containing information about the score of that document for each ranking rule should be returned or not.
882+
default: false
715883
matchingStrategy:
716884
type: string
717885
description: Defines which strategy to use to match the query terms within the documents as search results. Two different strategies are available, `last` and `all`. By default, the `last` strategy is chosen.
@@ -762,6 +930,7 @@ components:
762930
attributesToHighlight:
763931
- overview
764932
showMatchesPosition: true
933+
showRankingScore: true
765934
wordsMatchingStrategy: all
766935
error:
767936
title: error

0 commit comments

Comments
 (0)