Skip to content

Find CJK words inside post titles and descriptions - #1767

Open
jayhemnani9910 wants to merge 1 commit into
getfider:mainfrom
jayhemnani9910:fix/search-cjk-substring
Open

jayhemnani9910 wants to merge 1 commit into
getfider:mainfrom
jayhemnani9910:fix/search-cjk-substring

Conversation

@jayhemnani9910

Copy link
Copy Markdown

Issue: Fixes #1766

Searching for 中文 didn't find a post titled 有中文路径下无法使用. Postgres has no CJK parser, so a run of Chinese is a single lexeme and only a prefix of the whole run matched.

When a search word has Han, Kana or Hangul characters, it now also matches with ILIKE '%word%' on the title and description. Searches without CJK characters run the same query as before.

The new test fails without the change, and go test ./app/services/sqlstore/postgres/ passes on Postgres 17. ILIKE '%word%' can't use the search index, so a CJK query on a very large board scans its posts.


Checklist

Postgres has no CJK parser, so a run of Chinese was one lexeme and only
a prefix of the whole run matched. Fixes getfider#1766

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Chinese text search does not work correctly

1 participant