Perform Proximity Searches

GAPS performs a proximity check between two words.

Sometimes it would be advantageous to search both forward and backward. For example, if you’re doing genealogy research, you might find your uncle John Smith as both “John Smith” or “Smith John.” Similarly, some pages might include John’s middle initial—“John Q Smith” or “Smith John Q.”

Tip

If all you’re after is query permutations, [Hack #28] might do the trick.

You might also need to find concepts that exist near each other but don’t make up a phrase. For example, you might want to learn about keeping squirrels out of your bird feeder. Various attempts to create a phrase based on this idea might not work, but just searching for several words might not find specific enough results.

GAPS, created by Kevin Shay, allows you to run searches both forward and backward and within a certain number of spaces of each other. GAPS stands for Google API Proximity Search, and that’s exactly what this application is: a way to search for topics within a few words of each other without having to run several queries in a row. The program runs the queries and automatically organizes the results.

You enter two terms (there is an option to add more terms that will not be searched for in proximity) and specify how far apart you want them (1, 2, or 3 words). You can specify that the words be found only in the order you request (wordA, wordB) or in either order (wordA, wordB, and wordB, wordA). You can specify how many results ...

Get Google Hacks, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.