未找到结果时 Zend Lucene 显示黑屏
当我使用索引中存在的字符串向 Zend_Lucene 提交查询时,结果会按预期显示,但是当找不到字符串时,我会得到一个空白页面,没有错误消息。使用的代码如下:
require_once 'Zend/Feed.php';
require_once 'Zend/Search/Lucene.php';
$index = Zend_Search_Lucene::open('data/my-index');
$queryStr ='fjkhsdkdfh';
$hits = $index->find($queryStr);
if ($hits) {
foreach ($hits as $hit) {
echo $hit->page_title;
}
} else {
echo 'No results found.';
}
我希望出现“未找到结果”,但我得到的是一个空白页面,没有错误消息。
更让我困惑的是,我已经在本地进行了测试和工作,但是当在实时服务器上时,它停止工作。
我在本地安装了 Zend Server 4,远程安装了 PHP 5.2.11 和 ZF 1.10.2
非常感谢任何帮助!
保罗
When I submit a query to Zend_Lucene with a string that exists in the index, the results are displayed as expected, however when string is not found, I get a blank page with no error messages. Code used as below:
require_once 'Zend/Feed.php';
require_once 'Zend/Search/Lucene.php';
$index = Zend_Search_Lucene::open('data/my-index');
$queryStr ='fjkhsdkdfh';
$hits = $index->find($queryStr);
if ($hits) {
foreach ($hits as $hit) {
echo $hit->page_title;
}
} else {
echo 'No results found.';
}
I would expect 'No results found' to appear, but instead I get a blank page with no error messages.
What confuses me more is that I have this tested and working locally, but when on a live server it stops working.
Locally I have Zend Server 4 installed, remotely PHP 5.2.11 and ZF 1.10.2
Any help much appreciated!
Paul
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我实际上找到了解决此问题的方法,该方法涉及通过单个页面处理整个例程。当我由于某种原因调用外部函数来生成查询时,总是返回空白页面。通过将所有脚本放在一页上,我能够显示结果。
I actually found a work around to this that involved processing the entire routine through a single page. As I was calling in external functions to generate the querys for some reason a blank page was always returned. By placing all script on one page I was able to have results displayed.