Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

`documents.Documents.import_()` `batch_size` argument is ignored, type of `import_parameters` is missing `batch_size`

未关闭 适合新手
#124 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

@tharropoulos 已经在做这个了。

开始于 2026年2月20日。

  • #125 来自 @tharropoulos —— 未关闭

评估

难度
2/5
预计耗时
1-2 天
新手友好度
68/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
停滞
技术栈
python
领域
api

调研方向

从 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:

https://github.com/typesense/typesense-python/blob/e863b4407ed6bc2635e8981b6552c1b4e2eff8ca/src/typesense/types/document.py#L70

主要语言
Python
星标
247
派生
66
平均合并
22 小时 47 分钟
30 天内合并 PR
8

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

typesense/typesense-python 的其他 Issue

查看 typesense/typesense-python 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。