Download the PHP package wdmg/yii2-search without Composer
On this page you can find all versions of the php package wdmg/yii2-search. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download wdmg/yii2-search
More information about wdmg/yii2-search
Files in wdmg/yii2-search
Package yii2-search
Short Description Site search
License MIT
Homepage https://github.com/wdmg/yii2-search
Informations about the package yii2-search
Yii2 Search
Search module for Yii2.
The module implements indexed search using morphology (phpMorphy) or Porter's stemmer algorithm (LinguaStem). A live full-text search by data model is also provided.
This module is an integral part of the Butterfly.СMS content management system, but can also be used as an standalone extension.
Copyrights (c) 2019-2023 W.D.M.Group, Ukraine
Requirements
- PHP 5.6 or higher
- Yii2 v.2.0.40 and newest
- Yii2 Base module (required)
- phpMorphy library
- LinguaStem library
- Yii2 Helpers
Installation
To install the module, run the following command in the console:
$ composer require "wdmg/yii2-search"
After configure db connection, run the following command in the console:
$ php yii search/init
And select the operation you want to perform: 1) Apply all module migrations 2) Revert all module migrations
Migrations
In any case, you can execute the migration and create the initial data, run the following command in the console:
$ php yii migrate --migrationPath=@vendor/wdmg/yii2-search/migrations
Configure
To add a module to the project, add the following data in your configuration file:
'modules' => [
...
'search' => [ // list of supported models for live search or/and indexation
'class' => 'wdmg\search\Module',
'routePrefix' => 'admin',
'supportModels' => [
'news' => [
'class' => 'wdmg\news\models\News',
'indexing' => [
'on_insert' => true,
'on_update' => true,
'on_delete' => true
],
'options' => [
'title' => 'title', // attr name (string) of model or function($model)
'url' => 'url', // attr name (string) of model or function($model)
'fields' => [
'title',
'keywords',
'description',
'content'
],
'conditions' => [
'status' => 1
]
]
],
...
],
'cacheExpire' = 86400, // live search cache lifetime, `0` - for not use cache
'indexingOptions' = [ // indexation options
'processing' => 'phpMorphy', // Set `phpMorphy` or `LinguaStem`
'language' => 'ru-RU', // Support 'ru-RU', 'uk-UA', 'de-DE'
'analyze_by' => 'relevance',
'max_execution_time' => 0, // max execution time in sec. for indexing process
'memory_limit' => null, // max operating memory in Mb for indexing process
'max_words' => 50,
],
'analyzerOptions' = [ // text analyzer options, see \wdmg\helpers\TextAnalyzer
'min_length' => 3,
'stop_words' => [],
'weights' => []
],
'snippetOptions' = [ // build search snippet options
'max_words_before' => 6,
'max_words_after' => 4,
'bolder_tag' => 'strong',
'max_length' => 255,
'delimiter' => '…'
],
'searchAccuracy' = 90, // search accuracy
],
...
],
Routing
Use the Module::dashboardNavItems()
method of the module to generate a navigation items list for NavBar, like this:
Status and version [ready to use]
- v.2.0.0 - Update copyrights, fix nav menu
- v.1.1.4 - Fixed mysql syntax error: 1055 for MySQL >= 5.7
- v.1.1.3 - Update dependencies
All versions of yii2-search with dependencies
wdmg/yii2-base Version ^1.2.4
wdmg/yii2-helpers Version ^1.3.2
wdmg/yii2-selectinput Version ^1.0.9
wdmg/yii2-validators Version ^1.0.6
wdmg/lingua-stem Version ^1.1.0
wdmg/phpmorphy Version ^1.3.2