Bman900 Posted October 17, 2011 Share Posted October 17, 2011 I understand that to search my site I have to use zend_search_lucene but I can not find anything anywhere that explains it in a simple language. For example indexing pages, where is it done? From the controller of each model I want indexed? Quote Link to comment https://forums.phpfreaks.com/topic/249277-zend-search/ Share on other sites More sharing options...
ignace Posted October 17, 2011 Share Posted October 17, 2011 No. Searching is done by querying your database. Lucene is just some product you can use as a front-end with your database to speed up full-text searches. Quote Link to comment https://forums.phpfreaks.com/topic/249277-zend-search/#findComment-1280033 Share on other sites More sharing options...
thehippy Posted October 17, 2011 Share Posted October 17, 2011 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 Quote Link to comment https://forums.phpfreaks.com/topic/249277-zend-search/#findComment-1280050 Share on other sites More sharing options...
Bman900 Posted October 18, 2011 Author Share Posted October 18, 2011 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? Quote Link to comment https://forums.phpfreaks.com/topic/249277-zend-search/#findComment-1280150 Share on other sites More sharing options...
Bman900 Posted October 18, 2011 Author Share Posted October 18, 2011 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? Quote Link to comment https://forums.phpfreaks.com/topic/249277-zend-search/#findComment-1280175 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.