summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Werner <alex@documentfoundation.org>2011-11-19 01:00:03 +0000
committerAlexander Werner <alex@documentfoundation.org>2011-11-19 01:00:03 +0000
commit67ad1a427db7a791ae9e0d7e2c1cefcc820cc657 (patch)
treecd318bca2d5e52059f105760ff68ce907890968b
parentc6e74987c11535932315d592e83343ea3781715e (diff)
downloadaskbot-67ad1a427db7a791ae9e0d7e2c1cefcc820cc657.tar.gz
askbot-67ad1a427db7a791ae9e0d7e2c1cefcc820cc657.tar.bz2
askbot-67ad1a427db7a791ae9e0d7e2c1cefcc820cc657.zip
Using plainto_tsquery instead of to_tsquery allows special characters in search
-rw-r--r--askbot/models/question.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/askbot/models/question.py b/askbot/models/question.py
index 7f38bd5c..c2d4be11 100644
--- a/askbot/models/question.py
+++ b/askbot/models/question.py
@@ -139,12 +139,12 @@ class QuestionQuerySet(models.query.QuerySet):
| models.Q(answers__text__search = search_query)
)
elif 'postgresql_psycopg2' in askbot.get_database_engine_name():
- rank_clause = "ts_rank(question.text_search_vector, to_tsquery(%s))";
+ rank_clause = "ts_rank(question.text_search_vector, plainto_tsquery(%s))";
search_query = '&'.join(search_query.split())
extra_params = (search_query,)
extra_kwargs = {
'select': {'relevance': rank_clause},
- 'where': ['text_search_vector @@ to_tsquery(%s)'],
+ 'where': ['text_search_vector @@ plainto_tsquery(%s)'],
'params': extra_params,
'select_params': extra_params,
}