Subscribe to
Posts
Comments
NSLog(); Header Image

404 Search Function

Matt and I were rapping earlier today and he mentioned how much he liked php.net's search function (php.net/searchterm). This just after a discussion about how necessary "Search" is on our blogs.

So, putting 3 and 1 together, I came up with a built-in search function of my own. I no longer have a 404 page: you're instead either redirected to the page (if there's only one result) or you're shown the search results. So now, just type "http://nslog.com/blah" where "blah" is the search term. Go ahead, give it a try!

10 Responses to "404 Search Function"

  1. hey man, that's sweet ass. i like it a lot. keep up the good work.

    zach

  2. That's a really good idea! Any chance you can release the code that you used for it?

  3. I will when I'm sure it doesn't suck. 🙂 I took a very much "get it working, then make it fast" approach to this one. I currently iterate through every line of the search results page building an array of links, and then, if there's only one link, do I redirect to it. Otherwise I spit out the search results. Probably not optimal. We'll see. I'll put another entry called "404 Search Function Code" or something when I get it done.

  4. Awesome, thanks! 🙂

  5. 404 Search Function

    NSLog();: "Matt and I were rapping earlier today and he mentioned how much he liked php.net's search function ( php.net/searchterm ). This just after a discussion about how necessary "Search" is on our blogs. So, putting 3 and 1 together, I came up wit...

  6. A few days ago I promised that I'd post my 404 Search Function code. Here it is (below). Let me cover a few things first. Initially, I did a preg_match after having done a file(). The file() function returns an array. That's a bit costly, so I just wra...

  7. 404 Search

    Erik J. Barzeski has released his 404 search function code. I have in turn, integrated it into my site. The way the code works is that if you decide that you want to visit http://www.toomuchsexy.org/FOO, and that does not exist, you will either be redi...

  8. 404 Search Page...

    Erik created a wonderful 404 search function. It requires only PHP. This explains what it does. I think this one

  9. Erik,

    Would you be willing to release the code for the search function. I would be interested in trying it out.

    Tameika

  10. I last wrote about the 404 Search in February 2003 (both here and here. Since that time, I've been using the 404 search code quite heavily on every site with MovableType (or any other blogging package). It's undergone some improvements,...