def _get_query(request):
    query = request.GET.get("query", "")
    date = request.GET.get("date", "")
    timestamp = request.GET.get("timestamp", None)
    sort = request.GET.get("sort", "top").lower()
    filter = request.GET.get("filter", "following").lower()

    if timestamp:
        t = parse(timestamp, ignoretz=True)
        timestamp = pytz.utc.localize(t)
    else:
        timestamp = timezone.now()

    start_time = ''
    end_time = ''

    if date:
        start_time, end_time = DateRangeParser().parse(date)

    get_dict = {
        "query": query,
        "filter": filter,
        "sort": sort,
        "start_time": start_time,
        "end_time": end_time,
        "username": request.GET.get("username", ""),
        "orderBy": request.GET.get("orderBy", "start_time"),
        "direction": request.GET.get("direction", ""),
        "template": request.GET.get("template", ""),
        "type": request.GET.get("type", ""),
        "page": request.GET.get("page", 1),
        'timestamp': timestamp,
    }

    return get_dict, query, date, sort, filter
Get query parameters if search is used
dataset/ETHPy150Open haystack/eyebrowse-server/common/view_helpers.py/_get_query