Parcourir la source

Zend_Search_Lucene: Update documentation for Wildcard queries. [ZF-6290]

git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@15256 44c647ce-9c0f-0410-b52a-842ac1e357ba
alexander il y a 16 ans
Parent
commit
fe3430fa88

+ 11 - 0
documentation/manual/en/module_specs/Zend_Search_Lucene-QueryLanguage.xml

@@ -131,6 +131,17 @@ test*
 ]]></programlisting>
             It searches for "write", "wrote", "written", "rewrite", "rewrote" and so on.
         </para>
+        
+        <para>
+            Starting from ZF 1.7.7 wildcard patterns need some non-wildcard prefix. Default prefix length is 3 (like in Java Lucene).
+            So "*", "te?t", "*wr?t*" terms will cause an exception<footnote>
+            <para>Please note, that it's not a <code>Zend_Search_Lucene_Search_QueryParserException</code>, but a 
+            <code>Zend_Search_Lucene_Exception</code>. It's thrown during query rewrite (execution) operation.</para></footnote>.  
+        </para>
+        <para>
+            It can be altered using <code>Zend_Search_Lucene_Search_Query_Wildcard::getMinPrefixLength()</code> and 
+            <code>Zend_Search_Lucene_Search_Query_Wildcard::setMinPrefixLength()</code> methods.
+        </para>
     </sect2>
 
     <sect2 id="zend.search.lucene.query-language.modifiers">

+ 1 - 1
library/Zend/Search/Lucene/Search/Query/Wildcard.php

@@ -143,7 +143,7 @@ class Zend_Search_Lucene_Search_Query_Wildcard extends Zend_Search_Lucene_Search
         $matchExpression = '/^' . str_replace(array('\\?', '\\*'), array('.', '.*') , preg_quote($this->_pattern->text, '/')) . '$/';
 
         if ($prefixLength < self::$_minPrefixLength) {
-        	throw new Zend_Search_Lucene_Exception('At least ' . self::$_minPrefixLength . ' non-wildcard terms are required.');
+        	throw new Zend_Search_Lucene_Exception('At least ' . self::$_minPrefixLength . ' non-wildcard characters are required at the beginning of pattern.');
         }
 
         /** @todo check for PCRE unicode support may be performed through Zend_Environment in some future */