Stack Apps is a question and answer site for apps, scripts, and development with the Stack Exchange API. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top


// ==UserScript==
// @name        StackExchange Google Search
// @description Google questions if query begins with "gq:" and user profiles if query begins with "gu:".
// @version     1.1
// @include*
// @include     http://**
// @include*
// @include     http://**
// @include*
// @include     http://**
// @include*
// @include     http://**
// @include*
// @include     http://**
// @include*
// @include     http://**
// @include*
// @include     http://**
// ==/UserScript==

document.getElementById("search").addEventListener("submit", function(event) {
    var query = document.getElementsByName("q")[0].value;
    if (!RegExp("^g[qu]:").test(query))
    document.location = "" +
        encodeURIComponent(query.substr(3)) +
        "+inurl:" +
        document.domain +
        ( (query.charAt(1) == "q") ? "/questions" : "/users" ) +
        "+site%3A" +
        document.domain +
        "+-site%3A*." +
}, false);


With this User Script, you can override the built-in search with Google's.

Just begin type in your query as usual in the search in the upper right corner, but prefix it with gq: to google all questions or gu: to google all user profiles.


  • gq:unicorn (finds a question with the word unicorn)
  • gq:"a unicorn" (finds a question with the phrase a unicorn)
  • gu:unicorn (finds all user profiles with the word unicorn)


I hereby release this script in the public domain.


This user script has been tested in Google Chrome 17.0.963.6 and Mozilla Firefox 8.0 with Greasemonkey 0.9.13.

share|improve this question

You must log in to answer this question.

Browse other questions tagged .