1

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?

0

If you want to sort the whole set I don't think query rules will help. I think you may need to look at changing the Group or Control template to change the behavior in the way that you detail. Not a lot has been written on this topic, mostly you'll fine articles about display templates, which are rendered inside the Control>Group>Display Template scheme. It seems that you could use the templates to perform the detection and manipulation that you are attempting.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.