2010-02-23 140 views
1

我正在努力解决使用Zend_Search_Lucene时遇到的问题。现在我有两个索引,我搜索一个解析的html页面/文本,我使用Zend_Search_Lucene_Document_Html :: loadHTML()函数读取内容并添加到其中一个lucene索引。Zend_Search_Lucene无法返回文档

其他索引I手动创建使用的Zend_Search_Lucene_Document()函数,添加文字和关键字字段到文档一个Lucene文档。

向我的索引中添加数据的两种方法都有效,并且使用Luke(真棒工具)查看索引我可以在两个索引中看到不同的文档,并且我可以使用Luke编写手动查询来返回结果。

当我搜索包含手动创建的文档的索引时,我当前正在收到错误。当使用框架中提供的查询API构建查询时,我会得到我期待的结果数量,但是当我尝试从此搜索结果中获取“文档”时,没有任何内容会被返回。

我收到以下错误

Warning: fseek(): supplied argument is not a valid stream resource in C:\www\mysite\development\website\library\Zend\Search\Lucene\Storage\File\Filesystem.php on line 93 

Warning: fread(): supplied argument is not a valid stream resource in C:\www\mysite\development\website\library\Zend\Search\Lucene\Storage\File\Filesystem.php on line 158 

Warning: flock() expects parameter 1 to be resource, integer given in C:\www\mysite\development\website\library\Zend\Search\Lucene\Storage\File\Filesystem.php on line 214 

Uncaught exception 'Zend_Search_Lucene_Exception' with message 'Field name "itemname" not found in document.' 

如果我运行的HTML内容和查询API让我在他们的文档的结果,我可以从得到一些文档数据的索引搜索。

与这两个查询我生成使用并增加了一些子查询Zend_Search_Lucene_Search_QueryParser :: parse()函数的搜索查询。

有原因解析文档我对他们的搜索运行正常时,任何已知的问题,但我创建的文档的那些失败,上面的错误消息?

非常感谢,

格兰特

回答

1

刚一说明,我当我试图存储在另一页上使用的会话文件Lucene搜索结果收到了这些错误。

清除会话,把一些代码来存储结果的信息,我需要的是()stdClass的一个实例,然后保存在会话中,一切都ok了一次。

我基本上是说,你想检索与Lucene的东西待办事项其保存到文件系统,不管是Zend的缓存,会话或什么的。