Repository navigation
Description
DRAFT 7 (SDK, 2026-10-27) — candidate issue, not yet filed
Title: [Bug]: FulltextIndex.create_index swallows server errors with print() and always reports clean failure; algorithm parameter silently ignored
Description
(The algorithm-ignored half of this report is adjacent to #31219 — CLOSED, which covered the with_algorithm/BM25 builder path. The un-filed core of this report is the error swallowing in the same create_index/drop_index call path: the server's real error never reaches the caller, and the ignored algorithm is listed only as context.)
FulltextIndex.create_index/drop_index (matrixone/sqlalchemy_ext/fulltext_index.py) catch every server exception and turn it into a stdout print plus a False return:
except Exception as e:
print(f"Failed to create fulltext index: {e}")
return FalseThe caller chain makes it worse — FulltextIndexManager.create() (fulltext_manager.py:~165) then just does:
if not success:
raise QueryError(f"Failed to create fulltext index {name} on table {table_name}")So the server's actual error text never reaches the API user: they get a generic "Failed to create fulltext index" (with names only) while the real cause (syntax error, privilege, duplicate index, experimental flag off — SET experimental_fulltext_index is required per _build_enable_sql) went to stdout, invisible in any app that doesn't watch the console. In server environments (aiohttp/FastAPI workers), the print is lost entirely.
Second defect in the same API: the algorithm parameter is accepted and ignored. The docstring says "stored for reference, not in DDL" but the module docstring of FulltextIndexManager advertises client.fulltext_index.create("documents", "idx_content", "content", algorithm="BM25") as creating a BM25 index. The correct server mechanism exists (SET ft_relevancy_algorithm = "BM25" per the create_index docstring) but the code never issues that SET — so BM25-requesting users silently get default TF-IDF ranking; search relevance differs from the documented behavior with no warning.
Thirdly the DDL itself is unescaped f-string interpolation: f"CREATE FULLTEXT INDEX {name} ON {table_name} ({columns_str})" — part of the escaping family already filed this round; listed for completeness, main content of this issue is the error-swallowing + ignored algorithm.
Reproduction
client.fulltext_index.create("articles", "bad_name!", ["col'"]) # invalid identifier
# server: clear 1064-ish error with position info
# SDK user sees: QueryError("Failed to create fulltext index bad_name! on table articles")
# console (if watched): the real error — one print() line
# no exception chaining (raise ... from None semantics via the except-swallow), no logger useBM25:
client.fulltext_index.create("docs", "ft", "body", algorithm="BM25")
# DDL executed: CREATE FULLTEXT INDEX ft ON docs (body) ← no algorithm anywhere
# ranking behaves as TF-IDFImpact
- Diagnosing fulltext failures from application logs is impossible (the only real error is a print to stdout).
- The heavy
try/except Exceptionalso masks programming errors (wrong bind type, missing connection attr) as "Failed to create". - BM25 users get worse relevance with zero signal — hard-to-debug search-quality complaints.
Expected behavior
create_index/drop_indexshould raise (or return(ok, error)); at minimum preserve the server message and chain (raise QueryError(...) from e), and use the SDK logger, never print().- Honor
algorithm: issueSET ft_relevancy_algorithm = <algorithm>on the bind before creating the index (and restore the prior value after), or raiseNotImplementedError("algorithm is not applied; use SET ft_relevancy_algorithm manually")so the parameter stops being decorative. Reconcile the module docstring examples as well. - Escape identifiers in the DDL (tracked with the escaping-family issue already filed — [Bug]: SDK _escape_string/_escape_identifier are no-ops that only wrap quotes #31375/[Bug]: single-row _build_insert_sql does not escape quotes, crashes on batch key mismatch, quotes numerics #31376).
Activity
fix(python): unify SDK query and analytics lifecycle contracts (#31774)
XuPeng-SH commentedon Oct 30, 2026
QA handoff for merged #31774 (main
bbfe55669a1440424914d45a283a1d0e36f722fa): please verify the reported public SDK contract and its failure/recovery controls for fulltext create_index swallows server errors with print(). This isolated QA run inspected the issue and merged PR but did not run tests or a live MatrixOne service at this SHA because the existing resource guard left insufficient headroom. The PR's author-reported validation is separate evidence, not a result of this QA run.Ariznawlll commentedon Oct 30, 2026
结论
测试通过。全文索引操作失败时 SDK 保留服务端错误作为异常原因;不支持的 BM25 索引参数明确拒绝,不再被静默忽略。
关键证据
main@d39d8a40343ccd40bf665036388df7a40ee867f8;修复 PR fix(python): unify SDK query and analytics lifecycle contracts #31774 合并提交bbfe55669a1440424914d45a283a1d0e36f722fa位于祖先链;实际二进制与 SDK 同完整 SHA。本地隔离 1 CN / 1 TN / 1 LogService,Python 3.12。待解决点
Ariznawlll commentedon Oct 30, 2026
回归位置更正:#295 已关闭并汇总至 MOTR #298,该 issue 的定向用例已包含在 #298。此前测试证据与未覆盖项不变;#298 尚未合入,完整 MOTR suite 未运行。