mirror of
https://github.com/YGGverse/Yo.git
synced 2026-03-31 17:55:35 +00:00
initial commit
This commit is contained in:
parent
a5fabf2381
commit
7dfc800a67
9 changed files with 583 additions and 2 deletions
34
src/cli/document/search.php
Normal file
34
src/cli/document/search.php
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
<?php
|
||||
|
||||
// Load dependencies
|
||||
require_once __DIR__ . '/../../../vendor/autoload.php';
|
||||
|
||||
// Init config
|
||||
$config = json_decode(
|
||||
file_get_contents(
|
||||
__DIR__ . '/../../config.json'
|
||||
)
|
||||
);
|
||||
|
||||
// Init client
|
||||
$client = new \Manticoresearch\Client(
|
||||
[
|
||||
'host' => $config->manticore->server->host,
|
||||
'port' => $config->manticore->server->port,
|
||||
]
|
||||
);
|
||||
|
||||
// Init index
|
||||
$index = $client->index(
|
||||
$config->manticore->index->document
|
||||
);
|
||||
|
||||
// Search
|
||||
foreach($index->search($argv[1])
|
||||
->limit($argv[2] ? $argv[2] : 10)
|
||||
->get() as $result)
|
||||
{
|
||||
var_dump(
|
||||
$result
|
||||
);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue