Search me

It’s been a busy week at work, and what little evening time I had I spent avoiding thought. I’m still not ready to write a real post, but I thought it worth sharing this little TextExpander tip.

A couple of days ago, Michael Schechter tweeted about using his blog as sort of a personal journal.

@macdrifter @ttscoff I’ve taken up Brett’s philosophy. My site is essentially an online log, but instead of code its self-improvement.
  — Michael Schechter (@MSchechter) Wed Aug 29 2012 3:30 PM

Brett Terpstra replied,

@MSchechter the “online log” is a common thread through @drdrang, @macdrifter, @Veritrope and more… seems to work :).
  — Brett Terpstra (@ttscoff) Wed Aug 29 2012 3:33 PM

as did Gabe Weatherhead,

@ttscoff @MSchechter @drdrang @Veritrope That’s why I rebuilt my search engine? I search my site more than anyone. It’s my public brain
  — macdrifter (@macdrifter) Wed Aug 29 2012 3:34 PM

By the time I started looking through my timeline Wednesday night, the conversation was long since over, and I didn’t try to revive it. But Brett’s exactly right: I do use ANIAT to record both the tricks and scripts I come up with and the reasoning and motivations behind them. And like Gabe, I expect this public resource to be far more useful to me than to anyone else. The reasons I make it public are:

  1. I have a healthy enough ego to think that what interests me will interest others.
  2. I’ve learned a lot for free from the blog posts and web pages of others and want to return the favor.
  3. Writing an explanation for others to read is the best way to ensure that I’ll understand it later.

For a long time, I searched through my old posts by using the built-in WordPress search tool—the same tool you can use over in the sidebar. But in recent months, I’ve been using Google.

You know how to do a site-specific search in Google, right? You just add

site:leancrew.com

to the list of search terms and the search is restricted to that site. The same addition works for DuckDuckGo and Bing, too.

For a week or so, I searched ANIAT this way, typing in the site-specific restriction and, often as not, making a typo along the way. The obvious improvement was to make that into a TextExpander snippet,

Leancrew search snippet

and now I just type ;lean after1 the other search terms to search this site only.

There’s nothing clever about this, but it’s easy (for me, at least) to forget that TextExpander can be used outside of “documents.” Any place text can go, TextExpander can go, too.

And while I use this to speed up searches of my blog, the same idea could be used to speed up searches of any domain. A snippet for site:docs.python.org, for example, would be a great way to search through Python’s language and module documentation.2


  1. No, the site: term doesn’t have to be after the other terms, but that’s the habit I’ve developed, and I don’t see any reason to change. 

  2. I know DuckDuckGo has a bang search for Python, but I think this is better. The bang search uses python.org’s internal search tool, which isn’t nearly as good as the native searches in Google or DuckDuckGo. 


5 Responses to “Search me”

  1. Carl says:

    I use a simple bookmarklet for my self-searching:

    javascript:sel=getSelection();if(sel=='')%7Bvoid(sel=prompt('Blog%20search:',''))%7D;if(sel)%7Blocation.href='http://www.google.com/search?sitesearch=blog.carlsensei.com&q='+encodeURIComponent(sel)%7D;
    
  2. Tom Shannon says:

    Just an FYI - the built in text expansion in OS X works fine for this. “System Settings” -> “Language and Text” -> “Text”. Plug in you expansion characters on the leftin the table and your replacement text on the right.

  3. David Galletly says:

    I wrote a little response on using TextExpander for searches from the perspective of a casual-user: TextExpander Search Shortcuts

  4. Dr. Drang says:

    Carl,
    What I don’t like about a bookmarklet solution is that it makes the process of searching my site fundamentally different from the process of searching in general. But I’m lucky in that all of my computers are Macs. If I used Windows at work and a Mac at home, I might see the bookmarklet as more consistent rather than less because I wouldn’t be able to use TextExpander on Windows.

    Tom,
    I agree that TextExpander is overkill for this snippet and that OS X’s built-in expansion can do the job. But since I have TextExpander and need it for my more complicated snippets, I use it everywhere. This keeps all my snippets in one place—easy to organize and easy to find when I want to make a change.

    David,
    Your solution is essentially a homegrown version of DuckDuckGo’s bang search in that you’re using a site’s own search tool. I’m sure that works well with many sites. My goal with the ;lean snippet was to avoid the WordPress search tool because Google gives better results for leancrew.com

    By the way, I am totally stealing your %key:enter%. Since I always put site:leancrew.com at the end of my search string, there’s no need for me to hit the Return key to start the search.

  5. Clark says:

    If you use Glims for Safari you can setup multiple search engines. It comes with quite a few including Google, Yahoo, Bing, Amazon and more. But it’s trivial to create a new one using the site: tag to set it up to search your own blog or other blogs you read a lot or even Stack Overflow.

    Like Gabe I have to admit I use my blog partially to keep track of articles I know I’ll go back to. And I do fairly regularly. Put I also get a lot of help finding articles via Google. So if I discover something, even if it’s something perhaps only a few people would care about, I try and do a blog post to “pay it forward.”