server-tools
server-tools copied to clipboard
[IMP] base_search_fuzzy - add support of translatable fields
depends on:
- https://github.com/odoo/odoo/pull/232993
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
:warning: For en_US to work with operator % this requires a patch on the core https://github.com/odoo/odoo/pull/232993
@sbidoul Thanks for the review, I made the fixes following your remarks.