From: mathieu Date: Mon, 2 May 2016 08:27:49 +0000 (+0200) Subject: Fix build_query for query with punctuations X-Git-Tag: 1.6.2^2~15^2~6^2~14 X-Git-Url: https://git.parisson.com/?a=commitdiff_plain;h=73bf3c2cadf6619fca9fcd70428d374393bfe15a;p=telemeta.git Fix build_query for query with punctuations --- diff --git a/env/debug.env b/env/debug.env index 7a9fbbcc..a19e3477 100644 --- a/env/debug.env +++ b/env/debug.env @@ -18,4 +18,4 @@ BROKER_URL=redis://broker:6379/0 # If this is True, all tasks will be executed locally by blocking until the task returns. CELERY_ALWAYS_EAGER=False -REINDEX=True +REINDEX=False diff --git a/telemeta/util/backend.py b/telemeta/util/backend.py index 3db02c1e..c2f77577 100644 --- a/telemeta/util/backend.py +++ b/telemeta/util/backend.py @@ -21,13 +21,17 @@ class CustomElasticBackend(ElasticsearchSearchBackend): eb.setup() -import unicodedata# -class CustomElasticSearchQuery(ElasticsearchSearchQuery):# +import unicodedata +import sys +class CustomElasticSearchQuery(ElasticsearchSearchQuery): def build_query_fragment(self, field, filter_type, value): + value = re.sub(regexSpacePunc, " ", value) print("Query fragment :"+ field+ ' '+ filter_type+ ' '+ value) + sys.stdout.flush() valeur = super(CustomElasticSearchQuery, self).build_query_fragment(field, filter_type, value) print("Query fragment result "+ valeur) + sys.stdout.flush() return valeur def build_query(self):