Zend Lucene displays blank screen when no results found
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 worki开发者_开发百科ng.
Locally I have Zend Server 4 installed, remotely PHP 5.2.11 and ZF 1.10.2
Any help much appreciated!
Paul
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.
精彩评论