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 摘要。