$config->manticore->server->host, 'port' => $config->manticore->server->port, ] ); // Init index $index = $client->index( $config->manticore->index->document->name ); // Get totals $total = $index->search('') ->option('cutoff', 0) ->limit(0) ->get() ->getTotal(); $placeholder = sprintf( _('Search in %s documents %s'), number_format( $total ), $config->webui->search->index->request->url->enabled ? _('or enter new address to crawl...') : false ); $response = false; // Request $q = !empty($_GET['q']) ? trim($_GET['q']) : ''; $p = !empty($_GET['p']) ? (int) $_GET['p'] : 1; // Register new URL by request on enabled if ($config->webui->search->index->request->url->enabled) { if (filter_var($q, FILTER_VALIDATE_URL) && preg_match($config->webui->search->index->request->url->regex, $q)) { // Prepare URL $url = $q; $crc32url = crc32($url); // Check URL for exist $exist = $index->search('@url "' . $url . '"') ->filter('crc32url', $crc32url) ->limit(1) ->get() ->getTotal(); if ($exist) { /* disable as regular search request possible $response = sprintf( _('URL "%s" exists in search index'), htmlentities($q) ); */ } // Add URL else { // @TODO check http code $index->addDocument( [ 'url' => $url, 'crc32url' => $crc32url ] ); $response = sprintf( _('URL "%s" added to the crawl queue!'), htmlentities($q) ); } } } // Extended syntax corrections switch (true) { case filter_var($q, FILTER_VALIDATE_URL): $query = $index->search('@url "' . $q . '"')->filter('crc32url', crc32($q)); break; default: $query = $index->search($q); } // Search request begin $results = $query->offset($p * $config->webui->pagination->limit - $config->webui->pagination->limit) ->limit($config->webui->pagination->limit) ->get(); ?> <?php echo sprintf(_('%s - YGGo!'), htmlentities($q)) ?>

getTotal()) { ?>
url)) { ?>

title ?>

description)) { ?> description ?> keywords)) { ?> keywords ?> setValue( parse_url( $result->url, PHP_URL_HOST ) ); $identicon->setSize(16); $identicon->setStyle( [ 'backgroundColor' => 'rgba(255, 255, 255, 0)', 'padding' => 0 ] ); ?> identicon url)) ?>
webui->pagination->limit <= $results->getTotal()) { ?>