Skip to main content
4 of 9
Fix
mgkrupa
  • 155
  • 5

Can we add "sortby:OPTION" (ex: "sortby:votes") to search? Ditto for "page:#"

We could use the obvious syntax sortby:OPTION, where OPTION is one of:

Relevance
Newest
Votes
Active

All it would take to implement this would be to insert tab=OPTION& after the question mark and before the q=MYQUERY in the URL that is generated when searching for MYQUERY. Example: to automatically sort by OPTION when MYQUERY sortby:OPTION is entered into the search bar, just turn

https://meta.stackexchange.com/search?q=MYQUERY

into

https://meta.stackexchange.com/search?tab=votes&q=MYQUERY

where MYQUERY is just some place-holder text for an arbitrary query (so I'm not actually trying to search for the text "MYQUERY").

Heck, adding these two other options:

page:PAGENUMBER and pagesize:PAGESIZE

(both of which are also missing and would be appreciated) would be even easier since you literally just change the : into an =, add an & to the end, and then insert the resulting

page=PAGENUMBER& and pagesize=PAGESIZE&

after the question mark.

Of course, ideally PAGENUMBER is a valid page number that it automatically loads on and PAGESIZE is one of 10, 30, or 50, but what if it isn't? What if someone enters into the search box

Please Improve Search page:TrAsH sortby:JunK pagesize:GarBaGe

Will anything break? NO! Just click the theoretical resulting link yourself:

https://meta.stackexchange.com/search?page=TrAsH&tab=JunK&pagesize=GarBaGe&q=Please%20Improve%20Search

Any invalid input is ALREADY automatically ignored and set to its default.

On the other hand, for some valid search query, such as:

Please Improve Search page:2 sortby:votes pagesize:30

everything works exactly as expected since the resulting link would be:

https://meta.stackexchange.com/search?page=2&tab=votes&pagesize=30&q=Please%20Improve%20Search

This is a little thing that would improve Stack Exchange, especially when using the search feature to find out whether or not your question has already been asked or answered. In particular, it would help by making it easier to wade through the sometimes hundreds or thousands of search results that are returned by making it faster and easier to repeatedly change or refine your query without having to find your old location over and over again.

mgkrupa
  • 155
  • 5