[copr] master: Fix the query not to fail on arguments with whitespace (3693b5d)

bkabrda at fedoraproject.org bkabrda at fedoraproject.org
Fri Feb 1 13:22:46 UTC 2013


Repository : http://git.fedorahosted.org/cgit/copr.git

On branch  : master

>---------------------------------------------------------------

commit 3693b5d38ca988f94c19315c7544f297d90d38a1
Author: Bohuslav Kabrda <bkabrda at redhat.com>
Date:   Fri Feb 1 14:21:11 2013 +0100

    Fix the query not to fail on arguments with whitespace


>---------------------------------------------------------------

 coprs_frontend/coprs/sql_custom.py |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/coprs_frontend/coprs/sql_custom.py b/coprs_frontend/coprs/sql_custom.py
index 056b3f3..8a4aa62 100644
--- a/coprs_frontend/coprs/sql_custom.py
+++ b/coprs_frontend/coprs/sql_custom.py
@@ -1,3 +1,4 @@
+from sqlalchemy import func
 from sqlalchemy import types
 from sqlalchemy.ext import compiler
 
@@ -19,6 +20,6 @@ def compile_tsvector(element, compiler, **kw):
 class FullTextQuery(db.Query):
     def fulltext(self, column, search_string):
         if db.engine.dialect.name == 'postgresql':
-            return self.filter(column.match(search_string))
+            return self.filter(column.op('@@@')(func.plainto_tsquery(search_string)))
         else:
             return self.filter(column.like('%{0}%'.format(search_string)))



More information about the copr-devel mailing list