Пример #1
0
 def search(self, request, query):
     result = list()
     for record in fulltext_search(request, query, SEARCH_LIMIT):
         cls = record.__class__
         uid = str(record.uid)
         query = make_query(**{UX_IDENT: UX_FRONTEND})
         target = make_url(request,
                           path=[value_containers[cls], uid],
                           query=query)
         suggestion = {
             'uid': uid,
             'value': value_extractors[cls](record),
             'action': value_actions[cls],
             'target': target,
             'icon': value_icons[cls],
         }
         result.append(suggestion)
     return result
Пример #2
0
def json_search_locations(model, request):
    query = request.params['term']
    result = dict()
    for record in fulltext_search(request, query, SEARCH_LIMIT):
        extract_locations(request, record, result)
    return result.values()