Index-based search engine

Find is a module for Cotonti that provides a platform for index-based search. The system will index words within nodes in the database, meaning it will create a database table of words out of content spread across the database, allowing for fast site-wide search, even on websites with thousands of nodes.

The module provides an API for registering nodes to be indexed. Each node must have its own plugin to register it with the Find module. Plugins for the Pages and Forums modules are provided by default.

#1. Installation

Upload the module and plugins to the correct location in your site. Then go to the admin panel and enable the Find module, as well as the node plugins ('Find in Forums' / 'Find in Pages').

Check the configuration values in Admin -> Config -> Find. The default values should be fine in most cases. Now that setup is complete, all existing nodes in the system must be indexed before you can find anything. Go to the Admin section of the Find module (Extensions -> Find -> Administration) and click on "Re-index all nodes". This action will take a few minutes, depending on the number of nodes (pages, forum posts) in the database.

You can install a search box in any part of the website, simply by creating a form with action="index.php?e=find" and method="GET" (we use GET to prevent annoying 're-send form data' messages in the browser and allow for Google indexing of results pages). The only form field should have name="q". Here's an example (with CoTemplate callback for a nicer URL):

<form action="{PHP|cot_url('find')}" method="GET">
  <input type="text" name="q" />
  <button type="submit">{PHP.L.Submit}</button>

#2. Github

This module is also available on Github and screams for improvement. If you have anything to add, fix or improve, don't hesitate to fork it!

1. lukgoh  2011-11-07 22:50

Doesn't want to work for me :(

Only registered users can post new comments