'query' => $search_string, 'page' => Yii::$app->request->get('page') ] ]); $result = $query->snippetCallback(function ($rows) use (&$models, $indexes_models, $model_prefixes) { $data = []; foreach ($rows as $row) { $class_name = $indexes_models[$row['model_name']]; $model = $class_name::findOne($row['original_id']); $data[] = $model->content; $models[$model_prefixes[$row['model_name']] . '-' . $row['original_id']] = $model; } return $data; })->snippetOptions([
]); $result = $query->snippetCallback(function ($rows) use (&$models, $indexes_models, $model_prefixes) { $data = []; foreach ($rows as $row) { $class_name = $indexes_models[$row['model_name']]; $model = $class_name::findOne($row['original_id']); $data[] = $model->content; $models[$model_prefixes[$row['model_name']] . '-' . $row['original_id']] = $model; }
*/ protected function fillUpSnippets($rows) { if ($this->snippetCallback === null || empty($rows)) { return $rows; } $snippetSources = call_user_func($this->snippetCallback, $rows); $snippets = $this->callSnippets($snippetSources); $snippetKey = 0; foreach ($rows as $key => $row) { $rows[$key]['snippet'] = $snippets[$snippetKey]; $snippetKey++; }
/** * @inheritdoc */ public function populate($rows) { return parent::populate($this->fillUpSnippets($rows)); } /** * @inheritdoc */ public function one($db = null)
foreach ($rawMetaResults as $rawMetaResult) { $meta[$rawMetaResult['Variable_name']] = $rawMetaResult['Value']; } } // rows should be populated after all data read from cursor, avoiding possible 'unbuffered query' error $rows = $this->populate($rawRows); return [ 'hits' => $rows, 'facets' => $facets, 'meta' => $meta, ];
'after_match' => '</span>' ])->limit($pages->limit)->offset($pages->offset)->orderBy([ 'date' => SORT_DESC ])->options([ 'max_matches' => $max_matches, //'field_weights' => new Expression('(name=3, content=2, tags=3, rubrick=30)') ])->showMeta(true)->search(); print_r('3'); $rows = []; $total = isset($result['meta']['total']) ? $result['meta']['total'] : 0; $total_found = isset($result['meta']['total_found']) ? $result['meta']['total_found'] : 0; if ($total > 0) {
$args = $this->controller->bindActionParams($this, $params); Yii::trace('Running action: ' . get_class($this->controller) . '::' . $this->actionMethod . '()', __METHOD__); if (Yii::$app->requestedParams === null) { Yii::$app->requestedParams = $args; } return call_user_func_array([$this->controller, $this->actionMethod], $args); } }
} $result = null; if ($runAction && $this->beforeAction($action)) { // run the action $result = $action->runWithParams($params); $result = $this->afterAction($action, $result); // call afterAction on modules foreach ($modules as $module) { /* @var $module Module */
$parts = $this->createController($route); if (is_array($parts)) { /* @var $controller Controller */ list($controller, $actionID) = $parts; $oldController = Yii::$app->controller; Yii::$app->controller = $controller; $result = $controller->runAction($actionID, $params); Yii::$app->controller = $oldController; return $result; } else { $id = $this->getUniqueId(); throw new InvalidRouteException('Unable to resolve the request "' . ($id === '' ? $route : $id . '/' . $route) . '".');
$params = $this->catchAll; unset($params[0]); } try { Yii::trace("Route requested: '$route'", __METHOD__); $this->requestedRoute = $route; $result = $this->runAction($route, $params); if ($result instanceof Response) { return $result; } else { $response = $this->getResponse(); if ($result !== null) { $response->data = $result;
try { $this->state = self::STATE_BEFORE_REQUEST; $this->trigger(self::EVENT_BEFORE_REQUEST); $this->state = self::STATE_HANDLING_REQUEST; $response = $this->handleRequest($this->getRequest()); $this->state = self::STATE_AFTER_REQUEST; $this->trigger(self::EVENT_AFTER_REQUEST); $this->state = self::STATE_SENDING_RESPONSE; $response->send();
require(__DIR__ . '/../../common/config/main-local.php'), require(__DIR__ . '/../config/main.php'), require(__DIR__ . '/../config/main-local.php') ); $application = new yii\web\Application($config); $application->run();
$_GET = [ 'query' => 'стратегия 2030', ]; $_SERVER = [ 'REDIRECT_REDIRECT_HTTPS' => 'on', 'REDIRECT_REDIRECT_STATUS' => '200', 'REDIRECT_HTTPS' => 'on', 'REDIRECT_HANDLER' => 'application/x-httpd-php5', 'REDIRECT_STATUS' => '200', 'HTTPS' => 'on', 'HTTP_HOST' => 'm.asninfo.ru', 'HTTP_X_FORWARDED_PROTO' => 'https', 'HTTP_X_FORWARDED_PORT' => '443', 'HTTP_CONNECTION' => 'close', 'HTTP_ACCEPT' => '*/*', 'HTTP_USER_AGENT' => 'claudebot', 'HTTP_REFERER' => 'http://m.asninfo.ru/search?query=%D1%81%D1%82%D1%80%D0%B0%D1%82%D0%B5%D0%B3%D0%B8%D1%8F+2030', 'PATH' => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin', 'SERVER_SIGNATURE' => 'Apache/2.4.10 (Debian) Server at m.asninfo.ru Port 80 ', 'SERVER_SOFTWARE' => 'Apache/2.4.10 (Debian)', 'SERVER_NAME' => 'm.asninfo.ru', 'SERVER_ADDR' => '127.0.0.1', 'SERVER_PORT' => '80', 'REMOTE_ADDR' => '54.145.183.34', 'DOCUMENT_ROOT' => '/var/www/asninfo/data/www/asninfo.ru/mobile/web', 'REQUEST_SCHEME' => 'http', 'CONTEXT_PREFIX' => '/php-bin/', 'CONTEXT_DOCUMENT_ROOT' => '/var/www/php-bin/asninfo/', 'SERVER_ADMIN' => 'webmaster@m.asninfo.ru', 'SCRIPT_FILENAME' => '/var/www/asninfo/data/www/asninfo.ru/mobile/web/index.php', 'REMOTE_PORT' => '44211', 'REDIRECT_QUERY_STRING' => 'query=%D1%81%D1%82%D1%80%D0%B0%D1%82%D0%B5%D0%B3%D0%B8%D1%8F+2030', 'REDIRECT_URL' => '/index.php', 'GATEWAY_INTERFACE' => 'CGI/1.1', 'SERVER_PROTOCOL' => 'HTTP/1.0', 'REQUEST_METHOD' => 'GET', 'QUERY_STRING' => 'query=%D1%81%D1%82%D1%80%D0%B0%D1%82%D0%B5%D0%B3%D0%B8%D1%8F+2030', 'REQUEST_URI' => '/search?query=%D1%81%D1%82%D1%80%D0%B0%D1%82%D0%B5%D0%B3%D0%B8%D1%8F+2030', 'SCRIPT_NAME' => '/index.php', 'ORIG_SCRIPT_FILENAME' => '/var/www/php-bin/asninfo/php', 'ORIG_PATH_INFO' => '/index.php', 'ORIG_PATH_TRANSLATED' => '/var/www/asninfo/data/www/asninfo.ru/mobile/web/index.php', 'ORIG_SCRIPT_NAME' => '/php-bin/php', 'PHP_SELF' => '/index.php', 'REQUEST_TIME_FLOAT' => 1711723394.428978, 'REQUEST_TIME' => 1711723394, ];