Question and Answers (Q&A)


1.How can we automate the settings in the SolrBridge/Indices settings? As explained in the attached e-mail the list of solr core is too big and the configuration interface generates an error.

=>There is method app/code/community/Solrbridge/Solrsearch/Model/Ultility.php function getAvailableCores
which read the xml configuration and return the following array, so you dont need to create xml
you can modify the return a static array as following
thai, english, french are solr cores
    [thai] => Array
            [label] => Thai
            [stores] => ,

    [english] => Array
            [label] => English
            [stores] => 1,,

    [french] => Array
            [label] => French
            [stores] => ,

2. How can we automate the settings the SolrBridge core configuration in each store ?

In the file app/code/community/SolrBridge/Solrsearch/Helper/Data.php , the function getSetting
You can change as the following (I have added a function getMappedSolrIndex):

    public function getSetting( $key, $storeId = 0 )
        $storeId = (isset($storeId) && is_numeric($storeId) && $storeId > 0) ? $storeId : Mage::app()->getStore()->getId();
        if ($key == 'solr_index')
            return $this->getMappedSolrIndex($storeId);
        $value = '';
        $settings = Mage::getStoreConfig('solrbridge/settings', $storeId);

        if (isset($settings[$key])) {
            $value = $settings[$key];
        return $value;
    public function getMappedSolrIndex($storeid)
        //Manually maped STOREID => SOLRCORE
        $maps = array(
            1 => 'english',
            2 => 'french',
            3 => 'dutch',
        //default solr core is english
        $solrindex = 'english';
        if (isset($maps[$storeid]) && !empty($maps[$storeid]))
            return $maps[$storeid];
        return $solrindex;
3. How to address the problems with the indexing of cores that contains ‘-‘ in their names. Here bellow when clicking on “Update index” on core “Bagnols-sur-ceze”

=> The solrcore should not include the '-', should be only digit, alphabet, and understore '_' , it should like the following:

4. How to remove the categories from the search popup?

=> Please open the file js/solrsearch/autocomplete.js
And find block of code for category rendering (started the line 423), then you can comment that block of code

5. As prices and products updates are made without using the admin frontend, what (which insert queries) should we do in order to be able to use the update index functionality.

=> There is a script in shell/solrbridge.php, so after your script import data into mysql successfully, please run the command:
php shell/solrbridge.php -updateindex [solrcore]

6. is there any easy way i can embed search result in any CMS pages based on keywords?

This is the syntax:

{{block type="solrsearch/plugin" name="solr_search_plugin" template="catalog/product/list.phtml" query="test" limit="4"}}

Mage::app()->getLayout()->createBlock('solrsearch/plugin', null, array('limit'=>4, query=>YYYYY,'template'=>'PPPPPP'))->toHtml();


7. Fatal error: Call to undefined method SolrBridge_Solrsearch_Model_Solr_Collection::addAttributeToSort() in app/code/local/Amasty/Sorting/Model/Method/Image.php on line 24
Open the file app/code/community/SolrBridge/Solrsearch/Model/Solr/Collection.php
and enable the commented line
class SolrBridge_Solrsearch_Model_Solr_Collection extends Mage_Catalog_Model_Resource_Product_Collection


8. How to fix Solr Search Autocomplete thumbs to use Image CDN

Step 1.
Open the file app/code/community/SolrBridge/Solrsearch/Model/Ultility.php
then find
and comment the block of code like:
}catch (Exception $e){
    $message = Mage::helper('solrsearch')->__('#%s %s at product %s[%s] in store [%s]', $index, $e->getMessage() , $_product->getId(), $_product->getName(), $store->getName());
    $this->writeLog($message, $store->getId(), 'english', 0, true);

Step 2:
Open the file app/code/community/SolrBridge/Solrsearch/Model/Data.php
Find this line:
$docData['filter_visibility_int'] = $_product->getVisibility();
Add after that line the following block of code:
//Prepare thumbs
$oldStore = Mage::app ()->getStore ();
Mage::app ()->setCurrentStore ( $store->getId() );
$imageUrl = (string)Mage::helper('catalog/image')->init($_product, 'small_image')->resize(50);
$docData['thumb_varchar'] = $imageUrl;
Mage::app ()->setCurrentStore ( $oldStore );

Open lib/SolrBridge/Solr.php
then find
public $fieldList
and replace with this:
public $fieldList = array('name_varchar', 'products_id', 'url_path_varchar', 'product_type_static', 'thumb_varchar');

Open the file js/solrsearch/autocomplete.js
Find this.suggestBrands = [];
Add after that line:
this.thumbs = [];
Find this.productTypes[i] =[index].product_type_static;
Add after that line the following:
this.thumbs[i] =[index].thumb_varchar;
Find and comment the following line:
var itemImage = '<div class="sbs_search_suggest_thumb"><img src="'+this.options.ajaxBaseUrl+'/media/catalog/product/sb_thumb/'+this.suggestionsProductIds[key]+'.jpg"/></div>';
Add after that line:
var itemImage = '<div class="sbs_search_suggest_thumb"><img src="'+this.thumbs[key]+'"/></div>';