E-Scribe New Media

Paul Bissex • Literate and Dynamic Web Development

lazyzearch.php

Note: Lazysearch is no longer under active development. Aw.

Current version: 0.3.6

What it is

Lazysearch is a quick & dirty search proxy script designed for use with Mac OS X. At this point installing it is not a drag & drop operation, so you need to be at least comfortable with the command line, editing configuration files, and using Netinfo. Assuming you're still reading, you might be interested in using Lazysearch if any of the following apply to you:
  • you like the "keyword search" feature that some browsers (e.g. Mozilla) have, but use a browser that does not have it (e.g. Safari)
  • you frequently switch browsers and would like to have a unified search shortcut method in all of them (because it isn't tied to the browser, Lazysearch works with every browser, including Lynx)
  • you want to view crufty HTML versions of Unix manpages in your browser
  • you enjoy futzing with Apache and PHP
The script can be fairly easily customized to add new searches or commands.

Lazysearch has been tested on MacOS 10.2.x, with Apache 1.3.x and Apache 2.0.x.

(The lazysearch installation instructions and some of the built-in commands are specific to OS X, but the script should be usable on any Unix system running Apache and PHP. If you are using Lazysearch on another flavor of Unix, please let me know!)

The goods

Installation

  1. First, you need to create a server name devoted to the lazysearch script. (These instructions assume you are doing this just for your own machine.) Create a machine called "s" in Netinfo: "name" is "s" and "ip_address" is "127.0.0.1"

    netinfo.gif

  2. Place the "lazysearch.php" script in your localhost docroot (typically /Library/WebServer/Documents)
  3. Add something like this to your httpd.conf (or any .conf file in /etc/httpd/users):
    NameVirtualHost *
    <VirtualHost *>
    ServerName s
    RewriteEngine On 
    RewriteRule ^/(.*)$ /lazysearch.php?q=$1
    </VirtualHost>
  4. restart apache with "sudo apachectl graceful"
That's it! Now, perform searches by entering URLs like this in any browser:
    s/foobar          search google for "foobar" 
    s/g/foobar        (same) 
    s/m/thx1138       search IMDB.com for "thx1138" 
    s/loc/httpd.conf  use locate(1) to find files on your local filesystem 
    s/man/troff       display HTML manpage for 'troff' 
    s/help/           (help also shown on errors) 

Version history

Version 0.3.6

  • Added Wikipedia and Froogle default web searches
  • Added airport codes and package tracking
  • Check to see whether request is local before executing certain special commands

Version 0.3.4

  • Added airport and zipcode searches
  • Added "today in history" lines to calendar output

Version 0.3.3

  • Added version-checking
  • Added whois search (via e-scribe.com/tools/whois)

Thanks to

  • John F. Whitehead for feedback on manpage munging code
  • JohnCompanies.com for recognizing our efforts

feedback please!

home blog