【发布时间】:2011-04-12 04:38:29
【问题描述】:
我已经阅读了这个问题 Creating and updating Zend_Search_Lucene indexes.
但它未能解决我的问题。来自zend 的This 文章告诉您无法更新文档。为了有效地更新,每个文档都必须被删除并重新索引。
$removePath = ...;
$hits = $index->find('path:' . $removePath);
foreach ($hits as $hit) {
$index->delete($hit->id);
}
现在,这对我不起作用。我在$removePath 中给出了索引路径并尝试了代码。它没有用。如果我使用与我的特定索引相关的东西,例如$index->find("title:test");,它会抛出
Fatal error: Exception thrown without a stack frame in Unknown on line 0
我也尝试过使用
$query = new Zend_Search_Lucene_Search_Query_Term(new Zend_Search_Lucene_Index_Term('test', 'title'));
$hits = $this -> index->find($query);
但它给出了相同的结果。
我什至不知道如何调试这种类型的错误。即使它被调试,我也只会得到搜索的项目而不是所有的文档。因此,所有文档都不会被删除。
谁能告诉我我做错了什么。如何更新您的搜索索引?
【问题讨论】:
-
能把索引打开的部分贴出来吗?
标签: php zend-framework zend-search-lucene