Skip to content

Commit 97f33e4

Browse files
committed
Add search changes
1 parent 1124b13 commit 97f33e4

File tree

3 files changed

+21
-35
lines changed

3 files changed

+21
-35
lines changed

.code-samples.meilisearch.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ search_parameter_guide_highlight_tag_1: |-
282282
})
283283
search_parameter_guide_matches_1: |-
284284
client.index('movies').search('winter feast', {
285-
'matches': 'true'
285+
'showMatchesPosition': 'true'
286286
})
287287
settings_guide_synonyms_1: |-
288288
client.index('tops').update_settings({
@@ -491,7 +491,7 @@ faceted_search_filter_1: |-
491491
})
492492
faceted_search_facets_distribution_1: |-
493493
client.index('movies').search('Batman', {
494-
'facetsDistribution': ['genres']
494+
'facets': ['genres']
495495
})
496496
faceted_search_walkthrough_filter_1: |-
497497
client.index('movies').search('thriller', {

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ index.search(
189189
],
190190
"offset": 0,
191191
"limit": 20,
192-
"nbHits": 1,
192+
"estimatedTotalHits": 1,
193193
"processingTimeMs": 0,
194194
"query": "wonder"
195195
}

tests/index/test_index_search_meilisearch.py

Lines changed: 18 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -186,18 +186,16 @@ def test_custom_search_params_with_facets_distribution(index_with_documents):
186186
response = index.search(
187187
'world',
188188
{
189-
'facetsDistribution': ['genre']
189+
'facets': ['genre']
190190
}
191191
)
192192
assert isinstance(response, dict)
193193
assert len(response['hits']) == 12
194-
assert 'facetsDistribution' in response
195-
assert 'exhaustiveFacetsCount' in response
196-
assert not response['exhaustiveFacetsCount']
197-
assert 'genre' in response['facetsDistribution']
198-
assert response['facetsDistribution']['genre']['cartoon'] == 1
199-
assert response['facetsDistribution']['genre']['action'] == 3
200-
assert response['facetsDistribution']['genre']['fantasy'] == 1
194+
assert 'facetDistribution' in response
195+
assert 'genre' in response['facetDistribution']
196+
assert response['facetDistribution']['genre']['cartoon'] == 1
197+
assert response['facetDistribution']['genre']['action'] == 3
198+
assert response['facetDistribution']['genre']['fantasy'] == 1
201199

202200
def test_custom_search_params_with_filter_string(index_with_documents):
203201
index = index_with_documents()
@@ -211,8 +209,7 @@ def test_custom_search_params_with_filter_string(index_with_documents):
211209
)
212210
assert isinstance(response, dict)
213211
assert len(response['hits']) == 3
214-
assert 'facetsDistribution' not in response
215-
assert 'exhaustiveFacetsCount' not in response
212+
assert 'facetDistribution' not in response
216213

217214
def test_custom_search_params_with_filter_string_with_space(index_with_documents):
218215
index = index_with_documents()
@@ -226,8 +223,7 @@ def test_custom_search_params_with_filter_string_with_space(index_with_documents
226223
)
227224
assert isinstance(response, dict)
228225
assert len(response['hits']) == 1
229-
assert 'facetsDistribution' not in response
230-
assert 'exhaustiveFacetsCount' not in response
226+
assert 'facetDistribution' not in response
231227

232228
def test_custom_search_params_with_multiple_filter_string_with_space(index_with_documents):
233229
index = index_with_documents()
@@ -241,8 +237,7 @@ def test_custom_search_params_with_multiple_filter_string_with_space(index_with_
241237
)
242238
assert isinstance(response, dict)
243239
assert len(response['hits']) == 1
244-
assert 'facetsDistribution' not in response
245-
assert 'exhaustiveFacetsCount' not in response
240+
assert 'facetDistribution' not in response
246241

247242
def test_custom_search_params_with_array_filter_with_space(index_with_documents):
248243
index = index_with_documents()
@@ -256,8 +251,7 @@ def test_custom_search_params_with_array_filter_with_space(index_with_documents)
256251
)
257252
assert isinstance(response, dict)
258253
assert len(response['hits']) == 1
259-
assert 'facetsDistribution' not in response
260-
assert 'exhaustiveFacetsCount' not in response
254+
assert 'facetDistribution' not in response
261255

262256
def test_custom_search_params_with_mutilple_filter_string(index_with_documents):
263257
index = index_with_documents()
@@ -271,8 +265,7 @@ def test_custom_search_params_with_mutilple_filter_string(index_with_documents):
271265
)
272266
assert isinstance(response, dict)
273267
assert len(response['hits']) == 2
274-
assert 'facetsDistribution' not in response
275-
assert 'exhaustiveFacetsCount' not in response
268+
assert 'facetDistribution' not in response
276269
assert response['hits'][0]['title'] == 'Avengers: Infinity War'
277270

278271
def test_custom_search_params_with_filter(index_with_documents):
@@ -287,8 +280,7 @@ def test_custom_search_params_with_filter(index_with_documents):
287280
)
288281
assert isinstance(response, dict)
289282
assert len(response['hits']) == 3
290-
assert 'facetsDistribution' not in response
291-
assert 'exhaustiveFacetsCount' not in response
283+
assert 'facetDistribution' not in response
292284

293285
def test_custom_search_params_with_multiple_filter(index_with_documents):
294286
index = index_with_documents()
@@ -302,8 +294,7 @@ def test_custom_search_params_with_multiple_filter(index_with_documents):
302294
)
303295
assert isinstance(response, dict)
304296
assert len(response['hits']) == 3
305-
assert 'facetsDistribution' not in response
306-
assert 'exhaustiveFacetsCount' not in response
297+
assert 'facetDistribution' not in response
307298

308299
def test_custom_search_params_with_many_params(index_with_documents):
309300
index = index_with_documents()
@@ -318,8 +309,7 @@ def test_custom_search_params_with_many_params(index_with_documents):
318309
)
319310
assert isinstance(response, dict)
320311
assert len(response['hits']) == 3
321-
assert 'facetsDistribution' not in response
322-
assert 'exhaustiveFacetsCount' not in response
312+
assert 'facetDistribution' not in response
323313
assert 'title' in response['hits'][0]
324314
assert 'poster' in response['hits'][0]
325315
assert 'overview' not in response['hits'][0]
@@ -347,8 +337,7 @@ def test_custom_search_params_with_sort_string(index_with_documents):
347337
)
348338
assert isinstance(response, dict)
349339
assert len(response['hits']) == 12
350-
assert 'facetsDistribution' not in response
351-
assert 'exhaustiveFacetsCount' not in response
340+
assert 'facetDistribution' not in response
352341
assert response['hits'][0]['title'] == 'Alita: Battle Angel'
353342
assert response['hits'][1]['title'] == 'Aquaman'
354343

@@ -373,8 +362,7 @@ def test_custom_search_params_with_sort_int(index_with_documents):
373362
)
374363
assert isinstance(response, dict)
375364
assert len(response['hits']) == 12
376-
assert 'facetsDistribution' not in response
377-
assert 'exhaustiveFacetsCount' not in response
365+
assert 'facetDistribution' not in response
378366
assert response['hits'][0]['title'] == 'Avengers: Infinity War'
379367
assert response['hits'][1]['title'] == 'Redcon-1'
380368

@@ -399,17 +387,15 @@ def test_custom_search_params_with_multiple_sort(index_with_documents):
399387
)
400388
assert isinstance(response, dict)
401389
assert len(response['hits']) == 12
402-
assert 'facetsDistribution' not in response
403-
assert 'exhaustiveFacetsCount' not in response
390+
assert 'facetDistribution' not in response
404391
assert response['hits'][0]['title'] == 'Alita: Battle Angel'
405392
assert response['hits'][1]['title'] == 'Aquaman'
406393

407394
def test_phrase_search(index_with_documents):
408395
response = index_with_documents().search('coco "dumbo"')
409396
assert isinstance(response, dict)
410397
assert len(response['hits']) == 1
411-
assert 'facetsDistribution' not in response
412-
assert 'exhaustiveFacetsCount' not in response
398+
assert 'facetDistribution' not in response
413399
assert 'title' in response['hits'][0]
414400
assert 'poster' in response['hits'][0]
415401
assert 'overview' in response['hits'][0]

0 commit comments

Comments
 (0)