Jump to content

Zend search?


Bman900

Recommended Posts

Lucene is designed around the idea that its searching and indexing documents.  Lucene indexes fields that you choose in the document to base its index on.  Say I have a website with recipes, so my pages consist of the fields with the name, date added, ingreditents list, instructions and another field with the location/url.  I have to feed Lucene that data in the form of a document (Zend_Search_Lucene_Document) in order for those to get added to the index.

 

Given that you probably already have a website, create a simple crawler to iterate through your existing data, create Lucene documents with the fields you wish added to the Lucene index.  You'll also want to create a class/script/plugin to trigger after data has been added or updated to your site to keep the Lucene index current. There is no update in lucene, you delete the document and then re-add it to the index.  Its largely up to you where you add to the index.

 

Zend Presentation on Implementing Zend_Search_Lucene

Link to comment
https://forums.phpfreaks.com/topic/249277-zend-search/#findComment-1280050
Share on other sites

Wow thank you for the info. It seems easy in theory but getting down to it is impossible for some one who is new to the framework. I have tried creating the spider in your link but for some reason it keeps giving me errors with the include files. Till I finaly get the hang of this framework more, is there another way of creating a search of my site with Zend?

Link to comment
https://forums.phpfreaks.com/topic/249277-zend-search/#findComment-1280150
Share on other sites

Well I got mad and decided not to give up. So far I actualy got a way of indexing newly added articled but the trouble comes in when I need to update them. I understand I have to delete the document and re ad it. Am fine with the re adding but the deletion deletes everything!

 

$index = Zend_Search_Lucene::open('index');


		$removePath = 'article/view/' . $id;
		$hits = $index->find('url:' . $removePath);
		foreach ($hits as $hit) {
    		$index->delete($hit->id);
		$index->commit();

 

Any ideas why its deleting everything in the index and rather no the documents that match my remove path?

Link to comment
https://forums.phpfreaks.com/topic/249277-zend-search/#findComment-1280175
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.