[Erp5-report] r38008 kazuhiko - in /erp5/trunk/products/ZSQLCatalog: Operator/ SearchKey/
nobody at svn.erp5.org
nobody at svn.erp5.org
Wed Aug 25 10:10:36 CEST 2010
Author: kazuhiko
Date: Wed Aug 25 10:10:31 2010
New Revision: 38008
URL: http://svn.erp5.org?rev=38008&view=rev
Log:
* implicit OR search for sphinx.
* somehow working "phrase search".
* use extended2 mode instead of extended mode.
Modified:
erp5/trunk/products/ZSQLCatalog/Operator/ComparisonOperator.py
erp5/trunk/products/ZSQLCatalog/SearchKey/SphinxSEFullTextKey.py
Modified: erp5/trunk/products/ZSQLCatalog/Operator/ComparisonOperator.py
URL: http://svn.erp5.org/erp5/trunk/products/ZSQLCatalog/Operator/ComparisonOperator.py?rev=38008&r1=38007&r2=38008&view=diff
==============================================================================
--- erp5/trunk/products/ZSQLCatalog/Operator/ComparisonOperator.py [utf8] (original)
+++ erp5/trunk/products/ZSQLCatalog/Operator/ComparisonOperator.py [utf8] Wed Aug 25 10:10:31 2010
@@ -138,19 +138,13 @@ class SphinxSEComparisonOperator(Monoval
def renderValue(self, value_list):
"""
- * quote each query word explicitly to invoke phrase search for
- n-gram characters.
- * add ';mode=extended' to invoke extended search
-
- TODO:
- * escape double quote in query word
- * respect existing double quotes in user's input
+ * add ';mode=extended2' to invoke extended search
"""
if isinstance(value_list, (tuple, list)):
if len(value_list) > 1:
raise ValueError, '%r: value_list must not contain more than one item. Got %r' % (self, value_list)
value_list = value_list[0]
- value_list = '"'+'" "'.join(value_list.split())+'";mode=extended'
+ value_list = '%s;mode=extended2' % value_list
return self._renderValue(value_list)
@profiler_decorator
Modified: erp5/trunk/products/ZSQLCatalog/SearchKey/SphinxSEFullTextKey.py
URL: http://svn.erp5.org/erp5/trunk/products/ZSQLCatalog/SearchKey/SphinxSEFullTextKey.py?rev=38008&r1=38007&r2=38008&view=diff
==============================================================================
--- erp5/trunk/products/ZSQLCatalog/SearchKey/SphinxSEFullTextKey.py [utf8] (original)
+++ erp5/trunk/products/ZSQLCatalog/SearchKey/SphinxSEFullTextKey.py [utf8] Wed Aug 25 10:10:31 2010
@@ -48,14 +48,22 @@ class SphinxSEFullTextKey(SearchKey):
Special Query builder for FullText queries: merge all values having the
same operator into just one query, to save SQL server from the burden to
do multiple fulltext lookups when one would suit the purpose.
+
+ Example:
+ 'aaa bbb' : '"aaa" | "bbb"'
+ '"aaa bbb"' : '"aaa" | "bbb"' XXX no way to differentiate with the
+ above for now
+ '"aaa bbb" ccc' : '"aaa bbb" | "ccc"'
"""
column = self.getColumn()
query_list = []
append = query_list.append
for comparison_operator, value_list in operator_value_dict.iteritems():
+ if len(value_list) == 1:
+ value_list = value_list[0].split()
append(SimpleQuery(search_key=self,
comparison_operator=comparison_operator,
- group=group, **{column: ' '.join(value_list)}))
+ group=group, **{column:'"%s"' % '" | "'.join(value_list)}))
return query_list
verifyClass(ISearchKey, SphinxSEFullTextKey)
More information about the Erp5-report
mailing list