avoid execution of queries which are known to be wrong by letting error propagates
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Wed, 29 Jul 2009 18:27:41 +0200
changeset 2567 961aa959f07a
parent 2565 df34d3720ff5
child 2568 87f99ad0d3a8
avoid execution of queries which are known to be wrong by letting error propagates
web/views/magicsearch.py
--- a/web/views/magicsearch.py	Wed Jul 29 18:25:01 2009 +0200
+++ b/web/views/magicsearch.py	Wed Jul 29 18:27:41 2009 +0200
@@ -170,10 +170,7 @@
     """
     priority = 2
     def preprocess_query(self, uquery, req):
-        try:
-            rqlst = parse(uquery, print_errors=False)
-        except (RQLSyntaxError, BadRQLQuery), err:
-            return uquery,
+        rqlst = parse(uquery, print_errors=False)
         schema = self.vreg.schema
         # rql syntax tree will be modified in place if necessary
         translate_rql_tree(rqlst, trmap(self.config, schema, req.lang), schema)
@@ -204,7 +201,7 @@
             elif len(words) == 3:
                 args = self._three_words_query(*words)
             else:
-                args = self._multiple_words_query(words)
+                raise
         return args
 
     def _get_entity_type(self, word):
@@ -291,11 +288,6 @@
                                   self._complete_rql(word3, etype, searchattr=rtype))
         return rql, {'text': word3}
 
-    def _multiple_words_query(self, words):
-        """specific process for more than 3 words query"""
-        return ' '.join(words),
-
-
     def _expand_shortcut(self, etype, rtype, searchstr):
         """Expands shortcut queries on a non final relation to use has_text or
         the main attribute (according to possible entity type) if '%' is used in the