changeset 7b335e7b434b in modules/party:default
details: https://hg.tryton.org/modules/party?cmd=changeset&node=7b335e7b434b
description:
        Add missing index on value_compact of contact mechanism
diffstat:

 contact_mechanism.py |  8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diffs (26 lines):

diff -r 2f31dc5c4a70 -r 7b335e7b434b contact_mechanism.py
--- a/contact_mechanism.py      Sun Oct 16 14:14:10 2022 +0200
+++ b/contact_mechanism.py      Wed Oct 19 10:15:29 2022 +0200
@@ -10,8 +10,8 @@
 
 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 @@
     @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'))
 

Reply via email to