If a search query is given, sort results based on relevance