$article = new Article();
$article->setTitle('Baboons Invade Seaworld');
$article->setBody('In a crazy turn of events a pack a rabid red baboons invade Seaworld. Officials say that the Dolphins are being held hostage');
$this->em->persist($article);
$this->em->flush();
$query = $this->em->createQuery('SELECT a FROM Article a WHERE tsquery(a.title,:searchQuery) = true');
$query->setParameter('searchQuery','Baboons');
$result = $query->getArrayResult();
$query = $this->em->createQuery('SELECT a, tsrank(a.title,:searchQuery) as rank FROM Article a WHERE tsquery(a.title,:searchQuery) = true');
$query->setParameter('searchQuery','Baboons');
$result = $query->getArrayResult();
var_dump($result[0]['rank']); // int 0.67907
$query = $this->em->createQuery('SELECT a FROM Article a WHERE tsquery(a.title,:searchQuery) = true ORDER BY tsrank(a.title,:searchQuery) DESC');
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.