chaiwei Posted July 21, 2009 Share Posted July 21, 2009 Hi, Yesterday I came across zend search lucene, It is faster than database query if I am not mistaken. My question is , what if I stored all the data using apache lucene instead of database? I only have little knowledge on it. Can some one explain briefly for me please? Thanks. Quote Link to comment https://forums.phpfreaks.com/topic/166798-solved-zend-search-lucene/ Share on other sites More sharing options...
Daniel0 Posted July 21, 2009 Share Posted July 21, 2009 It's for search indexing. It's not a database. Quote Link to comment https://forums.phpfreaks.com/topic/166798-solved-zend-search-lucene/#findComment-879539 Share on other sites More sharing options...
chaiwei Posted July 21, 2009 Author Share Posted July 21, 2009 okay. So when I create a article using tinyMCE and save it into database. Normally when I search, I usually query my database. But now if I wan to use lucene to create index. So I insert the article into database, and I using zend lucene, Insert again? I saw someone code like this: <?php require_once 'Zend/Search/Lucene.php'; $index = Zend_Search_Lucene::open("/var/www/lucene-data/blog-index"); $doc = new Zend_Search_Lucene_Document(); $doc->addField(Zend_Search_Lucene_Field::Keyword('url',"http://ganeshhs.com/url-3")); $doc->addField(Zend_Search_Lucene_Field::UnIndexed('articleId', 3)); $doc->addField(Zend_Search_Lucene_Field::UnIndexed('postedDateTime',"20007-12-29 01:40:00")); $doc->addField(Zend_Search_Lucene_Field::Text('title',"Porting PHP to Javascript : php js")); $doc->addField(Zend_Search_Lucene_Field::UnStored('contents', "During graduation got interested in web technology, to kick start i started reading html, javascript.")); $doc->addField(Zend_Search_Lucene_Field::Text('category', "Javascript")); $index->addDocument($doc); $index->commit(); $index->optimize(); So I insert into database first then only I create index using above code? Then when the time we search, We search for the keyword using lucene, then Get the url from lucene, and using php header jump to that page and retrieve article from database again. right? Quote Link to comment https://forums.phpfreaks.com/topic/166798-solved-zend-search-lucene/#findComment-879567 Share on other sites More sharing options...
Daniel0 Posted July 21, 2009 Share Posted July 21, 2009 Yes. Quote Link to comment https://forums.phpfreaks.com/topic/166798-solved-zend-search-lucene/#findComment-879589 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.