2023-11-19 23:00:51 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
// Load dependencies
|
|
|
|
require_once __DIR__ . '/../../../vendor/autoload.php';
|
|
|
|
|
|
|
|
// Init config
|
|
|
|
$config = json_decode(
|
|
|
|
file_get_contents(
|
2023-11-25 00:16:08 +02:00
|
|
|
__DIR__ . '/../../../config.json'
|
2023-11-19 23:00:51 +02:00
|
|
|
)
|
|
|
|
);
|
|
|
|
|
|
|
|
// Init client
|
|
|
|
$client = new \Manticoresearch\Client(
|
|
|
|
[
|
|
|
|
'host' => $config->manticore->server->host,
|
|
|
|
'port' => $config->manticore->server->port,
|
|
|
|
]
|
|
|
|
);
|
|
|
|
|
|
|
|
// Init index
|
|
|
|
$index = $client->index(
|
2023-11-25 16:01:46 +02:00
|
|
|
$config->manticore->index->document->name
|
2023-11-19 23:00:51 +02:00
|
|
|
);
|
|
|
|
|
|
|
|
// Search
|
2024-03-21 23:20:31 +02:00
|
|
|
foreach($index->search($argv[1])
|
|
|
|
->limit($argv[2] ? $argv[2] : 10)
|
|
|
|
->get() as $result)
|
2023-11-19 23:00:51 +02:00
|
|
|
{
|
|
|
|
var_dump(
|
|
|
|
$result
|
|
|
|
);
|
|
|
|
}
|