Sphinx for Shopaholic plugin adds fields 'search_synonym', 'search_content'' to Product, Brand, Category, Tag models.
Sphinx for Shopaholic plugin adds search($sSphinxString) method to ProductCollection, BrandCollection, CategoryCollection, TagCollection classes.
- Install Sphinx
sudo apt-get install sphinxsearch
- Configure sphinx.conf. Create indexes for products, categories, brand, tags. For example:
- 'oc_product' - index for default language
- 'oc_product_ru' - index for language with code ru
source oc_product
{
...
sql_query = SELECT id, name, preview_text, description, search_synonym, search_content FROM lovata_shopaholic_products order by `id` DESC
...
}
source oc_demo_product_ru
{
...
sql_query = SELECT product.id, JSON_EXTRACT(lang.attribute_data, '$.name') as name FROM lovata_shopaholic_products as product LEFT JOIN rainlab_translate_attributes as lang ON product.id = lang.model_id WHERE lang.model_type = 'Lovata\\Shopaholic\\Models\\Product' and lang.locale = 'ru'
...
}
- Copy sphinxsearch.php config.
cp plugins/lovata/sphinxshopaholic/config/sphinxsearch.php config/sphinxsearch.php
- Configure config/sphinxsearch.php for your project
© 2018, LOVATA Group, LLC under GNU GPL v3.
Developed by Andrey Kharanenka.