Skip to content

[IMP] base_search_fuzzy - add support of translatable fields#3429

Merged
OCA-git-bot merged 1 commit into
OCA:18.0from
yvaucher:18-fuzzy-translatable
Jun 5, 2026
Merged

[IMP] base_search_fuzzy - add support of translatable fields#3429
OCA-git-bot merged 1 commit into
OCA:18.0from
yvaucher:18-fuzzy-translatable

Conversation

@yvaucher
Copy link
Copy Markdown
Member

depends on:

This allow to create a trigram index on translatable fields.

Searches on translatable fields look like this:

SELECT * FROM table WHERE COALESCE({column_name}->>'{lang}', {column_name}->>'en_US' % 'text'

On a DB with 8M dummy products (duplicated with odoo populate),

With a query containing

WHERE COALESCE("product_template"."name"->>'fr_FR', "product_template"."name"->>'en_US') % 'search text')

Without index
Execution Time: 10606.619 ms

With index:
Execution Time: 484.383 ms

⚠️ For en_US to work with operator % this requires a patch on the core odoo/odoo#232993

@yvaucher yvaucher force-pushed the 18-fuzzy-translatable branch from f8cfea5 to d7f9d2e Compare October 24, 2025 14:27
Comment thread base_search_fuzzy/models/trgm_index.py Outdated
Comment thread base_search_fuzzy/views/trgm_index.xml Outdated
@yvaucher yvaucher force-pushed the 18-fuzzy-translatable branch from d7f9d2e to 8c2bb35 Compare October 26, 2025 15:05
@yvaucher yvaucher force-pushed the 18-fuzzy-translatable branch from 8c2bb35 to e8c0b1a Compare October 26, 2025 15:09
@yvaucher
Copy link
Copy Markdown
Member Author

@sbidoul Thanks for the review, I made the fixes following your remarks.

Copy link
Copy Markdown
Member

@pedrobaeza pedrobaeza left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/ocabot merge major

@OCA-git-bot
Copy link
Copy Markdown
Contributor

Hey, thanks for contributing! Proceeding to merge this for you.
Prepared branch 18.0-ocabot-merge-pr-3429-by-pedrobaeza-bump-major, awaiting test results.

@OCA-git-bot OCA-git-bot merged commit 79424c9 into OCA:18.0 Jun 5, 2026
5 of 7 checks passed
@OCA-git-bot
Copy link
Copy Markdown
Contributor

Congratulations, your PR was merged at bca1713. Thanks a lot for contributing to OCA. ❤️

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants