Skip to main content
6 of 9
Clarification
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").

For example, lets say that I want to search for the word works and I know even before searching that I want the results to be sorted by votes. Currently, in order to do this I have to search for works by using the search box (which leads me to the page https://meta.stackexchange.com/search?q=works) and then I have to click on the "Votes" tab (which leads me to the page https://meta.stackexchange.com/search?tab=votes&q=works). What I'm envisioning is that whenever the text sortby:votes appears within the search query (e.g. if I search for works sortby:votes) then I am automatically led to the page https://meta.stackexchange.com/search?tab=votes&q=works (in contrast, currently a search for works sortby:votes leads to the page https://meta.stackexchange.com/search?q=works+sortby%3Avote).

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 would work 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 in the search results over and over again.

mgkrupa
  • 155
  • 5