Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
zend_search_lucene
06-04-2012, 05:15 PM,
#1
Thumbs Up  zend_search_lucene
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:ConfusedetDefault(new Zend_Search_Lucene_Analysis_Analyzer_Common_TextNum_CaseInsensitive());
$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:ConfusedetDefault(new Zend_Search_Lucene_Analysis_Analyzer_Common_TextNum_CaseInsensitive());
$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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)

Contact Us | LetoDMS Community Forum | Return to Top | | Lite (Archive) Mode | RSS Syndication