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

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

More information
Buy Me A Coffee

Your support keeps me writing — let me know if you want your name listed here also.
Browse Articles
Ajax (4), APC (1), CAPTCHA (1), CSS (3), Debugging (1), File Upload (1), Google (3), Google Maps (2), JavaScript (12), JSON (2), MVC (1), MySQL (7), onbeforeunload (1), OOP (1), PHP (33), PhpDoc (1), PostgreSQL (6), Prototype (11), Reflection (1), RFC 1867 (1), Robots (1), Scriptaculous (1), SEO (1), Sessions (2), SimpleXML (1), Smarty (5), SOAP (2), SPL (1), Templates (2), W3C (1), XHTML (1), Zend Framework (6), Zend_Loader (1), Zend_Registry (1), Zend_Search_Lucene (1)

PhpRiot Newsletter
Your Email Address:

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