equal
deleted
inserted
replaced
13 |
13 |
14 from rql import RQLSyntaxError, BadRQLQuery, parse |
14 from rql import RQLSyntaxError, BadRQLQuery, parse |
15 from rql.nodes import Relation |
15 from rql.nodes import Relation |
16 |
16 |
17 from cubicweb import Unauthorized |
17 from cubicweb import Unauthorized |
18 from cubicweb.common.appobject import Component, SingletonComponent |
18 from cubicweb.common.appobject import Component |
19 |
19 |
20 LOGGER = getLogger('cubicweb.magicsearch') |
20 LOGGER = getLogger('cubicweb.magicsearch') |
21 |
21 |
22 def _get_approriate_translation(translations_found, eschema): |
22 def _get_approriate_translation(translations_found, eschema): |
23 """return the first (should be the only one) possible translation according |
23 """return the first (should be the only one) possible translation according |
347 """suppose it's a plain text query""" |
347 """suppose it's a plain text query""" |
348 return 'Any X WHERE X has_text %(text)s', {'text': uquery} |
348 return 'Any X WHERE X has_text %(text)s', {'text': uquery} |
349 |
349 |
350 |
350 |
351 |
351 |
352 class MagicSearchComponent(SingletonComponent): |
352 class MagicSearchComponent(Component): |
353 id = 'magicsearch' |
353 id = 'magicsearch' |
354 def __init__(self, req, rset=None): |
354 def __init__(self, req, rset=None): |
355 super(MagicSearchComponent, self).__init__(req, rset) |
355 super(MagicSearchComponent, self).__init__(req, rset) |
356 processors = [] |
356 processors = [] |
357 self.by_name = {} |
357 self.by_name = {} |