Error : At least 3 non-wildcard characters are required at the beginning of pattern
While I am using the Zend Lucene Search, I got the Zend exception as below. While Investigate the issue I found some inputs to the search are very strange. Strings are having the special characters at the beginning and ending of the strings. So that causes this exception. The problem solved by trimming the special characters from strings.
Fatal error: Uncaught exception ‘Zend_Search_Lucene_Exception’ with message ‘At least 3 non-wildcard characters are required at the beginning of pattern
Special character trimming from search strings
$special_characters='_$#@?!%=+'; $qstring=trim($search_string, $special_characters); $index = Zend_Search_Lucene::open(LUCENE_INDEX_PATH); Zend_Search_Lucene::setDefaultSearchField('search_field'); $Query = Zend_Search_Lucene_Search_QueryParser::parse($qstring); $searchresults = $index->find($Query);
Best luck 🙂