public function index()
    {
        if ($this->luceneIndex->count() !== 0) {
            $this->luceneIndex = Lucene::create($this->indexDirectory);
        }

        /** @var \yii\db\ActiveRecord $modelName */
        foreach ($this->models as $modelName) {
            /** @var behaviors\SearchBehavior $model */
            /** @var array $page */
            $model = new $modelName;
            if ($model->hasMethod('getSearchModels')) {
                foreach ($model->getSearchModels()->all() as $pageModel) {
                    $this->luceneIndex->addDocument($this->createDocument(
                        call_user_func($model->searchFields, $pageModel)
                    ));
                }
            } else {
                throw new InvalidConfigException(
                    "Not found right `SearchBehavior` behavior in `{$modelName}`."
                );
            }
        }
    }
public function index()
    {
        if ($this->luceneIndex->count() !== 0) {
            $this->luceneIndex = Lucene::create($this->indexDirectory);
        }

        /** @var \yii\db\ActiveRecord $modelName */
        foreach ($this->models as $modelName) {
            /** @var behaviors\SearchBehavior $model */
            /** @var array $page */
            $model = new $modelName;
            if ($model->hasMethod('getSearchModels')) {
                foreach ($model->getSearchModels()->all() as $pageModel) {
                    $this->luceneIndex->addDocument($this->createDocument(
                        call_user_func($model->searchFields, $pageModel)
                    ));
                }
            } else {
                throw new InvalidConfigException(
                    "Not found right `SearchBehavior` behavior in `{$modelName}`."
                );
            }
        }
    }
public function index ( ) { if ( $ this -> luceneIndex -> count ( ) !== 0 ) { $ this -> luceneIndex = Lucene :: create ( $ this -> indexDirectory ) ; } /** @var \yii\db\ActiveRecord $modelName */ foreach ( $ this -> models as $ modelName ) { /** @var behaviors\SearchBehavior $model */ /** @var array $page */ $ model = new $ modelName ; if ( $ model -> hasMethod ( 'getSearchModels' ) ) { foreach ( $ model -> getSearchModels ( ) -> all ( ) as $ pageModel ) { $ this -> luceneIndex -> addDocument ( $ this -> createDocument ( call_user_func ( $ model -> searchFields , $ pageModel ) ) ) ; } } else { throw new InvalidConfigException ( "Not found right `SearchBehavior` behavior in `{$modelName}`." ) ; } } }
Indexing the contents of the specified models.
@throws InvalidConfigException
Indexing the contents of the specified models .