Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commita0aa70d

Browse files
committed
Fix update documents -- should be calling PATCH not POST.
1 parent2996a75 commita0aa70d

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

‎examples/collection_operations.py‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
# Add a book
5454

5555
hunger_games_book= {
56-
'id':'1','original_publication_year':2008,'authors': ['Suzanne Collins'],'average_rating':4.34,
56+
'id':'1','authors': ['Suzanne Collins'],'average_rating':4.34,
5757
'publication_year':2008,'title':'The Hunger Games',
5858
'image_url':'https://images.gr-assets.com/books/1447303603m/2767052.jpg',
5959
'ratings_count':4780653
@@ -125,6 +125,10 @@
125125
schema_change= {"fields": [{"name":"in_stock","optional":True,"type":"bool"}]}
126126
print(client.collections['books'].update(schema_change))
127127

128+
# Update value matching a filter
129+
updated_doc= {'publication_year':2009}
130+
print(client.collections['books'].documents.update(updated_doc, {'filter_by':'publication_year: 2008'}))
131+
128132
# Drop the field
129133
schema_change= {"fields": [{"name":"in_stock","drop":True}]}
130134
print(client.collections['books'].update(schema_change))

‎typesense/documents.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ def upsert(self, document, params=None):
4646
defupdate(self,document,params=None):
4747
params=paramsor {}
4848
params['action']='update'
49-
returnself.api_call.post(self._endpoint_path(),document,params)
49+
returnself.api_call.patch(self._endpoint_path(),document,params)
5050

5151
defimport_jsonl(self,documents_jsonl):
5252
logger.warning('`import_jsonl` is deprecated: please use `import_`.')

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp