`documents.Documents.import_()` `batch_size` argument is ignored, type of `import_parameters` is missing `batch_size`
評估
研究方向
從 src/typesense/sync/documents.py 的第 226-231 行附近以及 src/typesense/types/document.py 的第 70 行附近開始。使用提供的 bug.py 和 uv 命令重現該行為,然後驗證直接傳遞 batch_size 會影響請求,並且 import_parameters 型別接受它。當執行時行為和型別定義與文件一致時,即表示完成。
由索引模型根據 Issue 內容生成。
描述
Steps to reproduce:
Create a file named bug.py with the following contents:
import logging
logging.basicConfig()
logging.getLogger().setLevel(logging.DEBUG)
import typesense
from typesense.exceptions import TypesenseClientError
client = typesense.Client({
'api_key': 'abcd',
'nodes': [{
'host': 'localhost',
'port': '8108',
'protocol': 'http'
}],
'connection_timeout_seconds': 2
})
try:
client.collections["test"].documents.import_([{"id":1}], batch_size=42)
except:
pass
try:
client.collections["test"].documents.import_([{"id":1}], import_parameters=dict(batch_size=42))
except:
pass
uv init
uv add typesense
uv run bug.py 2>&1 | grep 'HTTP Request'
Outputs:
INFO:httpx:HTTP Request: POST http://localhost:8108/collections/test/documents/import "HTTP/1.1 401 Unauthorized"
INFO:httpx:HTTP Request: POST http://localhost:8108/collections/test/documents/import?batch_size=42 "HTTP/1.1 401 Unauthorized"
Documentation recommends the right thing:
https://typesense.org/docs/30.1/api/documents.html#index-multiple-documents
But the Python signature contradicts:
https://github.com/typesense/typesense-python/blob/master/src/typesense/sync/documents.py#L226-L231
And if someone uses DocumentWriteParameters for import_parameters a type checker will complain that there is no batch_size in DocumentWriteParameters which is true for the type, but wrong run-time as this is the only way to pass in a batch_size that will be added to the request query string:
- 主要語言
- Python
- 星號
- 247
- 分支
- 66
- 平均合併
- 22 小時 47 分鐘
- 30 天內合併 PR
- 8
環境準備
這個專案沒有提供開發容器、Dockerfile 或貢獻指南,環境需要你自己搭建:先看它的 README,通用步驟見我們的新手貢獻指南。
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
typesense/typesense-python 的其他 Issue
-
`MultiSearchResponse` type does not account for union search response shape可能已有人在做 @tharropoulos 於 172 天前認領。 未關閉
難度 2/5 1-3 小時 新手友好度 78/100
typesense/typesense-python#128 ·
-
難度 1/5 1 小時以內 新手友好度 68/100
typesense/typesense-python#100 ·
-
難度 3/5 1-2 天 新手友好度 35/100
typesense/typesense-python#122 · 3 則留言 ·
-
[Bug] - DeprecationWarning on instantiation of Client可能已有人在做 @tharropoulos 於 266 天前認領。 未關閉
難度 3/5 1-2 天 新手友好度 55/100
typesense/typesense-python#114 · 8 則留言 ·
-
難度 3/5 1-2 天 新手友好度 30/100
typesense/typesense-python#97 · 1 則留言 ·
查看 typesense/typesense-python 的全部 Issue
相似的 Issue
-
Python Volcengine provider returns failures instead of raising them可能已有人在做 @Ricardo-M-L 今天認領。 未關閉
難度 2/5 1-3 小時 新手友好度 79/100
agent-infra/sandbox#248 ·
-
Textractor leaves empty temporary files when remote retrieval fails可能已有人在做 @HuaTNA 今天認領。 未關閉
難度 2/5 1-3 小時 新手友好度 82/100
維護者通常 1 天內回覆
-
test(bm_generation): pin the learning parameters and CPU sync shortcut可能已有人在做 @iloveeyjafjalla 今天認領。 未關閉
難度 2/5 1-3 小時 新手友好度 78/100
qboson/kaiwu-pytorch-plugin#1341 ·
維護者通常 2 天內回覆
-
難度 2/5 1-3 小時 新手友好度 70/100
elder-plinius/V3R1T4S#625 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 62/100
維護者通常 1 天內回覆