original_string: 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}`."
                  );
              }
          }
      }
code: 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}`."
                  );
              }
          }
      }
code_tokens: 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}`." ) ; } } }
docstring: Indexing the contents of the specified models.
  @throws InvalidConfigException
docstring_tokens: Indexing the contents of the specified models .