Finding things using Zend Search Lucene in symfony

by Dave Dash 23May07

[tags]Zend, Zend Search Lucene, Search, Lucene, php, symfony, zsl[/tags]

This is part of an on going series about the Zend Search Lucene libraries and symfony. We'll pretty everything up when we're done =)

We now know how to manipulate the index via our model classes. But let's actually do something useful with our search engine... let's search!

[tags]Zend, Zend Search Lucene, Search, Lucene, php, symfony, zsl[/tags]

At the time of this writing we're dealing with Propel which uses Peer classes which are meant for dealing with multiple objects1. This is the perfect place for a ::search() method. In otherwords, UserPeer::search('dave'); should query Lucene for users matching "dave". Let's make that happen:

What we're doing is retrieving our Lucene index. Somewhere between tutorials we wrote this Peer function to handle that:

If our index is missing we'll conveniently create it on the fly. We then use the Zend Search Lucene API to retrieve the matching hits in this index and then use some Propel trickery to retrieve by an array of primary keys.

It's now simple to use ::search() functions in the same manner as you use ::doSelect().

At this point you should be able to create a basic symfony app that can utilize a Lucene index.


  1. The examples refer to using Propel, but it's trivial to adapt this to sfDoctrine

Where am I?

This is a single entry in the weblog.

"Finding things using Zend Search Lucene in symfony" is filed under programming and symfony. It was published in May 2007.

May 2007
M T W T F S S
« Apr   Jun »
 123456
78910111213
14151617181920
21222324252627
28293031  

need more help

If you found our tutorials and articles to be useful, but are still looking for more hands on help, consider hiring us. Find out more about how Spindrop can help you.

 

3 Responses to “Finding things using Zend Search Lucene in symfony”


Who's linking?

  1. 1 developercast.com » Dave Dash’s Blog: Finding things using Zend Search Lucene in symfony Pingback on May 24th, 2007
    "[...] the Spindrop Blog today, there’s the series wrapup for their look at using the Zend Search Lucene functionality inside ... "
  2. 2 INSPIONS MU Blog Networks » Blog Archive » Finding things using Zend Search Lucene Pingback on May 25th, 2007
    "[...] has posted the second part of their series on using ZendSearchLucene from within symfony. This article shows readers how ... "
  3. 3 SourceLOG » Finding things using Zend Search Lucene Pingback on May 25th, 2007
    "[...] has posted the second part of their series on using ZendSearchLucene from within symfony. This article shows readers how ... "

Further Help

If you require more hands on assistance, we do offer affordable hands on support.

Leave a Reply


Comment guidelines: No spamming, no profanity, and no flaming. Inappropriate comments will be deleted outright.