Apple documentation search that works
You’ve probably tried searching Apple’s developer documentation like this:
Edit: That’s the filter field, which is not what this post is about. The filter sucks. This isn’t just an easy way to use the filter field; it’s an entirely different solution. Read on.
You’ve probably been searching it like this:
(And yes, I know about site:developer.apple.com. That often isn’t much better than without it. Again, read on.)
There is a better way.
Better than that: A best way.
Setup
First, you must use Google Chrome or OmniWeb.
Go to your list of custom searches. In Chrome, open the Preferences and click on Manage:
In OmniWeb, open the Preferences and click on Shortcuts:
Then add one or both of these searches:
For the Mac
Chrome | OmniWeb | |
---|---|---|
Name | ADC Mac OS X Library | |
Keyword | adcmac | adcmac@ |
URL | http://developer.apple.com/library/mac/search/?q=%s | http://developer.apple.com/library/mac/search/?q=%@ |
For iOS
Chrome | OmniWeb | |
---|---|---|
Name | ADC iOS Library | |
Keyword | adcios | adcios@ |
URL | http://developer.apple.com/library/ios/search/?q=%s | http://developer.apple.com/library/ios/search/?q=%@ |
Result
Notice how the results page gives you both guides and references at once, even giving specific-chapter links when relevant. You even get relevant technotes and Q&As. No wild goose chases, no PDF mines, no third-party old backup copies, no having to scroll past six hits of mailing-list threads and Stack Overflow questions. You get the docs, the right docs, and nothing but the docs.
For this specific purpose, you now have something better than Google.
March 6th, 2011 at 16:25:20
I’ve found that the order and quality of results are usually better from Googling site:developer.apple.com than from searching directly on developer.apple.com.
March 6th, 2011 at 16:47:25
Jeff Johnson: I’ve found the opposite. Google, whether I restrict to developer.apple.com or not, has gotten pretty consistently bad for me. Often, it’ll only turn up the PDF, not the specific chapter I want in the HTML doc; when it does show me what I want, it’s nowhere near the top. So far, Apple’s search (again, not the filter field) has worked very well.
I only wish Xcode’s built-in search were this good.
March 6th, 2011 at 16:51:20
And, to be clear, that’s not Google’s fault. Apple’s had a bad habit lately of changing the links around for little to no apparent reason, with the result that Google-juice is not distributed as properly across Apple’s documentation as it once was.
March 6th, 2011 at 18:27:59
Forgive me if this is obvious, but you don’t even need to be using one of those browsers. Just create a two-line bookmarklet if you’re using a browser without custom searches. Save the following to a HTML document, then bookmark the links.
Search Mac
Search iOS
[Links fixed by your humble host —PRH]
[And now, bug fixed by your humble host; thanks to Andy Lee for pointing it out, and let the record reflect that it was my fault, not Erik’s —PRH]
March 6th, 2011 at 18:29:39
Sigh. Naturally I forgot to update the text in the anchor tag to “Search Mac”, and naturally WordPress ate my HTML. But you don’t even have to go to the trouble of creating the HTML document anymore. Just drag those two links and rename the first one.
March 6th, 2011 at 18:31:11
I should just stop talking. Please disregard my previous comment, I spoke without actually testing the links. But I’m sure everyone gets the gist.
March 6th, 2011 at 22:14:23
There’s a Safari extension called “ADC Search” that provides a dedicated text field that I assume does something similar.
http://acmeinc.org/extensions
Takes up some screen space, but one could add a keyboard shortcut for the menu item that toggles the view on and off. Or figure out from the source code how to do what Erik mentioned. Also you have to click on the field — it’s a pain to tab into.
March 6th, 2011 at 22:15:16
Weird, I’ve no idea why my “‘” characters got backslashed.
March 7th, 2011 at 01:08:09
Or set up a custom search for Alfred – http://developer.apple.com/library/ios/search/?q={query}
March 7th, 2011 at 01:18:42
I’ll go through and fix up the markup on your comments.
I would assume any browser extensions use the filter field (which is powered by JSON), not the search. The filter sucks.
March 7th, 2011 at 01:26:01
Erik: Your links should be effective bookmarklets now. I hope I didn’t take too much creative license in filling them out. At any rate, bookmarklets are a good idea—good thinking.
March 7th, 2011 at 05:23:39
Well, the Safari extension returns the same four-column search results, and also includes links to key doc pages at developer.apple.com. BUT the bookmarklet only uses a bit of my bookmarks bar, and by putting it near the beginning of my bookmarks bar (in Safari) I can get to it with Command-1 or -2 or whatever, with keyboard focus right where I want it. So — many thanks to Peter and Erik!
March 7th, 2011 at 06:28:54
Okay, a nitpick with the bookmarklet: if I hit Escape it doesn’t cancel the search, but rather does a search for “null”. I’ll take a look later and see if I can offer a fix.
Thanks again. I blogged about this here: http://www.notesfromandy.com/2011/03/07/great-bookmarklet-for-searching-the-docs/.
March 7th, 2011 at 07:40:50
Awesome, thanks for the tip. This makes it so much easier to search the docs. And also, its a great reason while I still use OmniWeb.
March 7th, 2011 at 07:41:32
That’s no nitpick, Andy; that’s a valid bug report. I fixed it in the links in Erik’s comment above.
Anybody who’s previously saved those bookmarklets should re-save them.
March 7th, 2011 at 09:24:41
Thanks, Peter. I’ve updated my blog accordingly.
March 7th, 2011 at 14:15:16
I’ve been using a variation of this by using Alfredapp and a shortcut, works very nice.
March 7th, 2011 at 14:33:11
Also works great w/ the PopSearch Safari Extension: http://canisbos.posterous.com/pages/popsearch
March 7th, 2011 at 22:04:41
Thank you very much, this was indeed helpful.
There is a port called AppKiDo over at http://www.macports.org, that I’m eager to try, but I haven’t come that far. Well, I’m comitted to try it every way since I already have decided so. But this is way beyound better than using google. -I have been so tired of writing “site:developer.apple.com” Thanks
March 8th, 2011 at 01:25:10
Tommy Bollman: AppKiDo is a native Mac OS X application, so you can get it directly from the developer.
March 8th, 2011 at 08:44:08
I don’t use Chrome or OmniWeb. I use Safari and I also use LaunchBar. LaunchBar let’s you create “Search Templates”. Here are the two I created using the above info:
iOS: http://developer.apple.com/library/ios/search/?q=*
Mac: http://developer.apple.com/library/mac/search/?q=*
These let me invoke LaunchBar, type my shortcut and search on the fly in Safari.
March 8th, 2011 at 15:54:55
This also works in Camino, with the same links you give for Chrome. (I believe Firefox also supports the same thing, but I couldn’t swear to it.)
cl
March 12th, 2011 at 15:19:46
Hi Peter
Had this open in a tab for a few days and just got round to setting it up: epic failure ensued! http://bit.ly/ezpCfd . Not a problem with your tip per-se but wtf? Google returned the correct result first time :(
March 12th, 2011 at 15:20:28
Jamie: Kooky. It still works for me. Did you retry it?
March 18th, 2011 at 08:32:20
Good idea. Easily adapted for LaunchBar.
April 14th, 2011 at 18:09:16
What a great tip! Thanks, Peter.