From abdfb826a1a11bba5c24f2eb2b652b646578ddbf Mon Sep 17 00:00:00 2001 From: Nicolas Delaby <nicolas@nexedi.com> Date: Fri, 25 Apr 2008 08:18:08 +0000 Subject: [PATCH] Fix unparsed DoubleQuote bug in regex, extend unit_test git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@20809 20353a03-c40f-0410-a6d1-a30d3c3de9de --- product/ZSQLCatalog/SearchKey/FullTextKey.py | 2 +- product/ZSQLCatalog/tests/testSearchKeys.py | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/product/ZSQLCatalog/SearchKey/FullTextKey.py b/product/ZSQLCatalog/SearchKey/FullTextKey.py index 48b7f8ac09..d07e61760d 100644 --- a/product/ZSQLCatalog/SearchKey/FullTextKey.py +++ b/product/ZSQLCatalog/SearchKey/FullTextKey.py @@ -58,7 +58,7 @@ class FullTextKey(SearchKey): t_DOUBLEQUOTE = r'(\")' def t_WORD(self, t): - r'[^\+\-<>\(\)\~\*\"\s]$|[^\+\-<>\(\)\~\*\s]+[^\*\s\)]' + r'[^\+\-<>\(\)\~\*\"\s]$|[^\+\-<>\(\)\~\*\"\s]+[^\*\"\s\)]' #r'[^\+\-<>\(\)\~\*\"\s]\S*' #r'[\x7F-\xFF\w\d][\x7F-\xFF\w\d]*' # WORD may contain arbitrary letters and numbers without white space diff --git a/product/ZSQLCatalog/tests/testSearchKeys.py b/product/ZSQLCatalog/tests/testSearchKeys.py index ed80dea3f6..b429ed008c 100644 --- a/product/ZSQLCatalog/tests/testSearchKeys.py +++ b/product/ZSQLCatalog/tests/testSearchKeys.py @@ -134,6 +134,7 @@ size/Child/34""" self.compare(FullTextKey, '+John -Doe', ('PLUS', 'WORD', 'MINUS', 'WORD',)) self.compare(FullTextKey, '.', ('WORD',)) + self.compare(FullTextKey, '"John Doe"', ('DOUBLEQUOTE', 'WORD', 'WORD', 'DOUBLEQUOTE')) self.compare(FullTextKey, 'John*', ('WORD', 'ASTERISK')) self.compare(FullTextKey, '+apple +(>turnover <strudel)', ('PLUS', 'WORD', 'PLUS', 'LEFTPARENTHES', 'GREATERTHAN', 'WORD', -- 2.30.9