def entities_by_keyword(data, request): """ Wraps Es.by_keyword. Finds the first 20 entities matching the given keyword. Example: >> {action:"by_keyword", keyword: "giedo"} << [["4e6fcc85e60edf3dc0000270", "Giedo Jansen (giedo)"]] The return format is optimized for size and compatibility with jquery-ui.autocomplete """ _type = data.get('type', None) if _type and not isinstance(_type, basestring): _type = None return [[e.id, _humanName_of_entity(e)] for e in Es.by_keyword(data.get('keyword', ''), _type=_type)]
def entities_by_keyword(data, request): """ Wraps Es.by_keyword. Finds the first 20 entities matching the given keyword. Example: >> {action:"by_keyword", keyword: "giedo"} << [["4e6fcc85e60edf3dc0000270", "Giedo Jansen (giedo)"]] The return format is optimized for size and compatibility with jquery-ui.autocomplete """ _type = data.get('type', None) if _type and not isinstance(_type, six.string_types): _type = None return [[e.id, _humanName_of_entity(e)] for e in Es.by_keyword(data.get('keyword', ''), _type=_type)]
def qe(keyword): """ Queries entities by keyword """ for e in Es.by_keyword(keyword): print("%-20s %s" % (_id(e), six.text_type(e.humanName)))
def qe(keyword): """ Queries entities by keyword """ for e in Es.by_keyword(keyword): print "%-20s %s" % (_id(e), unicode(e.humanName))