def _search_params(request_params, user=None):
    """Turn request parameters into annotator-store search parameters"""
    request_params = request_params.copy()
    search_params = {}

    # Take limit and offset out of the parameters
    try:
        search_params['offset'] = int(request_params.pop('offset'))
    except (KeyError, ValueError):
        pass
    try:
        search_params['limit'] = int(request_params.pop('limit'))
    except (KeyError, ValueError):
        pass

    # All remaining parameters are considered searched fields.
    search_params['query'] = request_params

    search_params['user'] = user
    return search_params