sort options for search results

I have a search for specific categories posts, the category is called archive, and am wondering if after they are displayed they can be sorted by either most recent or most relevant via a dropdown. The code I am using for the search is

which takes me to a a specific template. I’m not sure if any of this code is relevant to my question but thought it may be helpful. I want to re-order/sort the list of search results once they are populated.