[Erp5-report] r37964 kazuhiko - in /erp5/trunk/products/ZSQLCatalog: SearchKey/ tests/

nobody at svn.erp5.org nobody at svn.erp5.org
Tue Aug 24 07:21:45 CEST 2010


Author: kazuhiko
Date: Tue Aug 24 07:21:43 2010
New Revision: 37964

URL: http://svn.erp5.org?rev=37964&view=rev
Log:
improve FULLTEXT_BOOLEAN_DETECTOR, i.e. 'a+b' is not a boolean search, but 'a +b' is.

Modified:
    erp5/trunk/products/ZSQLCatalog/SearchKey/FullTextKey.py
    erp5/trunk/products/ZSQLCatalog/tests/testSQLCatalog.py

Modified: erp5/trunk/products/ZSQLCatalog/SearchKey/FullTextKey.py
URL: http://svn.erp5.org/erp5/trunk/products/ZSQLCatalog/SearchKey/FullTextKey.py?rev=37964&r1=37963&r2=37964&view=diff
==============================================================================
--- erp5/trunk/products/ZSQLCatalog/SearchKey/FullTextKey.py [utf8] (original)
+++ erp5/trunk/products/ZSQLCatalog/SearchKey/FullTextKey.py [utf8] Tue Aug 24 07:21:43 2010
@@ -36,7 +36,7 @@ from zope.interface.verify import verify
 from Products.ZSQLCatalog.SQLCatalog import profiler_decorator
 import re
 
-FULLTEXT_BOOLEAN_DETECTOR = re.compile(r'.*[\+\-<>\(\)\~\*]')
+FULLTEXT_BOOLEAN_DETECTOR = re.compile(r'.*(^|\s)[\+\-<>\(\)\~\*]')
 
 class FullTextKey(SearchKey):
   """

Modified: erp5/trunk/products/ZSQLCatalog/tests/testSQLCatalog.py
URL: http://svn.erp5.org/erp5/trunk/products/ZSQLCatalog/tests/testSQLCatalog.py?rev=37964&r1=37963&r2=37964&view=diff
==============================================================================
--- erp5/trunk/products/ZSQLCatalog/tests/testSQLCatalog.py [utf8] (original)
+++ erp5/trunk/products/ZSQLCatalog/tests/testSQLCatalog.py [utf8] Tue Aug 24 07:21:43 2010
@@ -508,8 +508,10 @@ class TestSQLCatalog(unittest.TestCase):
       Fulltext searches must switch automatically to boolean mode if boolean
       operators are found in search value.
     """
-    self.catalog(ReferenceQuery(ReferenceQuery(operator='match_boolean', fulltext='a+b'), operator='and'),
+    self.catalog(ReferenceQuery(ReferenceQuery(operator='match', fulltext='a+b'), operator='and'),
                  {'fulltext': 'a+b'})
+    self.catalog(ReferenceQuery(ReferenceQuery(operator='match_boolean', fulltext='a +b'), operator='and'),
+                 {'fulltext': 'a +b'})
     self.catalog(ReferenceQuery(ReferenceQuery( ReferenceQuery(operator='=', uid='foo'),
                 ReferenceQuery(operator='match_boolean', fulltext='+a b'), operator='and'
     ), operator='and'), {'fulltext': '+a b uid:foo'})




More information about the Erp5-report mailing list