Anyone who has been a developer for a day or for several years knows that a percentage of the job consists in finding solutions online, whether it is within FAQs, forums or online community platforms, or official documentation.
A topic that is hardly covered during the programming courses is how to best use Google Search to quickly and punctually find what we need, so as not to waste time and precious attention.
Let's see a roundup of useful tips & tricks for developers of all kinds.
Site statement
The statement site allows you to limit the search to a specific domain or path within the content indexed by Google.
For example, let's say that I want to see the contents that talk about the Python Pandas package but only within the Pypi.org domain.
I would search
pandas site: https://pypi.org/
Note that the address can be even more specific and include not only the top-level domain. For example, I might want to search for the term setup within the official Python documentation limited to version 3.9.
I would search
setup site:https://docs.python.org/3.9/
Very useful use of the site statement is to do a global search at the Google Drive or AWS S3 repository level (of course, only for content whose security policy allows access to you and Google).
I would search
python site:s3.amazonaws.com filetype:pdf
Or
python site:drive.google.com
Filetype
The second statement which si rarely used is the one that allows you to specify the type of file we are looking for. Google Search is usually thought to only contain web pages, but that's not the case at all.
For example, I might want to search only pdf files that pertain to ARIMA time series models on Python.
I would search
python time series arima filetype:pdf
Or look for a Python script where the Chilkat package is used
"import chilkat" filetype:py
An incomplete list of file types supported by Google Search is as follows:
- Adobe Portable Document Format (.pdf)
- Adobe PostScript (.ps)
- Autodesk Design Web Format (.dwf)
- Google Earth (.kml, .kmz)
- GPS eXchange Format (.gpx)
- Hancom Hanword (.hwp)
- HTML (.htm, .html, other file extensions)
- Microsoft Excel (.xls, .xlsx)
- Microsoft PowerPoint (.ppt, .pptx)
- Microsoft Word (.doc, .docx)
- OpenOffice presentation (.odp)
- OpenOffice spreadsheet (.ods)
- OpenOffice text (.odt)
- Rich Text Format (.rtf)
- Scalable Vector Graphics (.svg)
- TeX/LaTeX (.tex)
- Text (.txt, .text, other file extensions)
Common programming languages:
- Basic source code (.bas)
- C/C++ source code (.c, .cc, .cpp, .cxx, .h, .hpp)
- C# source code (.cs)
- Java source code (.java)
- Perl source code (.pl)
- Python source code (.py)
- Wireless Markup Language (.wml, .wap)
- XML (.xml)
Exact match
To search for an exact phrase (therefore the union of several words) it is preferable to insert the text between double quotes.
For example, I might want to search for exactly the following text generated by an error in compiling a script
Importing the numpy C-extensions failed. This error can happen for many reasons, often due to issues with your setup or how NumPy was installed.
The official Google Search documentation does not place a limit on the length or composition of the sentence but, from my experience, I can tell you that I do not recommend using parts of the text that include carriage returns (which may have been typed in various ways on various contents online) and, above all, not to exceed 100 characters of text per single quoted string, as beyond this value it seems to me that there is a significant improvement in performance in terms of quantity and quality of results.
Combined conditions: AND
You can combine AND conditions together simply by writing the words in the field.
For example, if I want to search for results that contain all three of the following words:
- Python
- Try
- Except
- telepot
It will be enough to write
Python Try Except telepot
In some cases, especially if the number of words is large, it could be that Google shows us the results that contain most of the words we have indicated and not all. We can avoid this behavior by pointing in double quotes the most important words for our search, for example
Python "Try" "Except" telepot
Combined conditions: OR
To combine multiple OR conditions it is important to write the conditions interspersed with the OR word (written in capital letters). I can combine AND and OR conditions together, for example with the following statements
scikit learn "random forest" OR "logistic regression"
The results they contain will be shown
scikit learn AND "random forest" OR scikit learn AND "logistic regression"
Combined conditions: NOT
To exclude a word or condition from the search it is sufficient to indicate the minus symbol "-" before the condition itself.
For example, if I wanted to see the results that talk about time series forecast in Python, but not those that include the Prophet library I could indicate
time series forecasting python - "prophet"
Put all toghether
All that has been seen so far can be combined according to the needs of our search.
For example, if we wanted to search for all sites that link to stackoverflow.com I would search
โStackoverflow.comโ -site: stackoverflow.com
I believe that there are further techniques to fill in at least a couple of other articles like this one so if you liked it and want a second and third part, **let me know by sharing the article with your network and showing appreciation here on Dev.to.
Finally, please get in touch with me on my personal website.
Top comments (0)