Hi,

I'll test that. Thanks

On 1 mai, 23:55, Jeremy Benoist <[email protected]> wrote:
> Hi Thibault,
>
> I got the same problem once time ago.
>
> I used mysql FIELD keyword to sort result in the same way Lucene did
> it.
> Let me show you my code :
>
> $hits = $this->getLuceneIndex()->find($query);
> $pks = array();
> foreach ($hits as $hit)
> {
>   $pks[] = $hit->pk;
>
> }
>
> $query = $this->createQuery();
> $query->select('b.*, FIELD(b.id,' . implode(',', $pks) . ') AS
> field');
> $query->from('blogPost b');
> $query->whereIn('b.id', $pks);
> $query->orderBy('field');
>
> And it works like a charme :-)
>
> On 1 mai, 14:22, ThibaultJouannic<[email protected]> wrote:
>
> > Hi group !
>
> > On my symfony website, I've build a search engine following the jobeet
> > tutorial (day 17). Everything's fine, except one thing. The Zend
> > Lucene engine is kind enough to sort its results by relevance.
> > However, this order is lost when I build the doctrine query :
>
> > $hits = $this->getLuceneIndex()->find($queryString);
>
> > $pks = array();
> > foreach($hits as $hit)
> >     $pks[] = $hit->pk;
>
> > $query->whereIn('v.id', $pks);
>
> > return $query;
>
> > Is there an easy way I could tell mysql and / or doctrine to keep the
> > same order in the query's results as in the IN clause ? If no, does
> > anybody as an idea about how could I achieve the same result ?
>
> > Thanks
> > Thibault.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"symfony users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/symfony-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to