[copr] master: Alter the fulltext search to match any of the input string parts (b99fe34)
bkabrda at fedoraproject.org
bkabrda at fedoraproject.org
Mon Feb 4 13:01:40 UTC 2013
Repository : http://git.fedorahosted.org/cgit/copr.git
On branch : master
>---------------------------------------------------------------
commit b99fe34a65130ebe8e392733cb1864c62c5f0b28
Author: Bohuslav Kabrda <bkabrda at redhat.com>
Date: Mon Feb 4 12:23:50 2013 +0100
Alter the fulltext search to match any of the input string parts
>---------------------------------------------------------------
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 8a4aa62..3be56ed 100644
--- a/coprs_frontend/coprs/sql_custom.py
+++ b/coprs_frontend/coprs/sql_custom.py
@@ -20,6 +20,7 @@ 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.op('@@@')(func.plainto_tsquery(search_string)))
+ search_with_or = ' | '.join(search_string.split())
+ return self.filter(column.op('@@@')(func.to_tsquery(search_with_or)))
else:
return self.filter(column.like('%{0}%'.format(search_string)))
More information about the copr-devel
mailing list