Commit afae7b7c authored by Jérome Perrin's avatar Jérome Perrin

Add a few more tests for full text keys.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@20949 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent f37cf98c
...@@ -121,12 +121,14 @@ size/Child/34""" ...@@ -121,12 +121,14 @@ size/Child/34"""
def test_05FullTextKey(self, quiet=quiet, run=run_all_test): def test_05FullTextKey(self, quiet=quiet, run=run_all_test):
""" Check lexer for FullTextKey.""" """ Check lexer for FullTextKey."""
if not run: return if not run: return
self.compare(FullTextKey, 'John', ('WORD',))
self.compare(FullTextKey, 'John Doe', ('WORD', 'WORD',)) self.compare(FullTextKey, 'John Doe', ('WORD', 'WORD',))
self.compare(FullTextKey, '+John -Doe', self.compare(FullTextKey, '+John -Doe',
('PLUS', 'WORD', 'MINUS', 'WORD',)) ('PLUS', 'WORD', 'MINUS', 'WORD',))
self.compare(FullTextKey, 'John*', ('WORD', 'ASTERISK'))
self.compare(FullTextKey, '+John*', ('PLUS', 'WORD', 'ASTERISK'))
self.compare(FullTextKey, '.', ('WORD',)) self.compare(FullTextKey, '.', ('WORD',))
self.compare(FullTextKey, '"John Doe"', ('DOUBLEQUOTE', 'WORD', 'WORD', 'DOUBLEQUOTE')) self.compare(FullTextKey, '"John Doe"', ('DOUBLEQUOTE', 'WORD', 'WORD', 'DOUBLEQUOTE'))
self.compare(FullTextKey, 'John*', ('WORD', 'ASTERISK'))
self.compare(FullTextKey, '+apple +(>turnover <strudel)', self.compare(FullTextKey, '+apple +(>turnover <strudel)',
('PLUS', 'WORD', 'PLUS', 'LEFTPARENTHES', 'GREATERTHAN', 'WORD', ('PLUS', 'WORD', 'PLUS', 'LEFTPARENTHES', 'GREATERTHAN', 'WORD',
'LESSTHAN', 'WORD', 'RIGHTPARENTHES',)) 'LESSTHAN', 'WORD', 'RIGHTPARENTHES',))
......
...@@ -223,6 +223,14 @@ class TestQuery(unittest.TestCase): ...@@ -223,6 +223,14 @@ class TestQuery(unittest.TestCase):
datetime_search_keys = [], datetime_search_keys = [],
full_text_search_keys=['title'])) full_text_search_keys=['title']))
def testSimpleQueryFullAutomaticTextSearchMode(self):
q = Query(title='Foo*',)
self.assertEquals(dict(
where_expression="MATCH title AGAINST ('Foo*' IN BOOLEAN MODE)",
select_expression_list=
["MATCH title AGAINST ('Foo*' IN BOOLEAN MODE) AS title_relevance"]),
q.asSQLExpression(full_text_search_keys=['title']))
def testSimpleQueryFullTextStat__(self): def testSimpleQueryFullTextStat__(self):
# stat__ is an internal implementation artifact to prevent adding # stat__ is an internal implementation artifact to prevent adding
# select_expression for countFolder # select_expression for countFolder
......
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