changeset b634739721c9 in trytond:default
details: https://hg.tryton.org/trytond?cmd=changeset&node=b634739721c9
description:
        Add configuration entries for unaccent and similarity functions

        issue10851
        review370001002
diffstat:

 CHANGELOG                              |   1 +
 doc/topics/configuration.rst           |  14 ++++++++++++++
 trytond/backend/postgresql/database.py |   5 +++--
 3 files changed, 18 insertions(+), 2 deletions(-)

diffs (51 lines):

diff -r fa9f7d4695e6 -r b634739721c9 CHANGELOG
--- a/CHANGELOG Sun Oct 09 18:51:02 2022 +0200
+++ b/CHANGELOG Sun Oct 09 19:58:51 2022 +0200
@@ -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 -r fa9f7d4695e6 -r b634739721c9 doc/topics/configuration.rst
--- a/doc/topics/configuration.rst      Sun Oct 09 18:51:02 2022 +0200
+++ b/doc/topics/configuration.rst      Sun Oct 09 19:58:51 2022 +0200
@@ -229,6 +229,20 @@
 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 -r fa9f7d4695e6 -r b634739721c9 trytond/backend/postgresql/database.py
--- a/trytond/backend/postgresql/database.py    Sun Oct 09 18:51:02 2022 +0200
+++ b/trytond/backend/postgresql/database.py    Sun Oct 09 19:58:51 2022 +0200
@@ -76,12 +76,13 @@
 
 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):

Reply via email to