Jump to content
Larry Ullman's Book Forums
Sign in to follow this  
Jonathon

Yii Search Engine

Recommended Posts

Hi Larry,

 

Just wondered if you planned on using Zend Lucene for this like some older articles you wrote? Second question. If so, are your current articles on it still accurate with changes to Yii or Zend since you wrote them?

 

Thanks

 

Jonathon

Share this post


Link to post
Share on other sites

Hey Jonathon,

 

Thanks for the questions. Originally I was planning on using Zend Lucene in that chapter, and I haven't changed my mind, but I also haven't revisited the topic yet. As far as I know, those articles I wrote on using the two together are correct. Please let me know if you see anything not work.

Share this post


Link to post
Share on other sites

I shall try and get through it soon and let you know how I get on in general and any points of confusion or further clarity in case they will be of use to you in the book.

Share this post


Link to post
Share on other sites

First issue, zend doesn't seem to have the same set up now. No exception or lucene search. So I downloaded https://github.com/zendframework/ZendSearch that seemed to encompass these files and i placed them in the vendors/zend/ directory.

 

So my structure is:

 

vendors

- zend

- ZendSearch

- lucene - exception

 

Looks like Zend_Search_Lucene has now become just Lucene.

 

Additionally I think you need to use namespaces to load it properly.

 

I have tried:

// import zend files
04 Yii::setPathOfAlias('ZendSearch',Yii::getPathOfAlias('application.vendors.Zend.ZendSearch'));
05
06 // include Lucene.php
07 require_once('Lucene/Lucene.php');

That fails for me.failed to open stream: No such file or directory

 

But the Lucene folder is below the ZendSearch folder and Lucene.php resides within there.

 

I made changes based on this link http://www.yiiframework.com/doc/guide/1.1/en/extension.integration

Share this post


Link to post
Share on other sites

Ok, I made some progress

// import zend files
Yii::setPathOfAlias('ZendSearch',Yii::getPathOfAlias('application.vendors.Zend')); 
 
// include Lucene.php
require_once( Yii::getPathOfAlias('ZendSearch'). '/ZendSearch/Lucene/Lucene.php');

But within the action section I think you need to access Lucene like:

 
$index = new ZendSearch\Lucene;
 

That says that the include paths fails. Which is right because it references it as 'vendors/Zend/Lucene' from the setPathOfAlias I imagine.

 

When it needs to be 'vendors/Zend/ZendSearch/Lucene./Lucene.php.

 

So I know the problem I believe but I'm unsure how to go correctly about it rather than just make a hash of it.

 

Because I thought the require_once would avoid this problem as Lucene.php has been included.

 

On a side note. I hear good thinks about Solr.

Share this post


Link to post
Share on other sites

Thanks for sharing your experience. I totally forgot that ZF has changed significantly since I wrote those articles. I'll have to revisit this carefully when the time comes.

Share this post


Link to post
Share on other sites

There seems to be very little around for the new ZendSearch (ZF2). I'm not expecting any answers on here I just thought i'd let you know how I was getting on, which wasn't amazing. 

 

I am considering using a SOLR extension as reading around SOLR seems to be very quick where as Lucene has a tendancy to become slow (how accurate that is i do not know), but a couple of the SOLR extensions look outdated.

 

Also came across ElasticSearch which seemed interesting, I see S/O are using it too.

 

There's a Yii extension for it also

 

https://github.com/tripiko/yii-elasticsearch (Seems up to date, but no docs yet for it)

 

Anyway, thank Larry

 

Jonathon

Share this post


Link to post
Share on other sites

Ironically (or not), both SOLR and ElasticSearch are based upon Lucene. I'll have to do some research and make a good decision for that example chapter. Thanks for bringing it up, Jonathon!

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...