original_string: protected function searchTopics()
      {
          $query = Thread::find();
          if (Podium::getInstance()->user->isGuest) {
              $query->joinWith(['forum' => function ($q) {
                  $q->andWhere([Forum::tableName() . '.visible' => 1])->joinWith(['category' => function ($q) {
                      $q->andWhere([Category::tableName() . '.visible' => 1]);
                  }]);
              }]);
          }
          if (!empty($this->query)) {
              $words = explode(' ', preg_replace('/\s+/', ' ', $this->query));
              foreach ($words as $word) {
                  if ($this->match == 'all') {
                      $query->andWhere(['like', Thread::tableName() . '.name', $word]);
                  } else {
                      $query->orWhere(['like', Thread::tableName() . '.name', $word]);
                  }
              }
          }
          $this->prepareQuery($query, true);
          $sort = [
              'defaultOrder' => [Thread::tableName() . '.id' => SORT_DESC],
              'attributes' => [
                  Thread::tableName() . '.id' => [
                      'asc' => [Thread::tableName() . '.id' => SORT_ASC],
                      'desc' => [Thread::tableName() . '.id' => SORT_DESC],
                      'default' => SORT_DESC,
                  ],
              ]
          ];
          return new ActiveDataProvider([
              'query' => $query,
              'sort' => $sort,
          ]);
      }
code: protected function searchTopics()
      {
          $query = Thread::find();
          if (Podium::getInstance()->user->isGuest) {
              $query->joinWith(['forum' => function ($q) {
                  $q->andWhere([Forum::tableName() . '.visible' => 1])->joinWith(['category' => function ($q) {
                      $q->andWhere([Category::tableName() . '.visible' => 1]);
                  }]);
              }]);
          }
          if (!empty($this->query)) {
              $words = explode(' ', preg_replace('/\s+/', ' ', $this->query));
              foreach ($words as $word) {
                  if ($this->match == 'all') {
                      $query->andWhere(['like', Thread::tableName() . '.name', $word]);
                  } else {
                      $query->orWhere(['like', Thread::tableName() . '.name', $word]);
                  }
              }
          }
          $this->prepareQuery($query, true);
          $sort = [
              'defaultOrder' => [Thread::tableName() . '.id' => SORT_DESC],
              'attributes' => [
                  Thread::tableName() . '.id' => [
                      'asc' => [Thread::tableName() . '.id' => SORT_ASC],
                      'desc' => [Thread::tableName() . '.id' => SORT_DESC],
                      'default' => SORT_DESC,
                  ],
              ]
          ];
          return new ActiveDataProvider([
              'query' => $query,
              'sort' => $sort,
          ]);
      }
code_tokens: protected function searchTopics ( ) { $ query = Thread :: find ( ) ; if ( Podium :: getInstance ( ) -> user -> isGuest ) { $ query -> joinWith ( [ 'forum' => function ( $ q ) { $ q -> andWhere ( [ Forum :: tableName ( ) . '.visible' => 1 ] ) -> joinWith ( [ 'category' => function ( $ q ) { $ q -> andWhere ( [ Category :: tableName ( ) . '.visible' => 1 ] ) ; } ] ) ; } ] ) ; } if ( ! empty ( $ this -> query ) ) { $ words = explode ( ' ' , preg_replace ( '/\s+/' , ' ' , $ this -> query ) ) ; foreach ( $ words as $ word ) { if ( $ this -> match == 'all' ) { $ query -> andWhere ( [ 'like' , Thread :: tableName ( ) . '.name' , $ word ] ) ; } else { $ query -> orWhere ( [ 'like' , Thread :: tableName ( ) . '.name' , $ word ] ) ; } } } $ this -> prepareQuery ( $ query , true ) ; $ sort = [ 'defaultOrder' => [ Thread :: tableName ( ) . '.id' => SORT_DESC ] , 'attributes' => [ Thread :: tableName ( ) . '.id' => [ 'asc' => [ Thread :: tableName ( ) . '.id' => SORT_ASC ] , 'desc' => [ Thread :: tableName ( ) . '.id' => SORT_DESC ] , 'default' => SORT_DESC , ] , ] ] ; return new ActiveDataProvider ( [ 'query' => $ query , 'sort' => $ sort , ] ) ; }
docstring: Advanced topics search.
  @return ActiveDataProvider
  @since 0.6
docstring_tokens: Advanced topics search .