0

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

4

1 回答 1

0

实际上,我找到了一种解决方法,它涉及通过单个页面处理整个例程。当我出于某种原因调用外部函数来生成查询时,总是返回一个空白页。通过将所有脚本放在一个页面上,我能够显示结果。

于 2010-09-28T13:55:35.103 回答