One of the most important parts of programming is the ability to solve problems. And a key part of the problem solving process is being able to effectively conduct research. Fortunately, thanks to search engines, research no longer means going to the library and looking through an endless index. However, knowing some useful shortcuts can make it a lot easier to quickly find the solution to your problem.
What To Search
The most important step towards getting the solution to your problem is to search using the proper query. In general, a query should hover between being too specific so very few results are found and too broad so that many results aren't an answer to your problem.
Search Engine Query Parameters
As Google is by far the most popular search engine, most of the emphasis of this article will be directed at effectively utilizing Google as opposed to other search engines.
You can always use Google's Advanced Search tool if you forget any of the shortcuts, and it's also easier to use for more advanced queries.
Search A Specific Website Using Google
Although most websites have their own search feature, it's still very common to use Google to find a specific page of a website because of their advanced indexing and ranking algorithms. As such, you'll often want to make a search on Google, but only show results from a particular website. In the case of programming, this is often Stack Overflow.
In order to limit your search to a particular website, you can simply add site:www.example.com to the end of your query. Google will also include any subdomains of the website, so "site:example.com" will also include results on "www.example.com", "blog.example.com", etc. This also allows you to only show government websites by adding "site:.gov", for example.
Search For A Specific String
Google will try to help you by not taking your query at face value. Instead of simply searching their index for every occurrence of your query, Google will instead try to understand it and show the most relevant results. Although this is a helpful feature most of the time, sometimes you'll want to search for a specific error or something else that you don't want to be broken up. In this case, you can put the portion you want to appear in the result in quotes. You can also use a mix of quotes and non-quoted strings; in this case all of the quoted strings must appear in the website for Google to show you the result, but not necessarily in order.
You can add a minus symbol (
-site:example.com will only show results that aren't on example.com. This can also be used to only show results that are missing a certain string:
compile error -"swift", for example, will show results for the search "compile error" but that don't contain "swift".