Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Sorting search results in an arbitrary order
 
strelok
Member
 
Total Posts:  41
Joined:  2009-05-03
 

Hi,

I’m currently trying to integrate Sphinx with the Magento search.

I managed to call sphinx and get an array of IDs that are the results of the search. I feed this list to magento by adding a
->addFieldToFilter(’entity_id’, array(’IN’=>$ids))
to the collection of results in CatalogSearch/Model/Layer.php / prepareProductCollection().

But I have a problem. The products in the collection are not in the correct order. I want the results exactly in the same order than my $ids[] array (since sphinx sorts them by relevance). But the collection is in another order. I can’t add a ORDER BY clause to the request because it is not in a database field.

Is there a way to rearrange the results in the order that I want? How and where could I do that?

Thanks for your help

Strelok

 
Magento Community Magento Community
Magento Community
Magento Community
 
Mirasvit
Guru
 
Avatar
Total Posts:  639
Joined:  2009-08-22
 

It is possible that you need something like this extension Advanced Sphinx Search Pro http://mirasvit.com/magento-extensions/magento-sphinx-search.html

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top