使用Zend_Search_Lucene fopen会失败.fnm文件

时间:2012-04-25 20:23:09

标签: php zend-framework lucene zend-search-lucene

我在一个不基于ZF的独立项目中使用Zend_Search_Lucene。我成功地索引内容,并搜索它们,但问题是它无法创建.fnm文件

这是我正在使用的代码

Zend_Search_Lucene_Analysis_Analyzer::setDefault(new Zend_Search_Lucene_Analysis_Analyzer_Common_Utf8());
Zend_Search_Lucene_Search_QueryParser::setDefaultEncoding('utf-8');
Zend_Search_Lucene_Analysis_Analyzer::setDefault(new Zend_Search_Lucene_Analysis_Analyzer_Common_Utf8_CaseInsensitive());

$this->index = Zend_Search_Lucene::create(self::PATH_INDEX);

$doc = new Zend_Search_Lucene_Document();

$doc->addField(Zend_Search_Lucene_Field::keyword('id',$content['id'],'UTF-8'));
$doc->addField(Zend_Search_Lucene_Field::text('summary',$summary,'UTF-8'));
$doc->addField(Zend_Search_Lucene_Field::keyword('module',$module,'UTF-8'));

$this->index->addDocument($doc);

我也试过

$doc->addField(Zend_Search_Lucene_Field::keyword('module',utf_encode($module),'UTF-8'));

我的内容是可搜索的,但我不知道为什么它不创建fnm文件,它创建其余像cfs文件和fdx,锁,段...等所以它不是目录或权限问题,问题是与锁,我猜。

这是例外

Fatal error: Uncaught exception 'Zend_Search_Lucene_Exception' with message 'fopen(dict/_1.fnm): failed to open stream: No such file or directory' in Zend/Search/Lucene/Storage/File/Filesystem.php on line 67

Zend_Search_Lucene_Exception: fopen(dict/_1.fnm): failed to open stream: No such file or directory in Zend/Search/Lucene/Storage/File/Filesystem.php on line 67

Call Stack:
    0.0882    7819976   1. Zend_Search_Lucene_Proxy->__destruct() Zend/Search/Lucene/Proxy.php:0
    0.0882    7819976   2. Zend_Search_Lucene->removeReference() Zend/Search/Lucene/Proxy.php:63
    0.0882    7819976   3. Zend_Search_Lucene->_close() Zend/Search/Lucene.php:607
    0.0882    7819976   4. Zend_Search_Lucene->commit() Zend/Search/Lucene.php:569
    0.0882    7819976   5. Zend_Search_Lucene_Index_Writer->commit() Zend/Search/Lucene.php:1419
    0.0882    7819976   6. Zend_Search_Lucene_Index_SegmentWriter_DocumentWriter->close() Zend/Search/Lucene/Index/Writer.php:757
    0.0882    7819976   7. Zend_Search_Lucene_Index_SegmentWriter->_dumpFNM() Zend/Search/Lucene/Index/SegmentWriter/DocumentWriter.php:212
    0.0882    7820112   8. Zend_Search_Lucene_Storage_Directory_Filesystem->createFile(???) Zend/Search/Lucene/Index/SegmentWriter.php:280
    0.0882    7820912   9. Zend_Search_Lucene_Storage_File_Filesystem->__construct(???, ???) Zend/Search/Lucene/Storage/Directory/Filesystem.php:184

Anyhelp将非常感激

1 个答案:

答案 0 :(得分:0)

在将目录设为绝对目录后最终工作。