Repository navigation
fix(python): group additional fulltext WHERE predicates - #32019
mergify[bot] merged 4 commits into
Conversation
Qodo reviews are paused for this user.Troubleshooting steps vary by plan Learn more → On a Teams plan? Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center? |
|
mo-bot review · Commit: Review completed. Read the assessment. |
XuPeng-SH
left a comment
There was a problem hiding this comment.
mo-bot review · mo-bot-local · review
Commit: f81426bbc2ee925ace2af087d84828c43f645c1f
Assessment: approve
Both builders correctly group additional predicates, preventing OR conditions from bypassing MATCH or other filters. No actionable findings.
Model: gpt-6-astra / xhigh
Session: 01a1869d-999c-7481-b340-ae4a63e8cee4 · slot 1 · generation 2
Validation:
-
Reviewed the complete delta, public consumers, linked issue and all discussion entries.
-
Reused eight successful current-head SDK offline CI jobs; verified their selection includes the new regression tests.
-
Local syntax, Boolean-oracle, source-identity and discussion-coverage checks passed; receipt: checks/1793607510914380272-2.json.
-
Saved review plan, discussion assessment and validation evidence; source remains unchanged.
Limitations:
- No local SDK pytest rerun or live MatrixOne scoring validation. Raw CI logs were not supplied.
✅ Merged into
|
What type of PR is this?
Which issue(s) this PR fixes:
Fixes #32018
What this PR does / why we need it:
An additional condition such as
category = 'a' OR category = 'b'was concatenated directly after MATCH with AND. SQL precedence then allowed category b rows to bypass the search predicate; chained conditions could also bypass one another.Wrap each additional predicate in parentheses in both
FulltextQueryBuilder.as_sql()andFulltextSearchBuilder._build_sql(). The resulting expression isMATCH(...) AND (condition1) AND (condition2).Add eight regression/control cases covering both public builders, an OR condition alone, OR in the first or last chained condition, and no additional conditions. Tests execute the generated Boolean SQL in SQLite with only MATCH replaced by a precomputed score column; they verify grouping independently of fulltext scoring. No live MatrixOne server validation is claimed.
Validation on base d24f446 (Python 3.12, SQLAlchemy 2.1.6):
Production delta: two changed lines; queries without additional predicates retain their SQL.