Skip to content

Changes related to the next MeiliSearch release (v0.25.0) #370

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 36 commits into from
Jan 12, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
b6bc02b
Update README.md
meili-bot Dec 6, 2021
c755c13
Modify header X-Meili-Api-Key by Authorization
alallema Dec 14, 2021
c90b725
Merge pull request #371 from meilisearch/api-header
alallema Dec 14, 2021
a1daa4e
Redesign update API to task API
alallema Dec 14, 2021
6c2e832
Changes due to the review
alallema Dec 21, 2021
4282ab6
Update README.md
alallema Dec 23, 2021
13c4ca1
Update meilisearch/client.py
alallema Dec 23, 2021
05f0810
Update meilisearch/client.py
alallema Dec 23, 2021
572fbf8
Update meilisearch/client.py
alallema Dec 23, 2021
e7e2fa8
Update meilisearch/client.py
alallema Dec 23, 2021
4469653
Update meilisearch/client.py
alallema Dec 23, 2021
d20e0f2
Update meilisearch/client.py
alallema Dec 23, 2021
f5001bb
Update meilisearch/client.py
alallema Dec 23, 2021
2ccb465
Update meilisearch/client.py
alallema Dec 23, 2021
ea69bea
Update tests/client/test_client_task_meilisearch.py
alallema Dec 23, 2021
68d915b
Changes after review
alallema Dec 23, 2021
1e8a35a
Modification after review
alallema Dec 29, 2021
c2a73da
Remove delete_if_exist and get_or_create
alallema Dec 29, 2021
e04de9e
Merge pull request #381 from meilisearch/remove_useless_method
alallema Dec 29, 2021
270ec3d
Merge branch 'bump-meilisearch-v0.25.0' into redesign-task
alallema Dec 29, 2021
36969e8
Merge pull request #372 from meilisearch/redesign-task
alallema Dec 29, 2021
e25c1de
Merge branch 'main' into bump-meilisearch-v0.25.0
alallema Dec 29, 2021
34f81f7
Add key methods
alallema Dec 29, 2021
5cbd39a
Modification due to review
alallema Dec 29, 2021
1e3354c
Remove option none
alallema Dec 29, 2021
13b6e65
Modification due to review
alallema Dec 30, 2021
4af8247
Modification due to review
alallema Dec 30, 2021
ba9ae2e
Merge pull request #382 from meilisearch/keys
alallema Dec 30, 2021
cd3e638
Fix typo in function name
alallema Jan 10, 2022
6d6c3a2
Fix results in get_keys
alallema Jan 10, 2022
81bdb14
Merge branch 'main' into bump-meilisearch-v0.25.0
alallema Jan 10, 2022
dbfd3d3
Add new code samples
alallema Jan 11, 2022
bec9675
Merge pull request #396 from meilisearch/code_samples
alallema Jan 11, 2022
5926c64
Fixing code samples
alallema Jan 11, 2022
e260ef5
Update README.md
alallema Jan 11, 2022
1c69904
Fix after review
alallema Jan 11, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 55 additions & 5 deletions .code-samples.meilisearch.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ create_an_index_1: |-
update_an_index_1: |-
client.index('movies').update(primary_key='movie_review_id')
delete_an_index_1: |-
client.delete_index('movies')
// OR
client.index('movies').delete()
get_one_document_1: |-
client.index('movies').get_document(25684)
Expand Down Expand Up @@ -39,12 +41,35 @@ delete_documents_1: |-
client.index('movies').delete_documents([23488, 153738, 437035, 363869])
search_post_1: |-
client.index('movies').search('American ninja')
get_update_1: |-
client.index('movies').get_update_status(1)
get_all_updates_1: |-
client.index('movies').get_all_update_status()
get_keys_1: |-
get_task_by_index_1: |-
client.index('movies').get_task(1)
get_all_tasks_1: |-
client.get_tasks()
get_task_1: |-
client.get_task(1)
get_all_tasks_by_index_1: |-
client.index('movies').get_tasks()
get_one_key_1: |-
client.get_key('d0552b41536279a0ad88bd595327b96f01176a60c2243e906c52ac02375f9bc4')
get_all_keys_1: |-
client.get_keys()
create_a_key_1: |-
client.create_key(options={
'description': 'Add documents: Products API key',
'actions': ['documents.add'],
'indexes': ['products'],
'expiresAt': '2042-04-02T00:42:42Z'
})
update_a_key_1: |-
client.update_key(key='d0552b41536279a0ad88bd595327b96f01176a60c2243e906c52ac02375f9bc4',
options={
'description': 'Manage documents: Products/Reviews API key',
'actions': ['documents.add', 'documents.delete'],
'indexes': ['products', 'reviews'],
'expiresAt': '2042-04-02T00:42:42Z'
})
delete_a_key_1: |-
client.delete_key('d0552b41536279a0ad88bd595327b96f01176a60c2243e906c52ac02375f9bc4')
get_settings_1: |-
client.index('movies').get_settings()
update_settings_1: |-
Expand Down Expand Up @@ -423,3 +448,28 @@ geosearch_guide_sort_usage_2: |-
client.index('restaurants').search('', {
'sort': ['_geoPoint(48.8583701,2.2922926):asc', 'rating:desc']
})
security_guide_search_key_1: |-
client = Client('http://127.0.0.1:7700', 'apiKey')
client.index('patient_medical_records').search()
security_guide_update_key_1: |-
client = Client('http://127.0.0.1:7700', 'masterKey')
client.update_key(key='d0552b41536279a0ad88bd595327b96f01176a60c2243e906c52ac02375f9bc4', options={
'indexes': ['doctors']
})
security_guide_create_key_1: |-
client = Client('http://127.0.0.1:7700', 'masterKey')
client.create_key(options={
'description': 'Search patient records key',
'actions': ['search'],
'indexes': ['patient_medical_records'],
'expiresAt': '2023-01-01T00:00:00Z'
})
security_guide_list_keys_1: |-
client = Client('http://127.0.0.1:7700', 'masterKey')
client.get_keys()
security_guide_delete_key_1: |-
client = Client('http://127.0.0.1:7700', 'masterKey')
client.delete_key('d0552b41536279a0ad88bd595327b96f01176a60c2243e906c52ac02375f9bc4')
authorization_header_1: |-
client = Client('http://127.0.0.1:7700', 'masterKey')
client.get_keys()
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,10 @@ documents = [
]

# If the index 'movies' does not exist, MeiliSearch creates it when you first add the documents.
index.add_documents(documents) # => { "updateId": 0 }
index.add_documents(documents) # => { "uid": 0 }
```

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).
With the task `uid`, you can check the status (`enqueued`, `processing`, `succeeded` or `failed`) of your documents addition using the [task](https://docs.meilisearch.com/reference/api/tasks.html#get-task).

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

Expand Down Expand Up @@ -165,7 +165,7 @@ index.update_filterable_attributes([

You only need to perform this operation once.

Note that MeiliSearch will rebuild your index whenever you update `filterableAttributes`. Depending on the size of your dataset, this might take time. You can track the process using the [update status](https://docs.meilisearch.com/reference/api/updates.html#get-an-update-status).
Note that MeiliSearch will rebuild your index whenever you update `filterableAttributes`. Depending on the size of your dataset, this might take time. You can track the process using the [task](https://docs.meilisearch.com/reference/api/tasks.html#get-task).

Then, you can perform the search:

Expand Down Expand Up @@ -197,7 +197,7 @@ index.search(

## 🤖 Compatibility with MeiliSearch

This package only guarantees the compatibility with the [version v0.24.0 of MeiliSearch](https://github.com/meilisearch/MeiliSearch/releases/tag/v0.24.0).
This package only guarantees the compatibility with the [version v0.25.0 of MeiliSearch](https://github.com/meilisearch/MeiliSearch/releases/tag/v0.25.0).

## 💡 Learn More

Expand Down
10 changes: 9 additions & 1 deletion meilisearch/_httprequests.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class HttpRequests:
def __init__(self, config: Config) -> None:
self.config = config
self.headers = {
'X-Meili-Api-Key': self.config.api_key,
'Authorization': f'Bearer {self.config.api_key}',
}

def send_request(
Expand Down Expand Up @@ -60,6 +60,14 @@ def post(
) -> Any:
return self.send_request(requests.post, path, body, content_type)

def patch(
self,
path: str,
body: Optional[Union[Dict[str, Any], List[Dict[str, Any]], List[str], str]] = None,
content_type: Optional[str] = 'application/json',
) -> Any:
return self.send_request(requests.patch, path, body, content_type)

def put(
self,
path: str,
Expand Down
Loading