Skip to content

oc-shopaholic/oc-sphinx-shopaholic-plugin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Sphinx for Shopaholic plugin

Description

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.

Installation Guide

  1. Install Sphinx
sudo apt-get install sphinxsearch
  1. 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'
    ...
}
  1. Copy sphinxsearch.php config.
cp plugins/lovata/sphinxshopaholic/config/sphinxsearch.php config/sphinxsearch.php
  1. Configure config/sphinxsearch.php for your project

License

© 2018, LOVATA Group, LLC under GNU GPL v3.

Developed by Andrey Kharanenka.