Everything is a search problem. Master your search skills.
Tags: productivity, editor, tools
Published: 2019-09-08 15:58:27

Once during a meeting, my manager said to us _"In this age of information and the internet, everything is a search problem. If you know how to search, half your troubles are over."_

As a programmer most of your days are spent editing code written by either you, or other people. These coding tasks have objectives. You need information to fulfill them. Information about your coding language, about the project your are working on, and about how it fits in the big picture of your company's success.

The places from where you could get these information can be classified into 4 categories:

1. __The person who assigned you this task__. Your project lead or manager. If you get to pick the task instead of getting assigned, then the product owner might be this person. (If you are the product owner, then it's the business stakeholder who wants this task to be done. _We aren't talking beyond this level_.)
2. __The system__. It's your company's knowledge repository. Confluence, wiki softwares etc. And other secondary places like google drive, dropbox, trello, github (source code is info too), slack, your email (recurring news coming from a distribution-list you are part of) etc.
3. __Other people__. More often than not, you'll have to pull information from others, within your team and across teams, people in partner services, clients etc. Ping or email them or setup a meeting to get the information out.
4. __You__. Well that's what you get paid for right? Your unique set of technical skills and the knowledge you can draw from your past experiences contribute the most to solve the puzzle at hand.

For the puzzle at hand, assuming you've got everything you need to know about it from your manager and other people, what's left is the system and you. __It pays to be able to find information quickly from the system using your advanced search skills__.

Here's a list of places where you could practice and improve your search skills.

### Searching Code
* Search for a word across a project:
  - search for a whole word, case-sensitive or case-insensitive
  - search using regular expression
  - search within a specific sub-folder
  - search within a file, forward or backward
* Search for a file:
  - within a project and across the system
  - within current directory and within all levels of subdirectories of current directory
  - fuzzy search (where you type part of the absolute path as well)
  - ignoring certain files and directories (modern search tool like [ripgrep](https://github.com/BurntSushi/ripgrep) can respect your `.gitignore` files)
  - catch-all item: google ["vim advanced search"](https://www.google.com/search?q=vim+advanced+search) or ["vs code advanced search"](https://www.google.com/search?q=vs+code+advanced+search). Read the manual and blog posts you find. Print them out, keep by your desk and deliberately practice.
* Learn to do these two items above both within your favorite editor and from terminal command prompt (`grep` and `find` family of commands).
* Search for a bug (aka debug). Ok, it's not fair to put debugging as yet another line-item. But it's still a search and you need to master your stack's best debugging tools so you can find and squash that bug.
* Your code has a lot of dependencies ('gems' in ruby, 'jars' in java, 'packages' in node etc). Your debugging rabbit hole might lead you to code within these dark zones. You need to be able to quickly search them (eg: in ruby we can run the terminal command `bundle open activerecord` which will open the locally installed library's root path in an editor)
* Learn to navigate around your code. I use [ctags](https://github.com/universal-ctags/ctags) in vim to go to method/class/module definitions. But VS code and sublime text have much better version of these functionalities. (I was blown away when [VS code showed the css rule](https://marketplace.visualstudio.com/items?itemName=pranaygp.vscode-css-peek) defined for the class my cursor was under in a pop-up!)

### Searching Jira and Confluence
Jira is the most widely used issue-tracking system. Tell yourself to love it. It's [JQL (Jira Query Language)](https://confluence.atlassian.com/jiracore/blog/2015/07/search-jira-like-a-boss-with-jql) is such a joy to use (because it auto-suggests unlike psql or mysql). You can create advanced queries and save them so you don't have to type the query again.

Use it quickly to find all sorts of tickets. I have saved queries for:

* finding tickets my teammates are assigned to, or even just participate etc.
* specific kinds of tickets. Eg: I often have to run a specific kind of task in production. The details are in the previous such ticket. I have a query that returns all instances of such deployment tickets.
* mentions of my project in any jira ticket in the whole company.
* mentions of a word within 2 weeks. Because in this case only the recency matters.

Once you have created and saved all the queries you can think of, go and ask your lead or other experienced person about their own saved queries. You will get a lot of ideas of how to search jira and get what you want.

And do I have to say there's also the equivalent [CQL](https://developer.atlassian.com/server/confluence/advanced-searching-using-cql/)?

### Searching Email
Most people from "_English-is-not-my-native-tongue_" countries don't know to use basic email features. Once you read a new mail, you process it by either deleting it or archiving it or by applying some labels and moving it off of your site.

But you can find many junior developers, especially from developing countries, keep all their mails sitting in the inbox. For years. (Just look at the "Inbox (9876)" counter). They don't know the concept of inbox or archiving. (I blame it on the words used to describe them. Instead it should be "_tabletop_" (or "_desktop_") and "_basement rack-room_".)

Anyway, learn the [email basics](https://support.google.com/a/users/answer/9297685?hl=en) first (assuming you use gmail). Because, to search it effectively, you'll first need to put things there effectively in a structured manner. Use "_filter messages like this_" liberally and apply labels of all sorts (emails from your immediate boss, emails from your teammates, automated emails from the services you use like jenkins, jira, code review tool etc.)

And then, learn to [search it](https://support.google.com/mail/answer/7190) effectively.

### Searching Google
Your coding problems aren't older than 2008 which is when StackOverflow came into existence. There's a green-ticked solution waiting just for you. In the worst case, there's somebody who've toiled hard to write a blog post detailing the solution for your problem.

You just need to ask google nicely to show that page to you. You need to know [Google-Fu](https://ahrefs.com/blog/google-advanced-search-operators/). Learn to search for specic words, ignore words, search within a set of websites, search for specific filetypes etc.

### Searching Other Tools
* Slack - [here](https://get.slack.help/hc/en-us/articles/202528808-Search-in-Slack) and [here](https://slackhq.com/next-level-searching-in-slack).
* Github - [here](https://help.github.com/en/articles/about-searching-on-github).
* Google Drive - [here](https://support.google.com/drive/answer/2375114?co=GENIE.Platform%3DDesktop&hl=en). I didn't know that drive can also search the contents of the files.
* Your internal log search/parse tools. Eg: [Kibana](https://www.elastic.co/guide/en/kibana/current/search.html) (they have KQL and LQL. And you only know SQL.)

## Conclusion
My manager went on to say that if your company can't find a good candidate then it's still a search problem, not a _lack-of-candidate_ problem. It then led to discussions of how to search certain websites to find the best candidates.

In the night I dreamed of him telling one of our unmarried colleague "that's a search problem too. You just need to know the advanced filters."

So... learn to ask interesting questions and also where and whom to ask them. You don't deserve to be frustrated.

In our jobs, not every day we get to write great code showing off our algorithm, data-structure and recursion skills. It's mostly CRUD. But we could solve important business problems by deliberately seeking the right information and putting two and two together. I look up to people who can do that and try to up my own search game.

_Please share in comments any other 'searches' that might help us all become better at our jobs._

(Thanks to my manager for bringing this to my attention.)