Zend Lucene simple
search component for Yii2. Please see also newest advanced version.
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;
}
}
See example Search
module.