This might be able to be handled by urlparse as well. Before you run unparsed_feed._replace:

`
if sort_by == "Relevance":
    query['date_sort'] = False
`

or something like that.