From 88e8d42f27595b8e7db6df434b7086ba5d34a5be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20=C3=89vrard?= Date: Sun, 9 Oct 2022 19:58:51 +0200 Subject: [PATCH] Add configuration entries for unaccent and similarity functions issue10851 review370001002 --- CHANGELOG | 1 + doc/topics/configuration.rst | 14 ++++++++++++++ trytond/backend/postgresql/database.py | 5 +++-- 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 9aa2a71af4..e7ce36afda 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,4 @@ +* Add configuration entries for unaccent and similarity functions * Add authentication services * Schedule actions using server timezone * Reset the user sessions less often diff --git a/doc/topics/configuration.rst b/doc/topics/configuration.rst index f700992054..c62126d31d 100644 --- a/doc/topics/configuration.rst +++ b/doc/topics/configuration.rst @@ -229,6 +229,20 @@ maxconn The maximum number of simultaneous connections to the database per process. Default: ``64`` +unaccent_function +~~~~~~~~~~~~~~~~~ + +The name of the unaccent function. + +Default: ``unaccent`` + +similarity_function +~~~~~~~~~~~~~~~~~~~ + +The name of the similarity function. + +Default: ``similarity`` + request ------- diff --git a/trytond/backend/postgresql/database.py b/trytond/backend/postgresql/database.py index 884f703dfc..d7b2323229 100644 --- a/trytond/backend/postgresql/database.py +++ b/trytond/backend/postgresql/database.py @@ -76,12 +76,13 @@ class ForSkipLocked(For): class Unaccent(Function): __slots__ = () - _function = 'unaccent' + _function = config.get('database', 'unaccent_function', default='unaccent') class Similarity(Function): __slots__ = () - _function = 'similarity' + _function = config.get( + 'database', 'similarity_function', default='similarity') class Match(BinaryOperator):