def search_entities_interactive(request): sources = json.loads(request.POST.get('sources')) or [] if 'documents' in sources: search_text = json.loads(request.POST.get('query_s', '')) limit = int(request.POST.get('limit', 25)) entities = _search(user=request.user, search_text=search_text, limit=limit) response = { 'results': [{ 'hue_name': e.name, 'hue_description': e.description, 'type': 'HUE', 'originalName': e.name } for e in entities['documents']], 'count': len(entities['documents']), 'status': 0 } return JsonResponse(response) else: return metadata_search_entities_interactive(request)
def search_entities_interactive(request): sources = json.loads(request.POST.get('sources')) or [] if 'documents' in sources: search_text = json.loads(request.POST.get('query_s', '')) limit = int(request.POST.get('limit', 25)) entities = _search(user=request.user, search_text=search_text, limit=limit) response = { 'results': [{ 'hue_name': e.name, 'hue_description': e.description, 'link': e.get_absolute_url(), 'doc_type': e.type, 'type': 'HUE', 'originalName': e.name } for e in entities['documents']], 'count': len(entities['documents']), 'status': 0 } return JsonResponse(response) else: if has_navigator(request.user): return metadata_search_entities_interactive(request) else: return JsonResponse({ 'status': 1, 'message': _('Navigator not enabled') })
def search_entities_interactive(request): sources = json.loads(request.POST.get("sources")) or [] if "documents" in sources: search_text = json.loads(request.POST.get("query_s", "")) limit = int(request.POST.get("limit", 25)) entities = _search(user=request.user, search_text=search_text, limit=limit) response = { "results": [ {"hue_name": e.name, "hue_description": e.description, "type": "HUE", "originalName": e.name} for e in entities["documents"] ], "count": len(entities["documents"]), "status": 0, } return JsonResponse(response) else: return metadata_search_entities_interactive(request)