Skip to content

timlubchak/yii2-search-component

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Yii2 Zend Lucene Simple Search Component

Zend Lucene simple search component for Yii2. Please see also newest advanced version.

Installation

The preferred way to install this extension is through composer.

  • Either run
php composer.phar require --prefer-dist "himiklab/yii2-search-component" "*"

or add

"himiklab/yii2-search-component" : "*"

to the require section of your application's composer.json file.

  • Add a new component in components section of your application's configuration file, for example:
'components' => [
    'search' => [
        'class' => 'himiklab\search\Search',
        'models' => [
            'app\modules\page\models\Page',
        ],
    ],
    // ...
],
  • Implements himiklab\search\SearchInterface in your models, for example:
use himiklab\search\SearchInterface;

class Page extends ActiveRecord implements SearchInterface
{
    // ...

    public function getSearchTitle()
    {
        return $this->title;
    }

    public function getSearchBody()
    {
        return $this->body;
    }

    public function getSearchUrl()
    {
        return $this->url;
    }
}

Usage

See example Search module.

Resources

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PHP 78.4%
  • JavaScript 21.1%
  • CSS 0.5%