mirror of
https://git.code.sf.net/p/seeddms/code
synced 2025-06-07 05:39:21 +00:00
- added new functions open() and create()
This commit is contained in:
parent
f9510def4f
commit
9da96a1968
|
@ -22,22 +22,36 @@
|
||||||
* @copyright Copyright (C) 2011, Uwe Steinmann
|
* @copyright Copyright (C) 2011, Uwe Steinmann
|
||||||
* @version Release: @package_version@
|
* @version Release: @package_version@
|
||||||
*/
|
*/
|
||||||
class LetoDMS_Lucene_Indexer extends Zend_Search_Lucene {
|
class LetoDMS_Lucene_Indexer {
|
||||||
/**
|
/**
|
||||||
* @var string $indexname name of lucene index
|
* @var string $indexname name of lucene index
|
||||||
* @access protected
|
* @access protected
|
||||||
*/
|
*/
|
||||||
protected $indexname;
|
protected $indexname;
|
||||||
|
|
||||||
|
function open($luceneDir) { /* {{{ */
|
||||||
|
$index = Zend_Search_Lucene::open($luceneDir);
|
||||||
|
return($index);
|
||||||
|
} /* }}} */
|
||||||
|
|
||||||
|
function create($luceneDir) { /* {{{ */
|
||||||
|
$index = Zend_Search_Lucene::create($luceneDir);
|
||||||
|
return($index);
|
||||||
|
} /* }}} */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new index
|
* Do some initialization
|
||||||
*
|
*
|
||||||
* @return object instance of LetoDMS_Lucene_Search
|
|
||||||
*/
|
*/
|
||||||
function __construct() { /* {{{ */
|
function init($stopWordsFile='') { /* {{{ */
|
||||||
$this->version = '@package_version@';
|
$analyzer = new Zend_Search_Lucene_Analysis_Analyzer_Common_Utf8_CaseInsensitive();
|
||||||
if($this->version[0] == '@')
|
if($stopWordsFile && file_exists($stopWordsFile)) {
|
||||||
$this->version = '3.0.0';
|
$stopWordsFilter = new Zend_Search_Lucene_Analysis_TokenFilter_StopWords();
|
||||||
|
$stopWordsFilter->loadFromFile($stopWordsFile);
|
||||||
|
$analyzer->addFilter($stopWordsFilter);
|
||||||
|
}
|
||||||
|
|
||||||
|
Zend_Search_Lucene_Analysis_Analyzer::setDefault($analyzer);
|
||||||
} /* }}} */
|
} /* }}} */
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user