LP#1562153: fix case where changing sort order to relevance can fail