render('/kd/list', ['model' => $model]); } public function actionShow($id) { // $post = Yii::$app->request->get(); return $this->renderPartial('/default/Showphoto', ['id' => $id]); } public function actionSearch() { if( isset( $_GET['search'] ) && trim( $_GET['search'] ) != ''){ $news_query = (new Query()) ->from('amic_photo') ->select(['id','photo_title']) ->andWhere( ['photo_name' => '']) ->addOptions(['max_matches' => 200]) ->addOptions(['field_weights'=> ['photo_title' => 10] ]) ->match($_GET['search']) ->limit(200); // ->column(); $news_query = new Query(); $sql = "SELECT `id`, `photo_title` FROM `amic_photo` WHERE (MATCH('".$_GET['search']." amic.ru | смолихина | амител"."')) AND (`photo_name`='') LIMIT 200 OPTION max_matches = 200, field_weights = (photo_title = 10)"; // $command = $news_query->createCommand($sql); $command = Yii::$app->sphinx->createCommand($sql); // echo $command->getRawSql(); $items = $command->queryAll(); $r = array(); foreach( $items as $item ){ $r[] = $item; } return json_encode(['status'=>'ok','data'=>$r]); } return json_encode(['status'=>'err']); } }