Browse Source

add field_weights configuration

main
yggverse 9 months ago
parent
commit
96397b29d6
  1. 11
      example/config.json
  2. 20
      src/webui/search.php

11
example/config.json

@ -42,6 +42,17 @@ @@ -42,6 +42,17 @@
"extended":
{
"enabled":false
},
"options":
{
"field_weights":
{
"url": 100,
"title": 200,
"description": 300,
"keywords": 400,
"body": 500
}
}
},
"footer":

20
src/webui/search.php

@ -177,6 +177,26 @@ switch (true) @@ -177,6 +177,26 @@ switch (true)
}
}
// 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
);
}
}
// Get found
$found = empty($q) ? $total : $query->get()->getTotal();

Loading…
Cancel
Save