Free PHP Site Search Tool – BeyondSiteSearch

beyondsitesearch_logoWhen visitors search your site with an internal search function, they may not always find the pages you want them to find for a given search term, and for commercial sites this could significantly affect your conversion rate.

BeyondSiteSearch is a drop-in site search program which provides the ability to customize search results based on specified keywords. This means that visitors who search for “fruit” can still find your product page for apples, even though you don’t mention the word “fruit” anywhere on the page.

The custom results, if specified for a given search term, will appear before the organic results from a traditional index search (like Yahoo! Sponsored Results). The results page can be customized via an HTML/CSS template to fit your site’s look-and-feel.

BeyondSiteSearch is based on phpDig v1.8.7, which requires PHP 4.3.2 or newer with options safe_mode off and allow_url_fopen on, and MySQL 3.23 or newer. It has been reported to run on either Linux/UNIX with Apache or Windows with IIS or Apache.


Note: This is a beta release for development and testing, and should not be considered production-quality. Use at your own risk!

  1. Download beyondsitesearch-0.1b1.tgz and unpack it in your site’s root directory. Rename the directory to whatever you wish to use for a URL to your site’s search function (e.g., “/search”).
  2. From the command line, run `chmod 777` (rwxrwxrwx) on the text_content, includes, and admin/temp directories. On Windows, make sure these directories are writable by everyone. The includes directory can be set to 755 after installation.
  3. Open includes/config.php with a text editor and set the administrator username and password with the ADMIN_USER and ADMIN_PASS constants.
  4. Create a MySQL database and user for BeyondSiteSearch, or get your site’s existing MySQL database connection information ready. BeyondSiteSearch can simply add its tables to your site’s existing MySQL database without interference by specifying a table name prefix during installation.
  5. Go to[DIR_NAME]/admin/install.php and fill in the required information for BeyondSiteSearch to install its tables into a database.If “Create database” is selected (default), the user and password you provide must have sufficient privileges to create a new database.Otherwise, select “Create tables only” and specify the name of an existing database into which the BeyondSiteSearch tables should be installed. You will probably want to specify a table name prefix such as “bss_” to differentiate the BeyondSiteSearch tables from any others already in the database.If installation succeeds, you will be redirected to the admin page.
  6. At the admin page, replace “” in the text box with the site URL(s) you want indexed, then hit “Crawl it!” to begin spidering/indexing the specified URL(s). 

    Note: It may take a while after pressing the “Crawl it!” button before anything happens, so please don’t hit it more than once. A list of spidered URLs will eventually appear. Once the page has finished loading, review the list for completeness then hit [Back] to return to the admin menu.
  7. Go to[DIR_NAME]/search.php to search. You can edit the appearance of this page by editing search_template.html.

Using Custom Results

To create a custom result, click on “Custom Search Results” in the admin menu, then “Create New Custom Result”. Enter the title and URL you wish to appear, and the search terms (separated by commas if you like) which should trigger the display of this custom result. If you have an image you would like to show next to this result, enter the image URL here as well. Hit “Save Changes”. Test your custom result by performing a search, then clicking on your custom result link to register a click in the database.

As your site search function gets used, you should periodically check the “Searches with zero results” report to review searches being performed on your site which are not returning standard search results from the index, as these are obviously prime candidates for a customized result.

From the admin menu, click on “Statistics” then “Searches with zero results” to see a list of searches which did not return any results.

To periodically review the effectiveness of your custom search results, click on “Statistics” from the admin menu then click either “Recent Custom Result Clicks” or “Custom Result Clicks by Keyword”.

Plans For Next Release

  • Re-design admin interface to improve usability
  • Mass-import custom results from tab-delimited file
  • Publication of RSS feed from search results
  • Translation into additional languages
  • Simplify search page template