equal
deleted
inserted
replaced
27 |
27 |
28 from rql import RQLSyntaxError, BadRQLQuery, parse |
28 from rql import RQLSyntaxError, BadRQLQuery, parse |
29 from rql.utils import rqlvar_maker |
29 from rql.utils import rqlvar_maker |
30 from rql.nodes import Relation |
30 from rql.nodes import Relation |
31 |
31 |
32 from cubicweb import Unauthorized, typed_eid |
32 from cubicweb import Unauthorized |
33 from cubicweb.view import Component |
33 from cubicweb.view import Component |
34 from cubicweb.web.views.ajaxcontroller import ajaxfunc |
34 from cubicweb.web.views.ajaxcontroller import ajaxfunc |
35 |
35 |
36 LOGGER = getLogger('cubicweb.magicsearch') |
36 LOGGER = getLogger('cubicweb.magicsearch') |
37 |
37 |
252 def _one_word_query(self, word): |
252 def _one_word_query(self, word): |
253 """Specific process for one word query (case (1) of preprocess_rql) |
253 """Specific process for one word query (case (1) of preprocess_rql) |
254 """ |
254 """ |
255 # if this is an integer, then directly go to eid |
255 # if this is an integer, then directly go to eid |
256 try: |
256 try: |
257 eid = typed_eid(word) |
257 eid = int(word) |
258 return 'Any X WHERE X eid %(x)s', {'x': eid}, 'x' |
258 return 'Any X WHERE X eid %(x)s', {'x': eid}, 'x' |
259 except ValueError: |
259 except ValueError: |
260 etype = self._get_entity_type(word) |
260 etype = self._get_entity_type(word) |
261 return '%s %s' % (etype, etype[0]), |
261 return '%s %s' % (etype, etype[0]), |
262 |
262 |