Zend_Search_Lucene | Upper Case Results not Displayed

doubler

New Member
I am new to Zend_Search_Lucene and a beginner in Database Operations. I need all your valuable help in solving a Case Sensitivity Issue with the Query Search of Zend_Search_Lucene. QuestionI am fetching userId and emailId from the Database of all users and adding it to the index using \[code\]buildindex\[/code\] controller. Then i am searching for emailId via \[code\]searchindex\[/code\] controller. The Controller Accepts the search parameter via query string and passes it to the \[code\]Zend_Search_Lucene_Search_QueryParser\[/code\]. Everything is Working fine but the upper case values are not displayed when searched. I have many email Id as upper case in my DB. I hope that would be added to the index. Here is my Code. Any help will be Appreciated !Building Index\[code\]public function buildindexAction() { Zend_Search_Lucene_Analysis_Analyzer::setDefault(new Zend_Search_Lucene_Analysis_Analyzer_Common_Utf8_CaseInsensitive()); $index = Zend_Search_Lucene::create($this->_indexPath); $userDao = new Application_Model_UserDao(); $users = $userDao->fetchUserBase(); for ($i = 0; $i < sizeof($users); $i++) { $doc = new Zend_Search_Lucene_Document(); $doc->addField(Zend_Search_Lucene_Field::keyword('userId', $users[$i]['userId'], 'UTF-8')); $doc->addField(Zend_Search_Lucene_Field::keyword('emailId', $users[$i]['emailId'], 'UTF-8')); $index->addDocument($doc); } $index->optimize(); echo "BUILD INDEX : [OK]"; exit; }\[/code\]Searching\[code\]public function searchindexAction() { $this->_helper->viewRenderer->setNoRender(true); $searchString = $this->_request->getParam("searchString"); $index = Zend_Search_Lucene::eek:pen($this->_indexPath); Zend_Search_Lucene_Search_Query_Wildcard::setMinPrefixLength(1) ; Zend_Search_Lucene_Search_QueryParser::setDefaultEncoding('utf-8'); $query = Zend_Search_Lucene_Search_QueryParser::parse($searchString.'*'); $result = $index->find($query); foreach ($result as $_user) { echo 'Hits : '.$_user->score; echo '<br/>'; echo 'UserId : '. $_user->userId; echo '<br/>'; echo 'Email ID : ' . $_user->emailId; echo '<br/>'; echo '<hr/>'; } exit; }}\[/code\]
 
Top