This forum is in READ-ONLY mode.
You can look around, but if you want to ask a new question, please use Stack Overflow.

Zend Lucene returning all records when there's no hits

Questions relating to sfLucenePlugin, sfSearch etc

Zend Lucene returning all records when there's no hits

by triplecero » Tue Sep 21, 2010 8:52 pm

I've found an possible issue in Zend Search Lucene (and seems like no one else has found it): Lucene returns all the records of a table when finds zero matches on it.

Another thing: if I call to another DQL method inside the template, using the ID as a parameter, to get more records, the data set resulting came empty, no errors at all.

This is very annoying, cause you don't know when the list comes from valid result an when not...

I'm using Zend Search Lucene plugin from Zend Framework 1.10.8 and Symfony 1.4.6.
triplecero
Junior Member
 
Posts: 19
Joined: Wed Jan 28, 2009 5:26 am
Location: Venezuela

Re: Zend Lucene returning all records when there's no hits

by triplecero » Wed Sep 22, 2010 6:12 pm

I totally forgot to mention that I'm using sfDoctrinePager to paginate the results, Zend Lucene doesn't have the issue I did mention. The getForLuceneQuery($query) method (following the Jobeet tutorial) always returns an empty array when there's no hits... so I have to think that the issue is on the sfDoctrinePager side...

The solution I got was put a condition in the action, asking if the $q variable was empty (in that case I got an empty array, otherwise a Doctrine_Query object), in the template I ask if the $pager object is set, in that case the partials (for example) will display, otherwise will display a message "No results found".
triplecero
Junior Member
 
Posts: 19
Joined: Wed Jan 28, 2009 5:26 am
Location: Venezuela