Zend_Search_Lucene 无法返回文档

发布于 2024-08-22 11:41:44 字数 1329 浏览 5 评论 0原文

我正在努力解决使用 Zend_Search_Lucene 时遇到的错误/问题。现在我有 2 个索引,我搜索一个已解析的 html 页面/文本,我使用 Zend_Search_Lucene_Document_Html::loadHTML() 函数读取内容并添加到 lucene 索引之一。

另一个索引是我使用 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() 函数和一些添加的子查询生成搜索查询。

是否存在任何已知问题,为什么在解析文档时我对它们的搜索运行良好,但我创建的文档上的搜索失败并出现上述错误消息?

非常感谢,

格兰特

I am struggling with a bug/problem that I am having trouble with when using Zend_Search_Lucene. Now I have 2 indexes that I search one that is parsed html pages/text that I use the Zend_Search_Lucene_Document_Html::loadHTML() function to read the contents and add to one of the lucene indexes.

The other index I manually create a lucene document using the Zend_Search_Lucene_Document() function, adding text and keyword fields to the document.

Both methods to add data to my indexes work, and using Luke (awesome tool) to view the indexes I can see the different documents in both indexes and I can write manual queries using Luke that return results.

I am currently getting errors when I search against the index containing the manually created documents. When building queries using the Query API provided in the framework, I get the number of results that I am expecting however when I try to get the "Document" from this search hit, there is nothing being returned.

I'm getting the following errors

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.'

If I run searches on the indexes with the HTML content and the Query API I get results with documents in them that I can get some of the document data from.

With both queries I am generating search queries using the Zend_Search_Lucene_Search_QueryParser::parse() function with some added Subqueries.

Is there any known issues why when parsing a document my searches against them run fine, but the ones on documents that I create fail with the error messages above?

Many thanks,

Grant

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

╰◇生如夏花灿烂 2024-08-29 11:41:44

请注意,当我尝试将 Lucene 搜索结果存储在会话文件中以便在另一个页面上使用时,我收到了这些错误。

清除会话,放入一些代码来存储我需要的结果信息作为 stdClass() 的实例,然后将其保存在会话中,一切又正常了。

我基本上想说的是,您试图检索保存到文件系统中的 Lucene 待办事项,无论是 Zend Cache、会话还是其他什么。

Just a note, I received these errors when I tried to store Lucene search results in the Session file for use on another page.

Cleared the session, put in some code to store the result info I needed as an instance of stdClass() and then saved that in the session and all was ok again.

I'd basically say your trying to retrieve something todo with Lucene which was saved to the file system, whether that be Zend Cache, the session or whatever.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文