Brendon, Will do. It may be a cold day in hell before then, but once I have annoyed the guys on IRC enough to get the solution, I will post it. Of course, if you get it to work don't hesitate to fling it my way.
Thanks Dough! On Mar 12, 9:17 pm, Brendon Kozlowski <[email protected]> wrote: > If you end up getting this working, I'd love to hear how you managed > to do it, if you have the time! > > On Mar 12, 12:13 am, DoughBasher <[email protected]> wrote: > > > I have been, for days, trying to add Zend_lucene search to my cake > > site. It works perfectly when I use it in my controller (i.e. without > > the component) but I am not having much luck turning it into a > > component so that it will be available to all of my controllers. This > > is a site-wide search and the form is to appear on every page. > > > The error I am getting is: Fatal error: Call to a member function query > > () on a non-object in C:\wamp\www\test\app\controllers\components > > \lucene.php on line 19 > > (The file lucene.php is shown in section 3, below.) > > > I realise that this is likely to be more of a PHP error than a cake > > one, but I am getting the error, I believe, because of CakePHP's file > > structure and that I have forgotten to do something in the component > > or vendor sections (making it very much a Cake issue, for me). > > > Below is what I've done. > > > I have extracted the Zend library files into the vendors folder so the > > structure is: > > 1) > > - app/vendors/Zend/Search/Lucene/ > > - app/vendors/Zend/Search/Lucene.php > > - app/vendors/Zend/Search/Exception.php > > > 2) > > In my controller that I want to access this component, I have declared > > var $components = array('lucene'); > > > 3) > > The component, lucene.php, contains the following code: > > > <?php > > $path = APP.'/vendors'; > > set_include_path(get_include_path() . PATH_SEPARATOR . $path); > > App::import('Vendor','lucene',array('file'=>'Zend/Search/ > > Lucene.php')); > > > class LuceneComponent extends Object > > { > > var $controller = null; > > > function startup(&$controller) > > { > > $this->data = $controller; > > } > > > function build() > > { > > $index = > > Zend_Search_Lucene::create('/tmp/my-index'); > > //***** The line below causes the error****** > > $company_rs = $this->controller->query('MY VALID > > SELECT > > STATEMENT'); > > //... more irrelevant code not included > > } > > } > > ?> > > The query itself (not shown) is valid, so it's not the SQL. > > What have I done, or not done, to get this to work. > > > Any help would be much appreciated. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~----------~----~----~----~------~----~------~--~---
