mirror of
https://github.com/YGGverse/Yo.git
synced 2025-02-10 13:54:31 +00:00
apply search options
This commit is contained in:
parent
96397b29d6
commit
7390178376
@ -23,10 +23,33 @@ $index = $client->index(
|
|||||||
$config->manticore->index->document->name
|
$config->manticore->index->document->name
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// Init search query
|
||||||
|
$query = $index->search(
|
||||||
|
$argv[1]
|
||||||
|
);
|
||||||
|
|
||||||
|
// Apply search options (e.g. field_weights)
|
||||||
|
foreach ($config->webui->search->options as $key => $value)
|
||||||
|
{
|
||||||
|
if (is_int($value) || is_string($value))
|
||||||
|
{
|
||||||
|
$query->option(
|
||||||
|
$key,
|
||||||
|
$value
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$query->option(
|
||||||
|
$key,
|
||||||
|
(array) $value
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Search
|
// Search
|
||||||
foreach($index->search($argv[1])
|
foreach($query->limit($argv[2] ? $argv[2] : 10)->get() as $result)
|
||||||
->limit($argv[2] ? $argv[2] : 10)
|
|
||||||
->get() as $result)
|
|
||||||
{
|
{
|
||||||
var_dump(
|
var_dump(
|
||||||
$result
|
$result
|
||||||
|
Loading…
x
Reference in New Issue
Block a user