Monday, September 01, 2008

Can I have my search results as a link list, please?

The classic word processing search function isn't so useful in large documents, and there's a much better way to handle things that I've encountered in a few applications: returning search results as a list or report, with one hit per row, and making the rows clickable links back to the location of the search hit in the text. I'll call this a search report.

I want one of these in every future version of every word processor, please.

You've seen this on any web search page. You're just probably not used to seeing it in a desktop application. This feature is awesome, and I'll tell you why.

Suppose you're editing a document for variations on a term like WebLogic. You want to inspect all the places where it's used and make sure they're correct. Maybe you want to use the longer name "BEA WebLogic" in some places, not in others. A good search report will give you lots of help:

  • It'll display a total of hits, so you know instantly how much editing you've got ahead of you.
  • It'll show the hits in context, highlighting the search term.
  • You can use this feature to edit incrementally and check your progress. For example, you can make some changes, then rerun the search and see how many items you have left to fix.
Emacs has a good implementation of this through its occur feature, which also supports regular expressions. You can do lots of fun things with this. I do things like mark lines with special strings so that I can list them....creating touchpoints in my document that I can use to jump around and navigate it. For example, in a text document I create titles and put the marker "@#@" on the title lines, to delineate sections. Then I can issue an occur command for all lines containing @#@, and I get a linked list of those lines...effectively an ad-hoc table of contents for the document.

UPDATED 9/4/08: I was just using Emacs, and realized another neat aspect of an occur search. I couldn't remember a word I'd used earlier in the file I was working on. I knew it ended in "ium". So I did an occur search for "ium." Emacs then splits the screen and shows me the search hits in the lower half. I could see the information I needed without ever leaving the place where I was writing. Now that's service!

No comments:

Post a Comment