ZF-6156: $_minPrefixLength in Zend_Search_Lucene_Search_Query_Wildcard for ZF-3321breaks the search
Description
the new $_minPrefixLength functionality added in to fix ZF-3321 may break many peoples searches with the default set to 3, I would think this should be changed to 0.
using :
$searchIndex = Zend_Search_Lucene::open($config->datafiles->directory . 'search-index'); Zend_Search_Lucene::setDefaultSearchField('title'); $filter = new Zend_Filter_Word_SeparatorToSeparator(' ','* '); $searchCriteria = $filter->filter($searchCriteria); $query = Zend_Search_Lucene_Search_QueryParser::parse(''.$searchCriteria.'*'); $searchResults = $searchIndex->find($query, 'title', SORT_STRING);
after upgrading to 1.7.7 all my search returned was "At least 3 non-wildcard terms are required." regardless of what anyone was searching for.
I had to add the following in above the call to the QueryParser to fix this issue:
Zend_Search_Lucene_Search_Query_Wildcard::setMinPrefixLength(0);
The lack of documentation for this new functionality certainly didn't help
Comments
Posted by Benjamin Steininger (robo47) on 2009-04-04T04:51:31.000+0000
Setting it to 0 by default allows things like searches for * AND * AND * (and longer) which allows each user to easily let the script run for a long time and consume lots of memory until memory_limit or max_execution_time is reached.
I think security here should come first to not allow those things if the user not explicitly wants it.
Posted by Alexander Veremyev (alexander) on 2009-11-19T01:59:28.000+0000
This behavior is documented now.