How to create a search engine for your Drupal site

Zoom Search Engine is a software package that allows you to create a powerful custom search engine for your website. It is unlike other search solutions in that it gives you full control over its indexing capabilities, and there are no advertising or annual fees, while being one of the easiest to use and most feature packed solutions on the market. More on the advantages of using Zoom here.

Another key benefit in using Zoom on your Drupal site is that it can be hosted and indexed within an intranet. Other search services like Google Syndicated Search are remotely hosted, and require your website to be publicly accessible over the Internet. Searches will also need to occur with full Internet access, and you will have no control as to how often the index is updated or what pages should be included or excluded from the indexing. With Zoom, you can run and schedule the indexing yourself on any Windows computer on the network.

The following article explains how to use Zoom with your Drupal website. We provide this tutorial to explain some common details and steps to get a working Zoom Search Engine up and running, and integrated with your Drupal web site as quickly as possible.

What you will need

Zoom is free for small websites of up to 50 pages. For larger sites, commercial editions are available, with the Professional Edition being the most popular, which indexes up to 50,000 pages and costs only US$99. Detailed comparison of the different editions available can be found here.

Using Zoom and indexing your website

Using Zoom on a Drupal website is much the same as using it on any other website, so you will find much more detailed information on installing and running Zoom in the Users Guide (free PDF download). We recommend referring to the Users Guide for most instructions and taking note of the following tips for guidance/reference for Drupal specific details.

But to summarize, Zoom has two main parts. The Indexer software, which runs on your desktop computer, scans your website and generates a set of "index files". These files are then uploaded to your website and provide the searching functionality. You will also be using the Indexer to update your search engine when you make changes to your website in the future.

  1. For a Drupal website, you should use "Spider Mode" in Zoom, which allows it to crawl your live Drupal website. You should specify the URL to your website (e.g. "http://www.mysite.com/") as your Start Spider URL.

  2. The next thing to note is when you are selecting your "Platform" or scripting option. This is the type of scripting you would like Zoom to use internally to provide the search function on your website. You can generally select anything that your web server supports (Zoom offers PHP, ASP, JavaScript and CGI options). But a web server running a Drupal website must have PHP support enabled, so the most common choice here would be "PHP".

  3. One important thing to be aware of when indexing a Drupal site, is that dynamically generated sites, especially complex CMS systems like Drupal (and other forum software, photo galleries, etc.) are generally not particularly Search Engine Friendly. Some of these issues are discussed here, which cover general issues with indexing message boards, etc.

    The key here is that you may need to specify a Skip List of pages which you do not want the spider to follow whilst crawling your website. These include, for example, login or register links, to forum features such as posting and moderating. Due to the various ways a Drupal site can be configured (and all the different combination of plugins that you can install or write), we cannot provide a complete list of pages to skip - it will vary from site to site. We recommend taking a careful look at the pages being indexed, and determining what you need to skip based on the URLs. Having said that, the following is a brief list of common skip page entries which should be used when indexing Drupal sites: /user/register
    /user/login
    /admin/
    /comment/

Once properly configured, Zoom will be able to scan through all the pages of your site and create a set of index files for your search engine.

Spider indexing - scans an online hosted website by spider crawling the links it finds

 

Zoom can FTP upload files to your web server. It will remember your settings and can be configured to automatically upload after every indexing.

These files will then need to be uploaded to your web server. Zoom has built-in FTP functionality so it can do this for you.

We recommend you use Zoom's FTP functionality because some FTP clients may incorrectly upload the files in Text mode. All files should be uploaded in Binary mode.

Once the files are correctly uploaded, you will be able to access your new search engine by entering in the URL to the search page in your web browser. For example, if you uploaded your files to a sub-folder named "zoom", your new search page will be at http://www.mysite.com/zoom/search.php

Enter in some search words and give it a try!

Using Zoom as a DNN Search replacement

As you will notice, the default search page is fairly blank, as it has not yet been customized to suit the look and feel of your website. In addition to this, we would want to integrate the search page within your Drupal site, and we will explain this below.

Integrating your Zoom search page into Drupal using Zoom Search Drupal Module

1. Install and Configure Module. Download the Zoom Search Drupal Module and install it into current Drupal site. Follow the instructions provided by Drupal website, Installing modules. Enable the module after installation and click on the link to configure Zoom Search module settings.

Zoom Search Drupal module settings

We will need to fill in some settings in the configuration page:

  • Path to index files - The path should be from the server root, e.g. if your search files are located at "http://www.mysite.com/zoom/" directory, then the path you should enter is "/zoom".
  • Search page alias - The page alias of your search page. If a page with this alias does not exist, it will be created. If using an existing page, you'll need to add the shortcode [zoomsearch] to the page's content to enable Zoom Search.

Fill in the settings and "Save configuration". A new field should appear, "Zoom Indexer Link Back URL", make note of this URL as you'll need it in the next step.

2. Make changes in Zoom Search and Re-Index. In the Zoom Indexer, under the Advance configuration panel, enter the link back URL (from step 1) for the search page into the "Link back URL:" box. (This will allow Zoom to know where the search page is embedded.)

Note: The non clean URL style (http://www.mysite.com/?node=123) in Drupal is not very search engine friendly and it will not work correctly when embedding Zoom into Drupal. You will need to enable "Clean URLs" within Drupal's configuration page, go to "Configuration->Search and MetaData->Clean URLs".

Additionally, enable the checkbox for "Disable charset enforcing on search script".

Adding a new resource for your Search page in Drupal

Reindex your site and upload the search files.

3. Style the search. While your search should be functional, you will most likely need to edit the contents of "search_template.html" file from the set of Zoom Index file. You will need to modify the file appropriately, since the output of the search script, search.php, will now begin in the middle of the Drupal page. You should remove the <html>, <head> (tag and contents) and <body> tags. Make sure you leave <!--ZOOMSEARCH--> comment in the file, or your search form and/or results will not show up. With the removal of the contents within the <head> tag, which included the CSS for the search, if you want to customize the colours, fonts and overall look of the search page and search results, you can now do so by modifying the CSS file, zoomsearch.css, in the module install directory.

Search page on Drupal site


Adding search boxes to your other web pages

You may now be wondering how you can add search boxes on the other pages of your website. These boxes are often a simpler, smaller version of the search box you see on the search page that allows people to submit a simple search query from any where on the site. It will then take them to this search page with their results.

You can do this by either modifying your Drupal site theme files or by adding a Zoom Search Module block.

  • Modify your theme header to include additional HTML code
    You will need to replace the URL in the below HTML (in bold) with the actual URL to the new search page that you created earlier. <form method="get" action="http://www.mysite.com/search-page/">
    <input type="text" name="zoom_query" size="20" />
    <input type="submit" value="Search" />
    </form>

  • Add Zoom Search Form block to your page
    On Drupal administration page. Go to Structure->Blocks. Locate the "Zoom Search - Search Form" block and assign it to a region for the search block to appear.
    Search page on Drupal site

Finishing up...

Now you have your very own custom search engine as part of your Drupal web site! I hope the above has been helpful in getting you up and running. There are many options and configurations possible with Zoom which you can fine-tune to your heart's content, including highlighting, categories, and more. Please download a copy of the Users Guide for more information.

Enjoy your new search engine!

Troubleshooting

If you have any problems with indexing your website, you should refer to our extensive online support section for help. There is also a Discussion Forum for seeking and sharing tips and advice.

 

Return to the Zoom Search Engine website