@error_handler
def search_entities(request):
 api = NavigatorApi(request.user)
 query_s = json.loads(request.POST.get('query_s', ''))
 query_s = smart_str(query_s)
 offset = request.POST.get('offset', 0)
 limit = int(request.POST.get('limit', 100))
 sources = (json.loads(request.POST.get('sources')) or [])
 query_s = (query_s.strip() or '*')
 entities = api.search_entities(query_s, limit=limit, offset=offset, sources=sources)
 _augment_highlighting(query_s, entities)
 response = {'entities': entities, 'count': len(entities), 'offset': offset, 'limit': limit, 'query_s': query_s, 'status': 0}
 return JsonResponse(response)

@ error_handler def search_entities ( request ) : api = NavigatorApi ( request . user ) query_s = json . loads ( request . POST . get ( 'query_s' , '' ) ) query_s = smart_str ( query_s ) offset = request . POST . get ( 'offset' , 0 ) limit = int ( request . POST . get ( 'limit' , 100 ) ) sources = ( json . loads ( request . POST . get ( 'sources' ) ) or [ ] ) query_s = ( query_s . strip ( ) or '*' ) entities = api . search_entities ( query_s , limit = limit , offset = offset , sources = sources ) _augment_highlighting ( query_s , entities ) response = { 'entities' : entities , 'count' : len ( entities ) , 'offset' : offset , 'limit' : limit , 'query_s' : query_s , 'status' : 0 } return JsonResponse ( response )
for displaying results .