Site Search Demo

Several people have asked about whether it is possible to obtain a demo of my site search script that they can download to try out for themselves. There is no such download available but further down this page you will find links to demos of most of the functionality of the various versions of the script.

To start with there are three different versions of my script that have all been used at different times on this site. All three versions search an extract of the data from the web pages that you want to include in the search rather than searching the actual pages. This makes the search process itself much faster.

The Javascript version relies on your updating a multi-dimensional array within the script with the information that you want the script to search. There is an online demo of this version of the script (admittedly with only three pages to search between) so that you can see for yourself how it works in practice.

The other two versions of the site search script use PHP. One uses a flat file to store the information about the pages that is searched by the script and the other uses a mySQL database. For a demo of how the search function itself works visit the AMRA site search page which uses the flat file version or Steve's Railway Pages which uses the database version. The "Ask Felgall" site also uses the database version for the search box that appears at the top of every page so as you can see with these versions you don't need it on its own page the way you do for the Javascript version.

The PHP versions of the script also include a password protected administration function that can be used to generate the content of the flat file or database as well as to add/edit/delete entries.

With the flat file version there are four options, three to spider pages within a folder and one to edit the file directly. The three spider options all accept one page within the folder to be spidered as the starting point. Depending on which of the three options is chosen you can either spider the folder without updating anything (to see what the results would be), create a temporary file with the results, or update the actual flat file used for the search. Being a flat file you can also edit the file manually including copying individual lines from the temporary file into the main one where the spider returned lots of pages that you don't want to add. The edit function lists all of the pages in the main search file and allows you to add new entries or edit or delete existing ones.

The database version has three functions. There are two spider functions, one with and one without database update. As well as being able to spider all of the pages within a folder the spider function can also be used to extract the search data from a single page. You can run a demo of this function (without the update) from the Admin page on this site using a userid of "Guest" and a blank password. The folder spidering for the demo will end after ten pages have been spidered. Because the allow_url_fopen option is turned off in PHP on the server that hosts this site you must specify a relative address within this site for spidering (eg. index.html or award/index.html) but if you use the search facility on a server where the option is turned on then you can easily spider any URL to add the pages in that directory to your search. Note that the filename for the page must be specified as no default page name is assumed.

The edit function works similarly to the flat file version except that you can specify part of the filename of those pages that you want listed. The entire content of the database is not listed on the page so this version allows you to have lots more pages than the flat file version. If you don't specify which entries you want listed in the edit function then the list will include those entries that have been previously edited. A utility to convert between the flat file and database versions is also included so an alternate way to update the database is to extract the database to a flat file, manually edit the flat file, and then reload the flat file to the database.

Obviously I can't give you access to try out the update function but this page shows you what the edit facility on this site looks like. Entering information into the form at the top of the page would allow you to add a new entry to the search file or table while selecting the edit button under one of the entries would copy that entry into the form at the top of the table allowing you to update the entry. Pressing the delete button under an entry would delete that entry. Selecting the spider button at the bottom of the page would swap you to the spider option while entering a value and selecting the edit button (also at the bottom of the page but only on the database version) would change which selected entries appear on the edit list. Note that the page only shows you what the edit facility page looks like - all of the form buttons in the main part of the page are non-functional.

Hopefully visiting the above pages will give you a sufficient idea of what to expect from the various versions of my site search script to allow you to determine whether the script meets your requirements.


This article written by Stephen Chapman, Felgall Pty Ltd.

go to top

FaceBook Follow
Twitter Follow