Bookmarklet to make Gmail return more than 20 search results.

Gmail’s “sort not search” philospohy changed the way many of us use email, but limit of 20 results per page is irritating to many.  Here’s how you can fix the limit with a bookmarklet.

When I search for ‘from:ted’ in my inbox, the url that my browser shows is this one:

https://mail.google.com/mail/u/0/#search/from%3Ated

And it shows these emails:

Screen Shot 2014-02-08 at 10.42.14

 

There’s space for more emails, so why can’t I see them? Irritating, huh?

We’re not alone.  Googling ‘Gmail more than 20 results’ gets you a lot of angry users who are mostly now complaining that they’ve complained about this since 2009 and Gmail hasn’t helped.

Here’s my solution (I found the technical part of this on this stackexchange question).

If, I change the url to:

https://mail.google.com/mail/u/0/#section_query/from%3Ated

Then I get to see all 33 (not 28 that the previous page claimed) of the emails:

Screen Shot 2014-02-08 at 10.42.05

This is a nice easy little hack to show up to 100 threads in the search results. If you have more than 100 threads, then the normal ‘<’ and ‘>’ buttons work well.

It’s a bit of a pain to keep changing the url, so I wrote a little bookmarklet to do the job (using the Bookmarklet Crunchinator).

To start using the bookmarket, make sure you can see your browser’s bookmarks toolbar. Then, drag and drop the bookmarklet link below to your bookmarks toolbar. When you’re on a page where you want to use the bookmarklet just click its name on your toolbar. (or, if you are like me and hide the toolbar, just click it in the bookmarks menu.

BetterGmailSearch

EDIT -
Some people on Lifehacker (which picked up the article) found that they were getting 50 messages in the search results, rather than 100). It turns out that this method won’t return more search results than fit in your inbox.  For example, I have this setting in my gmail settings.

Screen Shot 2014-04-05 at 09.06.15This means that (normally) I get to see up to a 100 messages in my inbox, but still only 20 in my search pane. When I use the URL hack in this article, I get to see 100 emails in my search pane.

On the other hand – if I set that setting to ’50′, then I would normally see up to 50 messages in my inbox and 20 in the search pane – but the URL hack will let me see 50 in the search pane.

 

SECOND EDIT -

For those illustrated, this is a wonderful example of the drawbacks of StackExchange’s voting method. On the relevant question, the answer that says “No, there’s still no way to do that.” has 10 early votes putting it as the top answer, while the (two) answers that show easy ways of doing it, both languish at the bottom with two votes each (presumably from each other).

THIRD EDIT:

(with thanks to the person who emailed in)

This doesn’t work if you used gmail’s advanced search, which looks like this:

Screen Shot 2014-04-18 at 08.39.36because advanced search, for some reason, doesn’t use the same url structure.  The workaround is as follows:

  • Perform the advanced search – giving a maximum of 20 results
  • Press the normal ‘magnifying glass’ search button – this will use the settings in the search box (generated from the advanced search) to perform a the same search
  • because you used a ‘normal’ search last – the URL should now contain ‘search’ as normal, and the bookmarklet should work :)

20 thoughts on “Bookmarklet to make Gmail return more than 20 search results.

  1. Dexter
    February 16, 2014 at 2:39 am

    Thanks for the article.

    I found two issues:

    If you have a new compose window open it will create another one.
    It does not update the screen when you delete or move items.

    After reading your article I wrote an extension for chrome that does this automatically for each search. My extension fixes the compose window issue but I am still working on forcing the refresh.

    1. February 16, 2014 at 10:12 am

      Excellent work – I’m presuming that the compose issue will be pretty easy to fix (also if you want to share the transformation you are using that would save me 20 minutes. I solve the refresh with a quick Cmd-L,Enter, but I appreciate that’s not ideal. I can’t off-hand think of *any* chrome extension that allows an ‘internal’ refresh of the gmail window… hmm.

    2. bobo
      April 12, 2014 at 3:28 pm

      Dexter, is your extension available for the public? If so, could you share the link?

  2. Vlad Roytman
    April 3, 2014 at 4:22 pm

    Thank you for a great idea!
    Playing with your bookmarklet, I noticed that I would need not just #search, but also #apps replaced. So the I modified it, as the following:

    javascript:(function(){location.href=location.href.replace(‘#search’,’#section_query’).replace(‘#apps’,’#section_query’)})();

  3. April 3, 2014 at 5:19 pm

    Interesting – for my own curiousity – under what circumstances does #apps appear in the url? (I can’t recall seeing it…)

    1. bobo
      April 12, 2014 at 3:50 pm

      Joe,
      I’ve used your bookmark and also tried the code modified by Vlad. Neither works for me. It doesn’t change the URL. I have to manually type in “#section_query”. :(
      I’m on Linux Chrome.

      1. April 14, 2014 at 9:44 am

        Interesting – let me pull up my linux box over the next couple of days and see if I can replicate the error… :s

  4. April 4, 2014 at 5:37 am

    Quite a clever (and useful) hack. CNet picked up on it, so you might get more attention than you’re accustomed to. I noticed, at least in Firefox, that it’s not effective for advanced searches (e.g., if you add a date range.) Still, it saves me lots of time – I have clients with 1,000+ email messages, and this is hugely helpful. Thanks!!!

    1. April 4, 2014 at 8:11 am

      Awesome – thanks for letting me know. Just for clarification – I’m using firefox and I don’t get the problem you mentioned – can you give me an example string?

      J

  5. Frank
    April 5, 2014 at 6:03 am

    I have found I can use GMail settings to search for up to 100 messages, doe your change allow for more than that?

    1. April 5, 2014 at 9:05 am

      Just to check – do you mean the ‘Show conversations X per page’ setting? That works on the inbox, but not on the search results.. :s (although it let me discover the solution to a small mystery, so thank you.

  6. April 9, 2014 at 6:02 pm

    This worked great! Saved me a ton of time removing WP Spam from my Gmail inbox. Thanks for the tip.

  7. April 17, 2014 at 10:32 pm

    Hmmm… does not seem to be working for me. I Dragged the bookmarklet to my Chrome browser. Then I did a search in Gmail (got 20 of 167 results) then clicked the bookmarklet and…nothing happened.

    I’ll happily upvote your StackOverflow answer if I can get this working :)

  8. April 17, 2014 at 10:34 pm

    Oh, and that’s using the latest Chrome on Windows 7.

  9. April 17, 2014 at 10:42 pm

    Never mind.
    It’s working now. It really wasn’t working before. I tried it several times, with refreshes. Then I went to do a screen cast and …. it worked. Sigh…

    1. April 18, 2014 at 8:38 am

      Ha! I know the feeling, invariably I find my code starts working just as tidying it up so that I can write a SO question about it – thank you for the effort you where willing to do go to for bug reporting though. a Screencast is above and beyond the call of duty. :)

  10. May 29, 2014 at 3:32 pm

    Guy from StackExchange’s broken voting method’s relevant question which answered saying “No, there’s still no way to do that.” speaking here.

    Thanks for bringing my attention to this big news, Joe!

    Now, for a while, your post will be the outdated one, aha. :D

    You take StackExchange is broken for its gamification, while there are many other things much worse about it. But none of it really matters. What matters is it works! http://cauecmrego.blogspot.com.br/2014/05/why-stack-exchange-network-rocks.html

    The information is there, but you ignored it (as did I). My answer only got so much acceptance because in the old days it was true. I edited and updated it without looking at new answers.

    Now, this does bring me to an idea… Maybe SEN could also notify people who gave answers and chose to get notified when new answers arrive. In this case it would have been much valuable.

    What people who did answer something better than my answer (you and Crystal) should have done, though, was commenting on my answer. That’s the expected etiquette there, and anywhere really. Make me realize there’s something new.

    In any case, thanks again! I’ll be using this new technique as well! ^_^

  11. Juan Ramón Duarte
    August 11, 2014 at 8:58 am

    Hi,
    Thanks for the article. It helped me solve a recurring gmail annoyance.

    The bookmarklet is not working for Google Apps (I work at a univeristy) since instead of #search the URL says #apps. In this case all that was required was to change one for the other in the bookmarklet like so:

    javascript:(function()%7Blocation.href%3Dlocation.href.replace(%27%23apps%27,%27%23section_query%27)%7D)()%3B

    This now works like a charm. : )

    Thanks again.

  12. creasy
    August 16, 2014 at 6:40 am

    Awesome. Thanks so much for doing this Joe.

  13. September 12, 2014 at 10:40 am

    You are awesome. I am an overuser of filters, mostly for political and coupon emails. So I had close to 10k unread messages in various folders. This will help clean that out quickly.

Leave a Reply