Posted:February 6, 2009

Automatic Date Search with Google on Firefox

Firefox Integrated Web Search

A Few Tricks can Give Your Google Searches More Firepower

This post tells you how to easily modify your Firefox browser to enable constant date-filtered searching in Google. This powerful and useful feature is not generally known as even available on the Google engine, and even then is not easily used from within Google. BTW, if you want to cut to the chase about what I recommend, see Option 3 below.

I’m a research hound and do much monitoring of Web sites and queries. I more often than not have too many tabs open in my Firefox browser and I am an aggressive user of Firefox’s integrated Web search, the Search Bar, which is found to the right of the location bar (see image to left).

In monitoring mode, I often want to see what is new or recently updated. I also find it helpful to filter results by date stamp in order to find the freshest stuff or to find again that paper I know got published a couple of years back.

For reasons only known to Google, the only way you can restrict searches by date is to go to the advanced search form page, expand a Javascript section, and then pick your restrictions. Too many clicks! And not reusable!

The image below shows this date search option on the advanced Google search form. (Advanced search is always available as a link option to the right of the standard Google search box.) After expanding the ‘Date, usage rights, numeric range, and more‘ section and then picking a Date option from the dropdown, we see:

Google advanced search form

The dropdown presents only a few options — though helpful — of anytime, past 24 hours, past week, past month and past year with respect to the choices for date filtering.

(BTW, the Web is notorious for not having good date stamp conventions or uniform application of same. As best as I can tell, Google generally date stamps its specific Web pages — URLs — when first indexed in its system. Later minor updates do not apparently result in a date stamp update. However, some highly visited and dynamic sites, such as for example CNN, do seem to have date stamps updated as of time of most recent harvest. This seems to be an issue more for restricting searches to, say, the past 24 hours, involving news or high-traffic sites. Date stamps seem to work pretty well for “normal” Web pages and sites.)

One obvious real problem is the number of clicks it takes to invoke this date option. Another problem is the limited choices available once so done.

Can’t we bring a little bit of automation and control to this process?

And, indeed we can, as the next three options discuss.

Option 1: Direct Manual Changes

Search geeks learn to look to the tips or search conventions for a search engine or to learn the “codes” embedded in the search string URL to discover other “hidden” search goodies. While sometimes overlooked at the bottom of its search page, Google has some helpful search features and advanced search tips that are worthwhile for the serious searcher to study.

The search query string submitted via URL is also worth inspecting. For example, for the screen capture above, which is searching on my standard handle of ‘mkbergman‘, this is what gets issued to Google:

http://www.google.com/search?hl=en&client=firefox-a&rls=org.mozilla%3Aen-US%3Aofficial&hs=rsw &as_q=mkbergman&as_epq=&as_oq=&as_eq=&num=100&lr=&as_filetype=&ft=i&as_sitesearch= &as_qdr=y&as_rights=&as_occt=any&cr=&as_nlo=&as_nhi=&safe=images

Quick inspection of this search string shows us a couple of things.

First, in this case, different variables are declared and separated with the ampersand ( ‘&‘) character. If there is a parameter assignment for that variable, it occurs after the equals (‘=‘) sign. The actual query issued is denoted by ‘q‘. The number of results I asked for is defined by ‘num‘ as 100, and so on.

From the standpoint of the date stamp, the variable we are interested in is ‘as_qdr‘ (which stands for, I think, advanced search, query date range, though Google does not publicly define this as far as I know). In this case, we have set our parameter to ‘y‘, equivalent to what our label above indicates as past year.

The easiest way to use this command is to simply append it (such as ‘&asqdr=y‘) to the end of the query URL in your location bar; here is an example for my recently started company looking for pages in the past year:

http://www.google.com/search?q=”structured dynamics”&as_qdr=y

These search variable codes and what the site accepts are sometimes defined, but generally on the search engine’s Web site. For this Google variable, I first came across this date variable explication from Matt Cutts (who was picking up on a tip from Alex Chitu, though apparently the command goes back to at least 2003), which explained you can:

Change the value of as_qdr to custom intervals. Here are some the possible values of the as_qdr parameter:

d[number] – past number of days (e.g.: d10)
w[number] – past number of weeks
y[number] – past number of years

So, to change the search to the past 5 days change the =d to =d5 for 5 days, or =w10 for ten weeks, or =y3 for 3 years! A nice aspect is that the dropdown date search form remains on the page for subsequent searches during the current session.

Option 2: Automatic Location Bar

Well, if you are like me and this kind of functionality would be of constant benefit, why not make it part of your standard search profile?

The first consideration is that I want the date search box to always appear, but I don’t know in advance the period I want to specify. My first thought was to somehow specify the anytime parameter, but I could not figure it out. The next option I tested was to up the year period to an extremely long time such that all results on the service were standardly shown. That way, I could winnow back from there.

After testing I found that the system would not accept 20 years, but does accept 19! That seems to cover the Web history nicely, so I now had a standard parameter to add to get the date search box to appear: &as_qdr=y19

The next consideration was where to specify this standard. My first attempt was to replace the standard search that takes place in the location bar. To do so, there is an internal Firefox convention for getting at internal settings, about:config, which you enter in the location bar. Once entered, you also get a scary (and amusing) warning message, as this screen shot shows:

Warning sign

If you proceed on from there you get a massive listing of internal settings, listed alphabetically. The one we are interested in is keyword.URL, which can be obtained by entering in the Filter box or scrolling down the long list. Once found, right click on the listing and choose Modify:

Finding the right entry

That enables you to change the default string value. So, enter the standard &as_qdr=y19 right before the query (‘&q=‘) variable at the end of the string:

Change the value

Of course, you can specify any parameter of your own choosing if you want the default behavior to be different.

Option 3: Search Engines Toolbar

This location bar option generally works well, but for many searches initiated from the location bar Google may take you to only a single result based on its ‘I’m Feeling Lucky’ option. That may not be the behavior you want; it wasn’t for me.

My preferred approach is to treat date searching just as another specialty search engine. Thus, that suggests changing the search engine parameters that occur in the Firefox Search Bar (see first image on this page).

Default search engines are stored in the Firefox installation directory’s “searchplugins” folder. (Newly-installed search engines are stored in the Firefox profile folder “searchplugins” folder, so you can have search engine files in both locations.) Search engines are stored as single *.xml files (e.g., google.xml in our specific case) in Firefox 2 and above.

So, to add our new date search filter, you will need to add this line (or whatever your specific variant might be) to your google.xml file:

google.xml file

After saving, quit and re-start Firefox.

And then, voila! We now have a standard date filter on each and every one of our Google searches initiated from the Search Bar !:

Google date search form

😉

Some Closing Notes

  • These same basic techniques can be used for other common search patterns. For example, my own google.xml file also includes the num=100 statement because I like long results sets
  • You can duplicate these files for variants. For example, I often search for filetype:pdf because they often are the higher quality published papers. I then duplicate the entire xml file, give it a different name, and now have it available in my search engine dropdown list box when that specialty search is warranted
  • In fact, we tend to have a monocultural diet when it comes to search engines. But despite the gorilla Google, there are many speciality search options out there, some with their own options for various restrictions and filters. There are scores of engines suitable to the Firefox search dropdown that can be enhanced in similar manner
  • I know these techniques apply equally well to Yahoo!, but did not spend the time duplicating it as an example. I suspect these techniques in fact can apply to any major search engine
  • Both implied and explicit, I recommend all serious searchers spend time learning the syntax and options of their favorite search engine. And, then, in keeping with the spirit of this posting, I recommend fairly focused and ongoing monitoring of Web developments in these respects.

The important message, of course, to all of this is the admonition: Know Thy Tools!

Schema.org Markup

headline:
Automatic Date Search with Google on Firefox

alternativeHeadline:

author:

image:

description:
A Few Tricks can Give Your Google Searches More Firepower This post tells you how to easily modify your Firefox browser to enable constant date-filtered searching in Google. This powerful and useful feature is not generally known as even available on the Google engine, and even then is not easily used from within Google. BTW, […]

articleBody:
see above

datePublished:

One thought on “Automatic Date Search with Google on Firefox

Leave a Reply

Your email address will not be published. Required fields are marked *