Zend and the Art of Search

8
Zend and the art of search Dave Dash Spindrop LLC Minneapolis USA * Im a symfony evangelist for any wholl listen * I write articles and how-tos on spindrop.us * Im the lead developer for reviewsby.us * Ive worked on a number of symfony sites, many which boast search powered by Zend

description

Some slides that I used in my presentation at symfonycamp. I may upload notes later, or you can request them by emailing me.

Transcript of Zend and the Art of Search

Page 1: Zend and the Art of Search

Zendand the art of search

Dave DashSpindrop LLC

Minneapolis USA

* I’m a symfony evangelist for any who’ll listen* I write articles and how-tos on spindrop.us* I’m the lead developer for reviewsby.us* I’ve worked on a number of symfony sites, many which boast search powered by Zend

Page 2: Zend and the Art of Search

don’t repeat yourself. don’t repeat yourself. don’t

repeat yourself. don’t repeat yourself. don’t repeat

yourself. don’t repeat yourself. don’t repeat yourself.

don’t repeat yourself. don’t repeat yourself. don’t

repeat yourself. don’t repeat yourself. don’t repeat

yourself. don’t repeat yourself. don’t repeat yourself.

don’t repeat yourself. don’t repeat yourself. don’t

repeat yourself. don’t repeat yourself. don’t repeat

yourself. don’t repeat yourself. don’t repeat yourself.

don’t repeat yourself. don’t repeat yourself. don’t

repeat yourself. don’t repeat yourself. don’t repeat

yourself. don’t repeat yourself. don’t repeat yourself.

don’t repeat yourself. don’t repeat yourself. don’t

repeat yourself. don’t repeat yourself. don’t repeat

yourself. don’t repeat yourself. don’t repeat yourself.

don’t repeat yourself. don’t repeat yourself. don’t

repeat yourself. don’t repeat yourself. don’t repeat

yourself. don’t repeat yourself. don’t repeat yourself.

don’t repeat yourself. don’t repeat yourself. don’t

repeat yourself. don’t repeat yourself. don’t repeat

yourself. don’t repeat yourself. don’t repeat yourself.

don’t repeat yourself. don’t repeat yourself. don’t

repeat yourself. don’t repeat yourself. don’t repeat

yourself. don’t repeat yourself.

D R

Y

* The core symfony framework can do quite a lot* The greatest strength of symfony is it’s ability to extend beyond the core * Plugins * PEAR libraries * other frameworks?* In symfony (and other frameworks) we embrace the idea of DRY: Don’t Repeat Yourself * Not just in our applications, or the framework itself, but open source PHP in general * If there’s good code available, don’t re-invent the wheel.

Page 3: Zend and the Art of Search

bridge = simple

* Even without help, Zend and ezComponents are easy to use within symfony* But why not build a bridge* The Bridge is simple, it allows us to call classes from Zend or other frameworks and autoload them* That’s it

Page 4: Zend and the Art of Search

lucene

* We’re going to specifically look at Zend Search Lucene* Great way to quickly add a powerful search engine to your web app* Apache Lucene is a feature-rich, but easy to use search engine library written in Java * Ported to C, Ruby and of course PHP* The ports generally use binary compatible libraries, meaning we can write one part of the search in Java and another part in PHP if necessary* PHP isn’t always the best language for heavy server-side lifting, so we can pull out resource-intensive processes that are unbecoming of a PHP script and use Java to take care of them. We’ll touch on that later

Page 5: Zend and the Art of Search

search = 3 things

* We’ve got a bridge, we’ve got a php library, search is a snap, so let’s talk about adding it to our applications* There’s three or four things we do with a search engine * Index records * Delete records * Query records * We do update, but at least with Lucene that involves deleting and indexing* If you’ve seen the tutorials I have online they are written in a propel-specific manner, this is by no means a requirement, we can very easily use Doctrine or any type of object we want to index* If we have time, which we might, I’ll show a demo with the code in action if people would like* Since our primary task is searching or querying records we’ll start there * In either our Peer or Table class for our object which we have indexed we’ll want a query method. * This method loads the search index and uses the Zend Search Lucene library to query* All these queries will be useless without a built up index * In our object’s class we override the save method and have it delete all the old records of the object in the index (if any) and create a new one from scratch using the Zend API * We store the fields we’d want to search on in the index* Finally we need to override our delete method for our object and make sure it removes its records in the search index upon deletion

Page 6: Zend and the Art of Search

extension

Page 7: Zend and the Art of Search

questions?

Page 8: Zend and the Art of Search

i can has demo?