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): ...@@ -299,14 +299,18 @@ class SQLExpression(object):
for alias, column in sql_expression.getSelectDict().iteritems(): for alias, column in sql_expression.getSelectDict().iteritems():
existing_value = result.get(alias) existing_value = result.get(alias)
if existing_value not in (None, column): 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 alias == 'SearchableText':
if DEBUG: # Custom conflict resolution
message = message + '. I was created by %r, and I am working on %r (%r) out of [%s]' % ( column = '%s + %s' % (existing_value, column)
self.query, else:
sql_expression, message = '%r is a known alias for column %r, can\'t alias it now to column %r' % (alias, existing_value, column)
sql_expression.query, if DEBUG:
', '.join('%r (%r)' % (x, x.query) for x in self.sql_expression_list)) message = message + '. I was created by %r, and I am working on %r (%r) out of [%s]' % (
raise ValueError, message 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 result[alias] = column
return result 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