Permalink
Browse files

Using plainto_tsquery instead of to_tsquery allows special characters…

… in search
  • Loading branch information...
awerner committed Nov 19, 2011
1 parent c6e7498 commit 67ad1a427db7a791ae9e0d7e2c1cefcc820cc657
Showing with 2 additions and 2 deletions.
  1. +2 −2 askbot/models/question.py
@@ -139,12 +139,12 @@ def get_by_text_query(self, search_query):
| 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,
}

0 comments on commit 67ad1a4

Please sign in to comment.