backend: add pg_bigm for CJK full text search - #82
Conversation
Add pg_bigm as a submodule under pglite/other_extensions and build it alongside the other third-party extensions. pg_bigm provides full text search based on 2-grams, which indexes CJK text effectively where the 3-gram based pg_trgm cannot. Unlike every other extension here, pg_bigm's Makefile only includes PGXS when USE_PGXS is set, and otherwise assumes it lives in the postgres tree as contrib/pg_bigm. That path resolves contrib-global.mk to a location that does not exist from other_extensions, so set the flag for its build and packaging targets.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ff747da42f
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| # behind USE_PGXS and otherwise assumes it sits in the postgres tree as | ||
| # contrib/pg_bigm, which resolves contrib-global.mk to a path that does not | ||
| # exist from here. Set the flag for its build and its packaging step only. | ||
| all-pg_bigm-recurse pg_bigm.tar.gz: export USE_PGXS = 1 |
There was a problem hiding this comment.
Export USE_PGXS for every pg_bigm recursive target
When make -C pglite/other_extensions clean, distclean, install, or another standard recursive target is run, $(recurse) still enters pg_bigm, but this target-specific export applies only to all and the packaging target. Those sub-makes therefore take pg_bigm's in-tree branch and try to include the nonexistent contrib/pg_bigm build files described immediately above, causing otherwise supported Makefile targets to fail. Apply the export to all pg_bigm recursive targets (or arrange for the flag to be set inside the submodule invocation generally).
Useful? React with 👍 / 👎.
Motivation
pg_bigm is a community extension widely adopted in Asian market. It indexes text as 2-grams instead of pg_trgm's 3-grams. That is what makes
LIKE '%...%'searches usable on Asian language texts (Chinese, Japanese and Korean), where search terms are commonly one or two characters long.Solution
Adds pg_big to pglite/other_extensions so it is built and packaged alongside the other third-party extensions.
Every other extension here includes PGXS unconditionally. pg_bigm gates it behind USE_PGXS and otherwise assumes it lives in the postgres tree as contrib/pg_bigm, which resolves contrib-global.mk to a path that does not exist from other_extensions.
Rather than patch the submodule, the flag is set for its build and packaging targets only:
all-pg_bigm-recurse pg_bigm.tar.gz: export USE_PGXS = 1Happy to take a different approach here if you would rather not special-case it.
I will open a PR on https://github.com/electric-sql/pglite side if accepted.
Notes
Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.