From 36a823989ab479e7216e45d061ba6c4254d33167 Mon Sep 17 00:00:00 2001 From: Kazuhiko Shiozaki <kazuhiko@nexedi.com> Date: Tue, 28 Oct 2014 22:48:33 +0100 Subject: [PATCH] fixup! full text: move special query generation logic from SearchKey to ComparisonOperator. --- product/ZSQLCatalog/Operator/ComparisonOperator.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/product/ZSQLCatalog/Operator/ComparisonOperator.py b/product/ZSQLCatalog/Operator/ComparisonOperator.py index 384ba10a7a..49ece65d4c 100644 --- a/product/ZSQLCatalog/Operator/ComparisonOperator.py +++ b/product/ZSQLCatalog/Operator/ComparisonOperator.py @@ -165,12 +165,13 @@ class MroongaComparisonOperator(MatchComparisonOperator): match_boolean_query_list.append(token) else: match_query_list.append(token) + # Always use BOOLEAN MODE to combine similarity search and boolean search. + self.mode = ' IN BOOLEAN MODE' fulltext_query = '*D+' if match_query_list: fulltext_query += ' *S"%s"' % ' '.join(x.replace('"', '\\"') for x in match_query_list) if match_boolean_query_list: fulltext_query += ' %s' % ' '.join(match_boolean_query_list) - self.mode = ' IN BOOLEAN MODE' return self._renderValue(fulltext_query) verifyClass(IOperator, MroongaComparisonOperator) @@ -178,7 +179,8 @@ verifyClass(IOperator, MroongaComparisonOperator) class MroongaBooleanComparisonOperator(MroongaComparisonOperator): def renderValue(self, value_list): """ - value_list must either be a non-list or a single-value list. + Special Query renderer for MroongaFullText queries: + * by default 'AND' search by using '*D+' pragma. """ if isinstance(value_list, list_type_list): try: -- 2.30.9