How do I set up the Google Custom Search to include only pages from a Stack Overflow tag?

For example adding http://stackoverflow.com/questions/tagged/guava will not find the article pages. There's no common pattern URL for the pages and tags are not subdomains.

  • This isn't possible to do. Out of interest why don't you just search within SO? Why do you need to use Google? Commented May 6, 2011 at 10:37
  • I try to setup a custom search for all Guava project related content. (See groups.google.com/group/guava-discuss/msg/78fdbb6ed7c95ffe) The search results should combine the information from all these places. Commented May 6, 2011 at 11:17
  • you could use site:stackoverflow.com guava, although it would include everything with the word guava
    – user10629
    Commented Jun 8, 2011 at 15:04

1 Answer 1


This isn't possible as said in the comments.
Google is really bad with explaining what the Custom Search Engine (CSE) is capable of doing.

Taking your example https://stackoverflow.com/questions/tagged/guava

The first question (at the current time of this posting)

Java Generics Wildcards Question

So let us try to get this from the CSE.

Using the URL pattern

www.stackoverflow.com/questions/tagged/guava?*, which according to the Help Page:

Matches all URLs beginning with www.example.com or example.com

This should take care of questions

One obtains for a custom search for "Java" ... no results

Trying to re-duplicate with a regular old search
site:stackoverflow.com/questions/tagged/guava -inurl:java Java inurl:page

Notice that without inurl:page we get one of the results

Text file into Java Set using Commons or Guava

Not the result we wanted but a result nonetheless. So now it is time to refine the CSE because now it means that the CSE is not searching the first page stackoverflow.com/questions/tagged/guava but only those under pagination.

So the updated URL patterns

www.stackoverflow.com/questions/tagged/guava?* www.stackoverflow.com/questions/tagged/guava

where the second should only match a single page according to the Help Page. Does it ? No. It matches the URL Pattern www.stackoverflow.com/questions/tagged/guava*. At first I thought that maybe it is implicit but I re-read the help center:

For example, the pattern 'www.foo.com/bar' will only match the single page 'www.foo.com/bar'. To cover all the pages where the URL starts with ' www.foo.com/bar', you must explicitly add a '*' at the end

So I did not add the wildcard pattern and the CSE went ahead and searched for results I did not want

Comparing the results

Google CSE

Google Search

So at least they are returning the same results now. Though we still have not got the first result Java Generics Wildcards Question. With it being known that the number of results changes for whatever reason within Google, let us try refining the search and assume the result could still be found with "Java Generics".

This makes the results really different with the CSE giving 0 results and Google Search giving 21 results. So in the end, I really don't think you should rely on Google search in the way you are looking to do it. It just doesn't seem to be searching properly.

Another way I have tried is using the link: parameter


but you cannot use other parameters when using this.

A third way would be to use StackOverflow Search


(but this is rate limited, you will not reach far) and you cannot couple it with the CSE.

You may need to look for a site that has proper attribution (This is at the bottom of every Stackoverflow page) and organizes the questions according to tags



Or something like that, this way it would be more Google friendly to your needs.

  • The best way to search for a tag - I found - is to use keywords in the custom search engine. The results are okay (at least for guava on SO). Commented May 17, 2011 at 15:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.