Skip to content

Commit 66bbfdf

Browse files
bors[bot]meili-botcurquizaalallema
authored
Merge #250
250: Changes related to the next MeiliSearch release (v0.21.0) r=alallema a=meili-bot Related to this issue: meilisearch/integration-guides#117 This PR: - gathers the changes related to the next MeiliSearch release (v0.21.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). Until there is an RC version, the tests should be valid against the [alpha versions of transplant](https://github.com/meilisearch/transplant/releases). - might eventually contain test failures until the MeiliSearch v0.21.0 is out. ⚠️ This PR should NOT be merged until the next release of MeiliSearch (v0.21.0) is out. _This PR is auto-generated for the [pre-release week](https://github.com/meilisearch/integration-guides/blob/master/guides/pre-release-week.md) purpose. Exceptionally for this release, the pre-release time will be more than just one week._ Done: - Update README #286 - Rename `attributes_for_faceting` into `filterable_attributes` #287 #292 - Update `WaitForPendingUpdate` status #288 - Adapts tests according to v0.21.0 breaking changes #289 - Rename fields `buildDate` into `commitDate` - Update `rankingRules` - `exhaustiveFacetsCount` return `False` - Add missing tests according to new features #290 - Phrase search tests - Filter/facet on number is now doable - Test the syntax on Filter array and string - Update code sample file #291 #293 Co-authored-by: meili-bot <[email protected]> Co-authored-by: Clémentine Urquizar <[email protected]> Co-authored-by: Amélie <[email protected]> Co-authored-by: alallema <[email protected]>
2 parents 2639498 + 4c9e809 commit 66bbfdf

11 files changed

+185
-147
lines changed

.code-samples.meilisearch.yaml

Lines changed: 42 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,10 @@ get_settings_1: |-
5050
update_settings_1: |-
5151
client.index('movies').update_settings({
5252
'rankingRules': [
53-
'typo',
5453
'words',
54+
'typo',
5555
'proximity',
5656
'attribute',
57-
'wordsPosition',
5857
'exactness',
5958
'desc(release_date)',
6059
'desc(rank)'
@@ -104,11 +103,10 @@ get_ranking_rules_1: |-
104103
client.index('movies').get_ranking_rules()
105104
update_ranking_rules_1: |-
106105
client.index('movies').update_ranking_rules([
107-
'typo',
108106
'words',
107+
'typo',
109108
'proximity',
110109
'attribute',
111-
'wordsPosition',
112110
'exactness',
113111
'asc(release_date)',
114112
'desc(rank)'
@@ -121,6 +119,15 @@ update_distinct_attribute_1: |-
121119
client.index('movies').update_distinct_attribute('movie_id')
122120
reset_distinct_attribute_1: |-
123121
client.index('movies').reset_distinct_attribute()
122+
get_filterable_attributes_1: |-
123+
client.index('movies').get_filterable_attributes()
124+
update_filterable_attributes_1: |-
125+
client.index('movies').update_filterable_attributes([
126+
'genres',
127+
'director'
128+
])
129+
reset_filterable_attributes_1: |-
130+
client.index('movies').reset_filterable_attributes()
124131
get_searchable_attributes_1: |-
125132
client.index('movies').get_searchable_attributes()
126133
update_searchable_attributes_1: |-
@@ -135,11 +142,10 @@ get_displayed_attributes_1: |-
135142
client.index('movies').get_displayed_attributes()
136143
update_displayed_attributes_1: |-
137144
client.index('movies').update_displayed_attributes([
138-
"title",
145+
'title',
139146
'description',
140-
'release_date',
141-
'rank',
142-
'poster'
147+
'genre',
148+
'release_date'
143149
])
144150
reset_displayed_attributes_1: |-
145151
client.index('movies').reset_displayed_attributes()
@@ -170,19 +176,19 @@ field_properties_guide_displayed_1: |-
170176
]})
171177
filtering_guide_1: |-
172178
client.index('movies').search('Avengers', {
173-
'filters': 'release_date > 795484800'
179+
'filter': 'release_date > 795484800'
174180
})
175181
filtering_guide_2: |-
176182
client.index('movies').search('Batman', {
177-
'filters': 'release_date > 795484800 AND (director = "Tim Burton" OR director = "Christopher Nolan")'
183+
'filter': 'release_date > 795484800 AND (director = "Tim Burton" OR director = "Christopher Nolan")'
178184
})
179185
filtering_guide_3: |-
180186
client.index('movies').search('horror', {
181-
'filters': 'director = "Jordan Peele"'
187+
'filter': 'director = "Jordan Peele"'
182188
})
183189
filtering_guide_4: |-
184190
client.index('movies').search('Planet of the Apes', {
185-
'filters': 'rating >= 3 AND (NOT director = "Tim Burton")'
191+
'filter': 'rating >= 3 AND (NOT director = "Tim Burton")'
186192
})
187193
search_parameter_guide_query_1: |-
188194
client.index('movies').search('shifu')
@@ -204,25 +210,23 @@ search_parameter_guide_crop_1: |-
204210
'cropLength': 10
205211
})
206212
search_parameter_guide_highlight_1: |-
207-
client.index('movies').search('shifu', {
213+
client.index('movies').search('winter feast', {
208214
'attributesToHighlight': ['overview']
209215
})
210216
search_parameter_guide_filter_1: |-
211217
client.index('movies').search('n', {
212-
'filters': 'title = Nightshift'
218+
'filter': 'title = Nightshift'
213219
})
214220
search_parameter_guide_filter_2: |-
215-
client.index('movies').search('n', {
216-
'filters': 'title = "Kung Fu Panda"'
221+
client.index('movies').search('shifu', {
222+
'filter': 'title = "Kung Fu Panda"'
217223
})
218224
search_parameter_guide_matches_1: |-
219-
client.index('movies').search('n', {
220-
'filters': 'title = "Kung Fu Panda"',
221-
'attributesToHighlight': ['overview'],
225+
client.index('movies').search('winter feast', {
222226
'matches': 'true'
223227
})
224228
settings_guide_synonyms_1: |-
225-
client.index('movies').update_settings({
229+
client.index('tops').update_settings({
226230
'synonyms': {
227231
sweater: ['jumper'],
228232
jumper: ['sweater']
@@ -239,18 +243,17 @@ settings_guide_stop_words_1: |-
239243
settings_guide_ranking_rules_1: |-
240244
client.index('movies').update_settings({
241245
'rankingRules': [
242-
'typo',
243246
'words',
247+
'typo',
244248
'proximity',
245249
'attribute',
246-
'wordsPosition',
247250
'exactness',
248251
'asc(release_date)',
249252
'desc(rank)'
250253
]
251254
})
252255
settings_guide_distinct_1: |-
253-
client.index('movies').update_settings({
256+
client.index('jackets').update_settings({
254257
'distinctAttribute': 'product_id'
255258
})
256259
settings_guide_searchable_1: |-
@@ -270,6 +273,12 @@ settings_guide_displayed_1: |-
270273
'release_date'
271274
]
272275
})
276+
add_movies_json_1: |-
277+
import json
278+
279+
json_file = open('movies.json')
280+
movies = json.load(json_file)
281+
client.index('movies').add_documents(movies)
273282
documents_guide_add_movie_1: |-
274283
client.index('movies').add_documents([{
275284
'movie_id': '123sq178',
@@ -282,7 +291,7 @@ search_guide_1: |-
282291
})
283292
search_guide_2: |-
284293
client.index('movies').search('Avengers', {
285-
'filters': 'release_date > 795484800'
294+
'filter': 'release_date > 795484800'
286295
})
287296
getting_started_add_documents_md: |-
288297
```bash
@@ -308,28 +317,28 @@ getting_started_search_md: |-
308317
309318
[About this SDK](https://github.com/meilisearch/meilisearch-python/)
310319
faceted_search_update_settings_1: |-
311-
client.index('movies').update_attributes_for_faceting([
320+
client.index('movies').update_filterable_attributes([
312321
'director',
313322
'genres',
314323
])
315-
faceted_search_facet_filters_1: |-
324+
faceted_search_filter_1: |-
316325
client.index('movies').search('thriller', {
317-
'facetFilters': [['genres:Horror', 'genres:Mystery'], 'director:Jordan Peele']
326+
'filter': [['genres = Horror', 'genres = Mystery'], 'director = "Jordan Peele"']
318327
})
319328
faceted_search_facets_distribution_1: |-
320329
client.index('movies').search('Batman', {
321330
'facetsDistribution': ['genres']
322331
})
323-
faceted_search_walkthrough_attributes_for_faceting_1: |-
324-
client.index('movies').update_attributes_for_faceting([
332+
faceted_search_walkthrough_filterable_attributes_1: |-
333+
client.index('movies').update_filterable_attributes([
325334
'director',
326335
'producer',
327336
'genres',
328337
'production_companies'
329338
])
330-
faceted_search_walkthrough_facet_filters_1: |-
339+
faceted_search_walkthrough_filter_1: |-
331340
client.index('movies').search('thriller', {
332-
'facetFilters': [['genres:Horror', 'genres:Mystery'], 'director:Jordan Peele']
341+
'filter': [['genres = Horror', 'genres = Mystery'], 'director = "Jordan Peele"']
333342
})
334343
faceted_search_walkthrough_facets_distribution_1: |-
335344
client.index('movies').search('Batman', {
@@ -339,18 +348,5 @@ post_dump_1: |-
339348
client.create_dump()
340349
get_dump_status_1: |-
341350
client.get_dump_status('20201101-110357260')
342-
get_attributes_for_faceting_1: |-
343-
client.index('movies').get_attributes_for_faceting()
344-
update_attributes_for_faceting_1: |-
345-
client.index('movies').update_attributes_for_faceting([
346-
'genres',
347-
'director'
348-
])
349-
reset_attributes_for_faceting_1: |-
350-
client.index('movies').reset_attributes_for_faceting()
351-
add_movies_json_1: |-
352-
import json
353-
354-
json_file = open('movies.json')
355-
movies = json.load(json_file)
356-
client.index('movies').add_documents(movies)
351+
phrase_search_1: |-
352+
client.index('movies').search('"african american" horror')

README.md

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ documents = [
8787
index.add_documents(documents) # => { "updateId": 0 }
8888
```
8989

90-
With the `updateId`, you can check the status (`enqueued`, `processed` or `failed`) of your documents addition using the [update endpoint](https://docs.meilisearch.com/reference/api/updates.html#get-an-update-status).
90+
With the `updateId`, you can check the status (`enqueued`, `processing`, `processed` or `failed`) of your documents addition using the [update endpoint](https://docs.meilisearch.com/reference/api/updates.html#get-an-update-status).
9191

9292
#### Basic Search <!-- omit in toc -->
9393

@@ -117,10 +117,9 @@ All the supported options are described in the [search parameters](https://docs.
117117

118118
```python
119119
index.search(
120-
'prince',
120+
'hob',
121121
{
122-
'attributesToHighlight': ['title'],
123-
'filters': 'book_id > 10'
122+
'attributesToHighlight': ['*'],
124123
}
125124
)
126125
```
@@ -131,24 +130,24 @@ JSON output:
131130
{
132131
"hits": [
133132
{
134-
"book_id": 456,
135-
"title": "Le Petit Prince",
133+
"book_id": 1344,
134+
"title": "The Hobbit",
136135
"_formatted": {
137-
"book_id": 456,
138-
"title": "Le Petit <em>Prince</em>"
136+
"book_id": 1344,
137+
"title": "The <em>Hob</em>bit"
139138
}
140139
}
141140
],
142141
"offset": 0,
143142
"limit": 20,
144-
"processingTimeMs": 10,
145-
"query": "prince"
143+
"processingTimeMs": 0,
144+
"query": "hob"
146145
}
147146
```
148147

149148
## 🤖 Compatibility with MeiliSearch
150149

151-
This package only guarantees the compatibility with the [version v0.20.0 of MeiliSearch](https://github.com/meilisearch/MeiliSearch/releases/tag/v0.20.0).
150+
This package only guarantees the compatibility with the [version v0.21.0 of MeiliSearch](https://github.com/meilisearch/MeiliSearch/releases/tag/v0.21.0).
152151

153152
## 💡 Learn More
154153

meilisearch/config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class Paths():
2323
stop_words = 'stop-words'
2424
synonyms = 'synonyms'
2525
accept_new_fields = 'accept-new-fields'
26-
attributes_for_faceting = 'attributes-for-faceting'
26+
filterable_attributes = 'filterable-attributes'
2727
dumps = 'dumps'
2828

2929
def __init__(

meilisearch/index.py

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ def get_all_update_status(self) -> List[Dict[str, Any]]:
151151
Returns
152152
-------
153153
update:
154-
List of all enqueued and processed actions of the index.
154+
List of all enqueued, processing, processed or failed actions of the index.
155155
156156
Raises
157157
------
@@ -215,7 +215,7 @@ def wait_for_pending_update(
215215
while elapsed_time < timeout_in_ms:
216216
get_update = self.get_update_status(update_id)
217217

218-
if get_update['status'] != 'enqueued':
218+
if get_update['status'] != 'enqueued' and get_update['status'] != 'processing':
219219
return get_update
220220
sleep(interval_in_ms / 1000)
221221
time_delta = datetime.now() - start_time
@@ -973,34 +973,34 @@ def reset_synonyms(self) -> Dict[str, int]:
973973
self.__settings_url_for(self.config.paths.synonyms),
974974
)
975975

976-
# ATTRIBUTES FOR FACETING SUB-ROUTES
976+
# FILTERABLE ATTRIBUTES SUB-ROUTES
977977

978-
def get_attributes_for_faceting(self) -> List[str]:
978+
def get_filterable_attributes(self) -> List[str]:
979979
"""
980-
Get attributes for faceting of the index.
980+
Get filterable attributes of the index.
981981
982982
Returns
983983
-------
984984
settings:
985-
List containing the attributes for faceting of the index
985+
List containing the filterable attributes of the index
986986
987987
Raises
988988
------
989989
MeiliSearchApiError
990990
An error containing details about why MeiliSearch can't process your request. MeiliSearch error codes are described here: https://docs.meilisearch.com/errors/#meilisearch-errors
991991
"""
992992
return self.http.get(
993-
self.__settings_url_for(self.config.paths.attributes_for_faceting)
993+
self.__settings_url_for(self.config.paths.filterable_attributes)
994994
)
995995

996-
def update_attributes_for_faceting(self, body: List[str]) -> Dict[str, int]:
996+
def update_filterable_attributes(self, body: List[str]) -> Dict[str, int]:
997997
"""
998-
Update attributes for faceting of the index.
998+
Update filterable attributes of the index.
999999
10001000
Parameters
10011001
----------
10021002
body:
1003-
List containing the attributes for faceting.
1003+
List containing the filterable attributes.
10041004
10051005
Returns
10061006
-------
@@ -1014,12 +1014,12 @@ def update_attributes_for_faceting(self, body: List[str]) -> Dict[str, int]:
10141014
An error containing details about why MeiliSearch can't process your request. MeiliSearch error codes are described here: https://docs.meilisearch.com/errors/#meilisearch-errors
10151015
"""
10161016
return self.http.post(
1017-
self.__settings_url_for(self.config.paths.attributes_for_faceting),
1017+
self.__settings_url_for(self.config.paths.filterable_attributes),
10181018
body
10191019
)
10201020

1021-
def reset_attributes_for_faceting(self) -> Dict[str, int]:
1022-
"""Reset attributes for faceting of the index to default values.
1021+
def reset_filterable_attributes(self) -> Dict[str, int]:
1022+
"""Reset filterable attributes of the index to default values.
10231023
10241024
Returns
10251025
-------
@@ -1033,7 +1033,7 @@ def reset_attributes_for_faceting(self) -> Dict[str, int]:
10331033
An error containing details about why MeiliSearch can't process your request. MeiliSearch error codes are described here: https://docs.meilisearch.com/errors/#meilisearch-errors
10341034
"""
10351035
return self.http.delete(
1036-
self.__settings_url_for(self.config.paths.attributes_for_faceting),
1036+
self.__settings_url_for(self.config.paths.filterable_attributes),
10371037
)
10381038

10391039
@staticmethod

meilisearch/tests/client/test_client_version_meilisearch.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@ def test_get_version(client):
44
response = client.get_version()
55
assert 'pkgVersion' in response
66
assert 'commitSha' in response
7-
assert 'buildDate' in response
7+
assert 'commitDate' in response

0 commit comments

Comments
 (0)