Timeline for How to do a solr search programmatically?
Current License: CC BY-SA 3.0
5 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Jul 13, 2015 at 18:02 | history | edited | Ryan Hoerr | CC BY-SA 3.0 |
Fixed example per comments.
|
Jul 13, 2015 at 17:27 | comment | added | JPMC |
It would seem it is indeed the load() Before that I tried manually instantiating a new Enterprise_Search_Model_Resource_Collection and passed it the Solr config settings as an array in the constructor. But upon going back and changing it back to the way you had it, it seems it is working now without the additional setup. Thanks again for this snippet, I wish I had seen it a week ago!
|
|
Jul 13, 2015 at 16:10 | comment | added | Ryan Hoerr |
@JPMC This is the entirety of the snippet in production. Maybe the explicit load() makes an impact, but I wouldn't expect so. Check the class type of $searchEngine and $collection , maybe something else on your system is interfering. $searchEngine = Mage::getResourceModel( Mage::getStoreConfig('catalog/search/engine') ); $collection = $searchEngine->getResultCollection(); $collection->addSearchFilter( $term ); $collection->addAttributeToSelect('sku'); $collection->setPageSize( $limit ); $collection->load();
|
|
Jul 13, 2015 at 14:39 | comment | added | JPMC | I am using this snippet, and despite Magento being set to and using Solr, it doesn't seem to be hitting Solr at all (adding debugging checks to see if the classes related to Solr are called). Moreover the results I obtain from this search aren't relevant to the term in my case. Perhaps there is some context I'm missing for this snippet, but it seems to not obtain relevant results. Using Magento 1.14.1 EE | |
Jun 15, 2015 at 13:57 | history | answered | Ryan Hoerr | CC BY-SA 3.0 |