diff --git a/product/ZSQLCatalog/SearchText/AdvancedSearchTextParser.py b/product/ZSQLCatalog/SearchText/AdvancedSearchTextParser.py index 0192514d5822fc08bc391d27612d6c95ae16d76d..762dfedc37363b7a3ca83c534ecf759244820e34 100644 --- a/product/ZSQLCatalog/SearchText/AdvancedSearchTextParser.py +++ b/product/ZSQLCatalog/SearchText/AdvancedSearchTextParser.py @@ -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]) diff --git a/product/ZSQLCatalog/tests/testSQLCatalog.py b/product/ZSQLCatalog/tests/testSQLCatalog.py index e5048737eec04d970883a8c358c486fb633be4fb..e3395a0eea2f541625ef180b8294d2791f1059d3 100644 --- a/product/ZSQLCatalog/tests/testSQLCatalog.py +++ b/product/ZSQLCatalog/tests/testSQLCatalog.py @@ -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'})