Commit 0c4cc449 authored by Vincent Pelletier's avatar Vincent Pelletier

Add a special case for SearchableText: when there are mustiple MATCH...

Add a special case for SearchableText: when there are mustiple MATCH subqueries, sum up all scores. This used to fail and should be the most sensible default behaviour.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@25971 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent ed579d4e
......@@ -299,14 +299,18 @@ class SQLExpression(object):
for alias, column in sql_expression.getSelectDict().iteritems():
existing_value = result.get(alias)
if existing_value not in (None, column):
message = '%r is a known alias for column %r, can\'t alias it now to column %r' % (alias, existing_value, column)
if DEBUG:
message = message + '. I was created by %r, and I am working on %r (%r) out of [%s]' % (
self.query,
sql_expression,
sql_expression.query,
', '.join('%r (%r)' % (x, x.query) for x in self.sql_expression_list))
raise ValueError, message
if alias == 'SearchableText':
# Custom conflict resolution
column = '%s + %s' % (existing_value, column)
else:
message = '%r is a known alias for column %r, can\'t alias it now to column %r' % (alias, existing_value, column)
if DEBUG:
message = message + '. I was created by %r, and I am working on %r (%r) out of [%s]' % (
self.query,
sql_expression,
sql_expression.query,
', '.join('%r (%r)' % (x, x.query) for x in self.sql_expression_list))
raise ValueError, message
result[alias] = column
return result
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment