![]() |
zend_search_lucene - Printable Version +- LetoDMS Community Forum (https://community.letodms.com) +-- Forum: LetoDMS Support (https://community.letodms.com/forumdisplay.php?fid=4) +--- Forum: Tutorials & How To's (https://community.letodms.com/forumdisplay.php?fid=17) +--- Thread: zend_search_lucene (/showthread.php?tid=499) |
zend_search_lucene - mghipparagi - 06-04-2012 Hi all, I am using zend search lucene for searching sentences in a paragraph and below is the sample code I used to search. FOR CREATING INDEX: ---------------------------------- $this->content="This enabled me to improve my presentation skills, experience taking a Q&A session and learn to work to deadlines."; require_once '/home/project/mgh/lib/Zend/Search/Lucene.php'; Zend_Search_Lucene_Analysis_Analyzer: ![]() $index = new Zend_Search_Lucene('/home/project/mgh/data/search_file/lucene.customer.index',true); $doc = new Zend_Search_Lucene_Document(); $doc->addField(Zend_Search_Lucene_Field::unIndexed('URL', $file1_path)); $doc->addField(Zend_Search_Lucene_Field::text('contents',$this->content)); $index->addDocument($doc); $index->commit(); for searching ------------------ require_once('Zend/Search/Lucene.php'); Zend_Search_Lucene_Analysis_Analyzer: ![]() $index = new Zend_Search_Lucene('/home/project/mgh/data/search_file/lucene.customer.index'); Zend_Search_Lucene::getDefaultSearchField('contents'); $results = $index->find('contents:"improve my extra skills" '); $this->count=count($results); On searching for "improve my presentation skills" it is resulting 0 result count. Actually, words like improve - my - skills will get matched but only word 'extra' will not be matched. How to get result count even if few words are matched and few gets unmatched... Please reply.. Thanks in advance. mghipparagi Posts: 1 Joined: Mon Jun 04, 2012 12:04 pm Location: bangalore |