Simple PHP Search Engine
Background
I wanted to provide a way to search a limited access archival digital collection of over 36,000 records,
which contained meta data and where approx 60% of the collection had machine generated OCR data.
To solve this I decided to batch load the "searchable" meta data and OCR data to a three field MySQL database
and make this searchable via a PHP script. The database contained an index field, a title field and search field.
The index and title fields are largely self explanatory with the index field containing a value that would allow
a URL to the digital object concerned to be generated. However the search field contained a concatenation of all
the relevant searchable meta data fields and then appended the machine generated OCR data, if it was available.
The Basic Solution
I then constructed a short PHP script to search the search field and return the results. I was surprised at how
efficiently this process worked for our needs and decided that the basic code to search a single field MySQL
database might be of value to others. Copy the code for this script here.
If you save this file as search.php and then edit it in the appropriately commented locations, you should quite
quickly get it working. (This code was actually working on my test server prior to making it available.)
|