Commit bb19c7bc authored by Vincent Pelletier's avatar Vincent Pelletier

Change implicit SearchText expression logical operator to 'and' instead of 'or'.

Update test to new desired behaviour.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@26451 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent ab84a7ce
......@@ -155,7 +155,7 @@ class AdvancedSearchTextParser(lexer):
if len(p) == 2:
p[0] = p[1]
elif len(p) == 3:
p[0] = p[1].push('or', p[2])
p[0] = p[1].push('and', p[2])
else:
p[0] = p[1].push('or', p[3])
......
......@@ -174,11 +174,11 @@ class TestSQLCatalog(unittest.TestCase):
{column: '!=a'})
self.catalog(ReferenceQuery(ReferenceQuery(operator='=', default='a b'), operator='and'),
{column: 'a b'})
self.catalog(ReferenceQuery(ReferenceQuery(ReferenceQuery(operator='=', default='a'), ReferenceQuery(operator='>', default='b'), operator='or'), operator='and'),
self.catalog(ReferenceQuery(ReferenceQuery(ReferenceQuery(operator='=', default='a'), ReferenceQuery(operator='>', default='b'), operator='and'), operator='and'),
{column: 'a >b'})
self.catalog(ReferenceQuery(ReferenceQuery(operator='=', default='a > b'), operator='and'),
{column: 'a > b'})
self.catalog(ReferenceQuery(ReferenceQuery(ReferenceQuery(operator='>', default='a'), ReferenceQuery(operator='>', default='b'), operator='or'), operator='and'),
self.catalog(ReferenceQuery(ReferenceQuery(ReferenceQuery(operator='>', default='a'), ReferenceQuery(operator='>', default='b'), operator='and'), operator='and'),
{column: '>a >b'})
self.catalog(ReferenceQuery(ReferenceQuery(operator='=', default='>a >b'), operator='and'),
{column: '">a >b"'})
......@@ -353,8 +353,11 @@ class TestSQLCatalog(unittest.TestCase):
self.catalog(ReferenceQuery(ReferenceQuery(operator='like', keyword='%"a" OR "b"%'), operator='and'),
{'keyword': '"\\"a\\" OR \\"b\\""'})
self.catalog(ReferenceQuery(ReferenceQuery(ReferenceQuery(operator='match', fulltext='a'),
ReferenceQuery(ReferenceQuery(operator='match', fulltext='b'), operator='not'), operator='or'), operator='and'),
ReferenceQuery(ReferenceQuery(operator='match', fulltext='b'), operator='not'), operator='and'), operator='and'),
{'fulltext': 'a NOT b'})
self.catalog(ReferenceQuery(ReferenceQuery(ReferenceQuery(operator='match', fulltext='a'),
ReferenceQuery(ReferenceQuery(operator='match', fulltext='b'), operator='not'), operator='or'), operator='and'),
{'fulltext': 'a OR NOT b'})
self.catalog(ReferenceQuery(ReferenceQuery(ReferenceQuery(operator='match', fulltext='a'),
ReferenceQuery(ReferenceQuery(operator='match', fulltext='b'), operator='not'), operator='and'), operator='and'),
{'fulltext': 'a AND NOT b'})
......
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