Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Zend Lucene - cannot search numbers

Using Zend Lucene I cannot search numbers in description fields

Added it like this:

$doc->addField(Zend_Search_Lucene_Field::Text('description', $current_item['item_short_description'], 'utf-8'));

Googling for this showed that applying following code should solve the problem, but it did not..:

Zend_Search_Lucene_Analysis_Analyzer::setDefault(new Zend_Search_Lucene_Analysis_Analyzer_Common_TextNum_CaseInsensitive());

any thougts?

like image 908
Pavel Dubinin Avatar asked May 16 '10 08:05

Pavel Dubinin


2 Answers

You have to set the default analyzer twice: On the indexing process as well as on the searching process.

Use the code line from above:

Zend_Search_Lucene_Analysis_Analyzer::setDefault(new Zend_Search_Lucene_Analysis_Analyzer_Common_TextNum_CaseInsensitive());
like image 189
derphil Avatar answered Oct 01 '22 11:10

derphil


Did you use that command before or after calling Zend_Search_Lucene::open()?

Calling it beforehand definitely works.

like image 44
Robert Elwell Avatar answered Oct 01 '22 11:10

Robert Elwell