Sort search based on length if there is query

It sorts alphabetically by default. Using `orderBy` with custom sorter
allows us to avoid having to implement priority search of our own.