Using Zend Lucene Search, I return a list of identifiers sorted by relevance that are mapped to blog entries that I will retrieve from the database.
This is the correct way to handle an array with a Doctrine2 WHERE IN expression:
$dql = "SELECT b FROM BlogPost WHERE b.id IN (" . implode(', ', $ids) . ")"; $query = $em->createQuery($dql); ...
Or is there a better way, perhaps passing $ids in the actual array as a parameter to the request?
In addition, Zend Search returns an array of identifiers based on relevancy. Will using the above method maintain relevance when receiving blog posts?
source share