We have a Course Listing based on results surfaced by a Search Results Web Part that is configured to use a specific Results Source. The web part serves a dual purpose in that by default it should order items alphabetically but we also have a search box on the page. If the search box is used then we want the results to be sorted by rank based on the keywords entered. To complicate things further we also have an A to Z option - if a user clicks on a letter then the query that gets submitted uses the Managed Property "Letter" - i.e. k=Letter:"A".
What I would like to do is to sort empty queries and managed property queries alphabetically but switch to rank order when a keyword exists.
I've looked at Query Rules and can see an option to use a regular expression to match on a search keyword so that might be the way to go. Does anyone have any ideas for this?