ZF-6156: $_minPrefixLength in Zend_Search_Lucene_Search_Query_Wildcard for ZF-3321breaks the search


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:


The lack of documentation for this new functionality certainly didn't help


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.

This behavior is documented now.