Sunday, June 7, 2009

loook: A light-weight text search tool for OpenOffice documents

If you are happily running a desktop search tool such as Tracker or Beagle, read no further. You already have the search tool you need to search OpenOffice files and more. These desktop search tools build indexes to improve search performance, and are in general quite scalable. Yet, a desktop search tool may be an overkill if you are just searching for certain text string in a directory containing OpenOffice files.

loook is a no-frill, yet very functional text search tool for OpenOffice files. Unlike the aforementioned desktop search engines, it does not build an index of your OpenOffice files. Despite the lack of an index, searching a hierarchy of 75 OpenOffice documents only took a couple of seconds. That is good enough for my use.

loook composes of a single zipped-up python script which you can freely download and install. Unzip the downloaded file into a directory of your choice. On my Debian Etch system, I did not have to install any additional packages for loook to run.

Running the tool cannot be any simpler. Open a bash shell, and enter:
$ python somedir/loook.py 



The Viewer field has the default value: soffice. This is the name of the OpenOffice executable. You don't need to change this field unless your version of OpenOffice has a different name or the executable is not in your default PATH.

What you do want to change are the following fields:

  • Search Path
  • Search Terms
  • Mode


Search Path

You navigate or type in the path of the directory containing the OpenOffice files you want to search. loook will recursively search the hierarchy starting from the specified directory. Unfortunately, you are limited to specifying one starting directory only.

Search Terms

You enter your search terms in this field. Note that loook supports Unicode. Non-English language users can search using UTF-8 characters.

Mode

The Mode determines whether a match requires all the search terms to be present in a document (AND search), any of the terms to be present (OR search), or the terms must appear together (PHRASE search).

You can pre-populate the search path and the search terms. Simply enter them as arguments to loook on the command line. For example,

$ python somedir/loook.py /home/peter/mydocs "Cisco Routers"



The search results are returned in the Matches field. Note that only the full path of the files are returned. It does not display the actual matches. You can double click the file path in the Matches field to directly open the file with OpenOffice.

loook does not have all the bells and whistles that you expect of a desktop search tool, with respect to both features and supported file formats. However, if all you want is a light-weight tool for searching OpenOffice documents in a directory structure, it is worth your time to try it out.