Zend Lucene displays blank screen when no results found

For programming and general questions on Zend Framework

Zend Lucene displays blank screen when no results found

Postby pixel_lab on Tue Mar 16, 2010 1:01 pm

Hi,

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:

Code: Select all
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
pixel_lab
 
Posts: 53
Joined: Thu Mar 05, 2009 3:31 pm
Location: Bristol, UK

Re: Zend Lucene displays blank screen when no results found

Postby pixel_lab on Fri Mar 19, 2010 11:34 am

Anyone run into this problem or am I all alone here?

Thanks,

Paul
pixel_lab
 
Posts: 53
Joined: Thu Mar 05, 2009 3:31 pm
Location: Bristol, UK

Re: Zend Lucene displays blank screen when no results found

Postby pixel_lab on Thu Mar 25, 2010 1:04 pm

I've done a bit more debugging:

when a seach term is in index:

var_dump($hits) :

Code: Select all
array(39) { [0]=>  object(Zend_Search_Lucene_Search_QueryHit)#119 (4) { ["_index:protected"]=>  object(Zend_Search_Lucene_Proxy)#120 (1) { ["_index:private"]=>  object(Zend_Search_Lucene)#4 (11) { ["_directory:private"]=>  object(Zend_Search_Lucene_Storage_Directory_Filesystem)#14 (2) { ["_dirPath:protected"]=>  string(14) "data/index" ["_fileHandlers:protected"]=>  array(12) { ["read.lock.file"]=>  object(Zend_Search_Lucene_Storage_File_Filesystem)#13 (1) { ["_fileHandle:protected"]=>  resource(2) of type (stream) } ["segments_7"]=>
(..truncated)

when a search term is not in index:

var_dump($hits) :

blank page

So why the hell is a blank page, no error message or anything appearing?
pixel_lab
 
Posts: 53
Joined: Thu Mar 05, 2009 3:31 pm
Location: Bristol, UK

Re: Zend Lucene displays blank screen when no results found

Postby juggernt on Sat Mar 27, 2010 5:58 pm

I've seen this problem..on the same version. Actually, it may have been exactly when I was upgrading to 1.10 r2. Unfortunately, I was super-rushed at the time & not horribly methodical in my troubleshooting.

I can only say there were 2 behaviors/symptoms occurring simultaneously that may?? give a little insight. ( I'm more inclined to think they're just other symptoms..or even unrelated.)

#1) I started getting the new error "search term must be a STRING or a QUERY obj".. and this problem was occurring with the find() method w/near identical code like you displayed in your first post.

As a result, though. I just added (string) to cast all data as strings going into it, and that seemed to do the trick.

#2) Then, when I experienced probs on another of my site's search forms, I realized during my hasty testing of it I was only using 2 char keywords.. and the min length, that I recall, was supposed to be 3 (and wasn't happening, it seemed on 3 char keyword searches... so I updated my client-side and server-side validation to prevent <=2 char keyword searches.

Again, probably not very helpful..but at least you're not alone.. :) .. in seeing the blank screen behavior.

-Jay
juggernt
 
Posts: 2
Joined: Sat Mar 27, 2010 5:28 pm

Re: Zend Lucene displays blank screen when no results found

Postby pixel_lab on Mon Mar 29, 2010 11:22 am

Hi Jay,

Thanks for the time in responding to this.

I have tried your suggestions but to no avail - still a blank screen with:

Code: Select all
$queryStr = (string) $queryStr;


I have tested this again and again and from what I can surmise is that because I am including some external files, namely structural code such as a header for formatting (which also requires a functions class), a bug(?) makes Zend_Lucene return a blank screen if no results are found.

I have tested the same code as above with out the included files and the script works. So for some reason, the addition of my code makes Zend_Lucene fall over when no results are found, but only on my production server. It works as expeced on my development server...

Its all a little bit strange!

Cheers,

Paul
pixel_lab
 
Posts: 53
Joined: Thu Mar 05, 2009 3:31 pm
Location: Bristol, UK

Re: Zend Lucene displays blank screen when no results found

Postby geo22 on Fri Apr 16, 2010 6:13 am

i think u people must include external files related this code to use this code....
may be it will be ok...i will also try it today....i am sure that i will get it...
642-845 and 646-563 exam guide and 70-236 questions as well for ccent
geo22
 
Posts: 1
Joined: Fri Apr 16, 2010 6:04 am

Re: Zend Lucene displays blank screen when no results found

Postby john5967 on Wed Apr 04, 2018 10:45 am

i think u people must include external files related this code.
john5967
 
Posts: 1
Joined: Wed Apr 04, 2018 10:43 am
Location: New York


Return to Zend Framework

Who is online

Users browsing this forum: Google [Bot] and 3 guests