537

Product support

Visit this product's website for support.

Categories

Laravel Scout provides a simple, driver based solution for adding full-text search to your Shopaholic models. Using model observers, Scout will automatically keep your search indexes in sync with your Shopaholic records.

Lovata.Shopaholic is required

After installing PlanetaDelEste.ScoutShopaholic, new FULLTEXT index will be added to lovata_shopaholic_brands, lovata_shopaholic_categories, lovata_shopaholic_products and lovata_tagsshopaholic_tags if TagsShopaholic is installed.

Note: If you get DB error using FULLTEXT search, check db index to has same order and columns as name, slug, external_id, code, preview_text, description, search_synonym, search_content (last two are added only if SearchShopaholic is installed.

Plugin adds searchScout($sSearchString) method to ProductCollection, BrandCollection, CategoryCollection, TagCollection classes.

$obList =  ProductCollection::make()->searchScout('test search');

Installation

Install Scout via the Composer package manager:

composer require laravel/scout

After installing Scout, you should publish the Scout configuration using the vendor:publish Artisan command. This command will publish the scout.php configuration file to your config directory:

php artisan vendor:publish --provider="Laravel\Scout\ScoutServiceProvider"

Algolia Driver

If you want to use Algolia check Laravel.Scout documentation

MySQL Driver

Search Shopaholic Models using MySQL FULLTEXT Indexes

Note: Any Models you plan to search using this driver must use a MySQL MyISAM or InnoDB table.

Install with Composer

composer require yab/laravel-scout-mysql-driver

Append the default configuration to config/scout.php

 'mysql' => [
 'mode' => 'NATURAL_LANGUAGE',
 'model_directories' => [app_path()],
 'min_search_length' => 0,
 'min_fulltext_search_length' => 4,
 'min_fulltext_search_fallback' => 'LIKE',
 'query_expansion' => false
 ]

Set SCOUT_DRIVER=mysql in your .env file

Please note this Laravel Scout driver does not need to update any indexes when a Model is changed as this is handled natively by MySQL. Therefore you can safely disable queuing in config/scout.php.

 /*
 |--------------------------------------------------------------------------
 | Queue Data Syncing
 |--------------------------------------------------------------------------
 |
 | This option allows you to control if the operations that sync your data
 | with your search engines are queued. When this is set to "true" then
 | all automatic data syncing will get queued for better performance.
 |
 */
 'queue' => false,

In addition there is no need to use the php artisan scout:import command. However, if you plan to use this driver in either NATURAL_LANGUAGE or BOOLEAN mode you should first run the provided console command to create the needed FULLTEXT indexes.

Full documentation of MySQL driver here

Note: It is recommended to configure PHP memory_limit to 1024M or more

1.0.3

Reindex shopaholic columns

Aug 27, 2019

1.0.2

Create Fulltext indexes

Aug 27, 2019

1.0.1

First version of ScoutShopaholic

Aug 27, 2019