From 7ef4bd372c3b7e4fee6f6b0af204935e1355fc04 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Wed, 19 Oct 2022 10:15:29 +0200 Subject: [PATCH] Add missing index on value_compact of contact mechanism --- contact_mechanism.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/contact_mechanism.py b/contact_mechanism.py index 4843b0dc8b..64da90d810 100644 --- a/contact_mechanism.py +++ b/contact_mechanism.py @@ -10,8 +10,8 @@ except ImportError: from trytond.i18n import gettext from trytond.model import ( - DeactivableMixin, ModelSQL, ModelView, MultiValueMixin, ValueMixin, fields, - sequence_ordered) + DeactivableMixin, Index, ModelSQL, ModelView, MultiValueMixin, ValueMixin, + fields, sequence_ordered) from trytond.model.exceptions import AccessError from trytond.pyson import Eval from trytond.transaction import Transaction @@ -127,7 +127,11 @@ class ContactMechanism( @classmethod def __setup__(cls): cls.value.search_unaccented = False + cls.value_compact.search_unaccented = False super(ContactMechanism, cls).__setup__() + t = cls.__table__() + cls._sql_indexes.add( + Index(t, (Index.Unaccent(t.value_compact), Index.Similarity()))) cls._order.insert(0, ('party.distance', 'ASC NULLS LAST')) cls._order.insert(1, ('party', 'ASC'))