diff options
author | Alexander Werner <alex@documentfoundation.org> | 2011-11-19 01:00:03 +0000 |
---|---|---|
committer | Alexander Werner <alex@documentfoundation.org> | 2011-11-19 01:00:03 +0000 |
commit | 67ad1a427db7a791ae9e0d7e2c1cefcc820cc657 (patch) | |
tree | cd318bca2d5e52059f105760ff68ce907890968b | |
parent | c6e74987c11535932315d592e83343ea3781715e (diff) | |
download | askbot-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.py | 4 |
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, } |