import v1.1.0_beta1 | 2009-08-21
This commit is contained in:
@ -69,7 +69,7 @@ abstract class Zend_Search_Lucene_Analysis_Analyzer_Common extends Zend_Search_L
|
||||
$token = $filter->normalize($token);
|
||||
|
||||
// resulting token can be null if the filter removes it
|
||||
if (is_null($token)) {
|
||||
if ($token === null) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
@ -19,11 +19,8 @@
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
||||
|
||||
/** Zend_Search_Lucene_Analysis_TokenFilter */
|
||||
require_once 'Zend/Search/Lucene/Analysis/TokenFilter.php';
|
||||
require_once 'Zend/Search/Exception.php';
|
||||
|
||||
|
||||
/**
|
||||
* Token filter that removes stop words. These words must be provided as array (set), example:
|
||||
@ -80,11 +77,13 @@ class Zend_Search_Lucene_Analysis_TokenFilter_StopWords extends Zend_Search_Luce
|
||||
*/
|
||||
public function loadFromFile($filepath = null) {
|
||||
if (! $filepath || ! file_exists($filepath)) {
|
||||
throw new Zend_Search_Exception('You have to provide valid file path');
|
||||
require_once 'Zend/Search/Lucene/Exception.php';
|
||||
throw new Zend_Search_Lucene_Exception('You have to provide valid file path');
|
||||
}
|
||||
$fd = fopen($filepath, "r");
|
||||
if (! $fd) {
|
||||
throw new Zend_Search_Exception('Cannot open file ' . $filepath);
|
||||
require_once 'Zend/Search/Lucene/Exception.php';
|
||||
throw new Zend_Search_Lucene_Exception('Cannot open file ' . $filepath);
|
||||
}
|
||||
while (!feof ($fd)) {
|
||||
$buffer = trim(fgets($fd));
|
||||
@ -93,7 +92,8 @@ class Zend_Search_Lucene_Analysis_TokenFilter_StopWords extends Zend_Search_Luce
|
||||
}
|
||||
}
|
||||
if (!fclose($fd)) {
|
||||
throw new Zend_Search_Exception('Cannot close file ' . $filepath);
|
||||
require_once 'Zend/Search/Lucene/Exception.php';
|
||||
throw new Zend_Search_Lucene_Exception('Cannot close file ' . $filepath);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user