PhpRiot
Download Article
Download this article in PDF format with all listings and files.

Price: $5.00 AUD
(Approx. $4.35 USD)

More information
PhpRiot Newsletter
Your Email Address:

More information

Creating A Fulltext Search Engine In PHP 5 With The Zend Framework's Zend Search Lucene

Introduction

Note: This article has been updated to be compatible with Zend Framework 1.0.3. The original article used an early preview version of the Zend Framework.

This article covers the implementation of a fulltext search engine using PHP 5 and the Zend Framework. We will be using the Zend_Search_Lucene component to create and search our fulltext index.

There are several other libraries we could use instead of this one, but Zend_Search_Lucene is completely native to PHP, whereas others such as Xapian or Tsearch2 rely on third party modules (for instance, the Tsearch2 module must be compiled into your PostgreSQL installation).

It must be noted at this point though that we require at least PHP 5 for Zend_Search_Lucene – PHP 4 will not work.

In this article we will be covering the following:

  • How to index a document or series of documents
  • The different types of fields that can be indexed
  • Searching the index

To demonstrate this functionality, we will cover the implementation of a search engine into PhpRiot. We previously used the Tsearch2 module but had some problems that we were unable to overcome.

In This Article


Article History

Apr 26, 2006
Initial article version
Dec 17, 2007
Updated to use Zend Framework 1.0.3