@action_logging
def _search_user(*, search_term: str, page_index: int, search_type: str) -> Dict[(str, Any)]:
    "\n    Call the search service endpoint and return matching results\n    Search service logic defined here:\n    https://github.com/lyft/amundsensearchlibrary/blob/master/search_service/api/user.py\n\n    :return: a json output containing search results array as 'results'\n    "

    def _map_user_result(result: Dict) -> Dict:
        user_result = dump_user(load_user(result))
        user_result['type'] = 'user'
        return user_result
    users = {'page_index': int(page_index), 'results': [], 'total_results': 0}
    results_dict = {'search_term': search_term, 'msg': 'Success', 'status_code': HTTPStatus.OK, 'users': users}
    try:
        url = '{0}?query_term={1}&page_index={2}'.format((app.config['SEARCHSERVICE_BASE'] + SEARCH_USER_ENDPOINT), search_term, page_index)
        response = request_search(url=url)
        status_code = response.status_code
        if (status_code == HTTPStatus.OK):
            results_dict['msg'] = 'Success'
            results = response.json().get('results')
            users['results'] = [_map_user_result(result) for result in results]
            users['total_results'] = response.json().get('total_results')
        else:
            message = 'Encountered error: Search request failed'
            results_dict['msg'] = message
            logging.error(message)
        results_dict['status_code'] = status_code
        return results_dict
    except Exception as e:
        message = ('Encountered exception: ' + str(e))
        results_dict['msg'] = message
        results_dict['status_code'] = HTTPStatus.INTERNAL_SERVER_ERROR
        logging.exception(message)
        return results_dict
Call the search service endpoint and return matching results
Search service logic defined here:
https://github.com/lyft/amundsensearchlibrary/blob/master/search_service/api/user.py

:return: a json output containing search results array as 'results'
@action_logging
def _search_user(*, search_term: str, page_index: int, search_type: str) -> Dict[(str, Any)]:
    "\n    Call the search service endpoint and return matching results\n    Search service logic defined here:\n    https://github.com/lyft/amundsensearchlibrary/blob/master/search_service/api/user.py\n\n    :return: a json output containing search results array as 'results'\n    "

    def _map_user_result(result: Dict) -> Dict:
        user_result = dump_user(load_user(result))
        user_result['type'] = 'user'
        return user_result
    users = {'page_index': int(page_index), 'results': [], 'total_results': 0}
    results_dict = {'search_term': search_term, 'msg': 'Success', 'status_code': HTTPStatus.OK, 'users': users}
    try:
        url = '{0}?query_term={1}&page_index={2}'.format((app.config['SEARCHSERVICE_BASE'] + SEARCH_USER_ENDPOINT), search_term, page_index)
        response = request_search(url=url)
        status_code = response.status_code
        if (status_code == HTTPStatus.OK):
            results_dict['msg'] = 'Success'
            results = response.json().get('results')
            users['results'] = [_map_user_result(result) for result in results]
            users['total_results'] = response.json().get('total_results')
        else:
            message = 'Encountered error: Search request failed'
            results_dict['msg'] = message
            logging.error(message)
        results_dict['status_code'] = status_code
        return results_dict
    except Exception as e:
        message = ('Encountered exception: ' + str(e))
        results_dict['msg'] = message
        results_dict['status_code'] = HTTPStatus.INTERNAL_SERVER_ERROR
        logging.exception(message)
        return results_dict