feat(db): Improve BuildCaseInsensitiveLike with lowercase#36598
feat(db): Improve BuildCaseInsensitiveLike with lowercase#36598silverwind merged 17 commits intogo-gitea:mainfrom
Conversation
There was a problem hiding this comment.
Pull request overview
Adds PostgreSQL-specific handling for case-insensitive matching in shared DB query helpers, and tightens a user search condition to avoid unnecessary full-name matching when the search term is empty.
Changes:
- Update
BuildCaseInsensitiveLiketo use SQLiteCOLLATE NOCASE, PostgreSQLILIKE, andLOWER(...)fallback for other DBs. - Add a PostgreSQL-specific implementation for
BuildCaseInsensitiveIn. - Avoid adding the full-name OR condition when
search == ""inGetIssuePostersWithSearch.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| models/repo/user_repo.go | Guards full-name OR condition behind search != "" to avoid redundant full-name matching when search is empty. |
| models/db/common.go | Adds PostgreSQL branches for case-insensitive LIKE/IN and adjusts SQLite LIKE behavior. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Does this fix any open issues? Maybe to a quick search. |
I did a quick search but couldn't find an existing issue for this. |
|
Ok, I also double checked in Claude, it did not find any exactly related issue. |
If |
It is anticipated that most of the user input will be in lowercase, which will reduce the case conversion rate. |
Removed comment about PostgreSQL ILIKE usage in BuildCaseInsensitiveLike function. Signed-off-by: Tyrone Yeh <siryeh@gmail.com>
Show me with a real world case, to show that it really brings "noticeable performance" improvement. |
You can do benchmark with this: For some long texts like https://www.lipsum.com/ : |
…6598) Improve BuildCaseInsensitiveLike with lowercase, users are more likely to input lowercase letters, so lowercase letters are used. --------- Signed-off-by: Tyrone Yeh <siryeh@gmail.com> Co-authored-by: silverwind <me@silverwind.io> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* origin/main: (2555 commits) automate updating nix flakes (go-gitea#35641) Update AGENTS.md instructions (go-gitea#36627) use user id in noreply emails (go-gitea#36550) feat(db): Improve BuildCaseInsensitiveLike with lowercase (go-gitea#36598) [skip ci] Updated translations via Crowdin BUG: Fix workflow run jobs API returning null steps (go-gitea#36603) Refactor highlight and diff (go-gitea#36599) Fix bug when do LFS GC (go-gitea#36500) feature to be able to filter project boards by milestones (go-gitea#36321) Update emoji data for Unicode 16 (go-gitea#36596) Adapt monaco error matching pattern to recent webpack config change (go-gitea#36533) Fix a bug user could change another user's primary email (go-gitea#36586) fix(repo-editor): disable Monaco `editContext` to avoid bugs with lost focus (go-gitea#36585) Fine tune diff highlighting (go-gitea#36592) Add code editor setting dropdowns (go-gitea#36534) Update to go 1.26.0 and golangci-lint 2.9.0 (go-gitea#36588) Improve diff highlighting (go-gitea#36583) Fix markup code block layout (go-gitea#36578) Remove striped tables in UI (go-gitea#36509) Fix vertical alignment of `.commit-sign-badge` children (go-gitea#36570) ... # Conflicts: # custom/conf/app.example.ini # docs/content/administration/config-cheat-sheet.en-us.md # docs/content/administration/config-cheat-sheet.zh-cn.md # modules/setting/security.go # routers/common/errpage.go # services/context/api.go # services/context/context.go


Improve BuildCaseInsensitiveLike with lowercase, users are more likely to input lowercase letters, so lowercase letters are used.