`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
-
[Resource]: Lore未关闭resource-submission validation-passed
难度 1/5 1 小时以内 新手友好度 88/100
hesreallyhim/awesome-claude-code#3234 · 1 条评论 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
openminion/openminion#376 ·
维护者通常 1 天内回复
-
Type: ☹︎ Bug
难度 2/5 1-3 小时 新手友好度 78/100
posit-dev/great-tables#1028 ·
维护者通常 1 天内回复
-
integration: apple_tv
难度 2/5 1-3 小时 新手友好度 78/100
home-assistant/core#188282 · 1 条评论 ·
维护者通常 1 天内回复
-
A "since" range is worded as a career: "the past two seasons" says "regular season career (2025 on)"未关闭P4: low
难度 2/5 1-3 小时 新手友好度 65/100
jeffknupp/association#538 ·