projects




May 2012
SunMonTueWedThuFriSat
 12345
6789101112
13141516171819
20212223242526
2728293031 

your IP is: 38.107.179.231

Blogs

Larry's Blog
Dan's Blog-fest
Andrea's Blog
Gabby's Blog
John's Blog
Tom's Blog

Enabling Multi-Site

Site Search Engines

A CGI/PERL approach

Fluid Dymanics offers a very simple, but fairly nice, search engine package which allows a person to index the pages on their site (or any site) and add a site search to an otherwise static site. The output page is editable, and, though the thing is reasonably useful it's certainly a throwback to an earlier time - relative to a PHP/MySQL approach. It has a full-featured administrative back-end in which you enter URLs into a form, thereby indexing them for the search. One fairly significant problem: this script indexes pages and returns results containing the first few line of the page. If you've got a menu under your header, for instance, the resulting descriptor - the "first few lines", as indexed by this script - may contain a lot of meaningless crap. For instance, at the moment, I have a Javascript menu at the top of this page and the description of the page, as generated by this thing, is basically, a bunch of junk. A site would almost have to be tailored around this thing - it would be fine to "jazz up" an old, static web site (I suppose).

UPDATE: After all of the above, I've found that you can edit the page description, after it's been indexed, in the admin area.

There's a working example at the top of this page. Here's a page that lists other sites which have implemented this search.

Here's my admin area.

A couple of other issues, however. For one thing, if you index a page and have a menu - as on this site - with a lot of common search terms in the menu, all pages are returned as a match. You'd almost need to make dummy pages that are missing this type of menu, and index those, to have the thing make sense. Also, if you're indexing pages on a local server they will not be found if the domain is not listed in the server's hosts file.

A PHP/MySQL approach

I've found two different search engine designs, using PHP and MySQL, that work very well. Each, however, has some limitations.

Adam Khoury

Adam Khoury's design is excellent, but, it doesn't include a "url" column/field and a few other things that I needed. Of course, he's trying to give people the basics and the thing cannot be expected - in it's purest form - to do everything that everone might desire. The tutorial and script was great - it was just a bit incomplete relative to my needs. Note: this script uses a full text search. Also, he offers a script which populates the database with dummy data. Again, the basic design is excellent. It's simply incomplete in the sense that, as I've said, it does not return URLs, the output is formatted in a fairly primitive way, and it doesn't address the issue of populating a database with meaningful information.


Adam Khoury does some of the best PHP tutorials on the web.... While they're highly informative and great educational tools, Adam's sense of fun and his low-key approach make them entertaining to watch, as well - which is rare for, well, goin' to school! I'm sure he's making some money as a cheif contributor at developphp.com, but, you can tell he really enjoys teaching. A lot of people, including myself, owe him a debt of gratitude.

Here's a working example - search for "blah", "bird", or "Disney".

DevShed Tutorial

I found an older tutorial on DevShed and it sort of compliments Adam Khoury's - I'd like to use functions from both to build my own. It includes a script which reads a URL and populates a database - very much like the Fluid Dynamics CGI script. The output includes a URL - this script, however, does not include full text searching in it's stock form. You can search for one word - that's it. Here's a link to the script which reads the URL and shoots data to the database: working example. Here's the actual search.

Anyway, my short term goal is to construct a full text search engine combining components from both of the PHP/MySQL search

Hybridized Trial

After fiddling around I've got a simple MySQL/PHP search working. I want to add boolean functionality and I need to develop an input form - I've had some problems getting links inputted properly. Anyway, search "MySQL", or, "optimized", or "Cocker Spaniel"....


   
   

NOTE ON ABOVE: First, this thing helped a lot....if I had any money, I'd buy it: download.

Watch a video related to the above...

  • The code I've got look like this
  • Without boolean functionality a search for "mysql security" (for instance) could find a match while a similar search - for example a search for "security mysql" would not find a match - and that ain't good. In other words, without the boolean operator the search words must be in a particular order.
  • This is based, largely, on Adam Khoury's model, with the output formatted a bit differently..
  • It's 2 pages, as opposed to one page which posts to itself.
  • I've got a $rowcount line in the script which, I think, may not do anything....updates at 11.
  • I've added a line to remove white space from the beginning and ending of entries - if it's not there, and someone bumps the enter key and adds a couple of space before their entry, all rows in the table are returned as matches.