mirror of
https://github.com/YGGverse/Yoda.git
synced 2026-03-31 16:45:27 +00:00
add search suggestions in bookmarks
This commit is contained in:
parent
dab0d33789
commit
55afbcdab4
1 changed files with 19 additions and 2 deletions
|
|
@ -62,19 +62,36 @@ class Completion
|
||||||
|
|
||||||
public function refresh(
|
public function refresh(
|
||||||
int $limit = 5,
|
int $limit = 5,
|
||||||
int $offset = 0
|
int $offset = 0,
|
||||||
|
array $suggestions = []
|
||||||
): void
|
): void
|
||||||
{
|
{
|
||||||
$this->suggestion->clear();
|
$this->suggestion->clear();
|
||||||
|
|
||||||
|
foreach ($this->request->navbar->page->container->browser->database->findBookmark(
|
||||||
|
$this->request->getValue(),
|
||||||
|
$offset,
|
||||||
|
$limit
|
||||||
|
) as $history)
|
||||||
|
{
|
||||||
|
$suggestions[] = $history->request;
|
||||||
|
}
|
||||||
|
|
||||||
foreach ($this->request->navbar->page->container->browser->database->findHistory(
|
foreach ($this->request->navbar->page->container->browser->database->findHistory(
|
||||||
$this->request->getValue(),
|
$this->request->getValue(),
|
||||||
$offset,
|
$offset,
|
||||||
$limit
|
$limit
|
||||||
) as $history)
|
) as $history)
|
||||||
{
|
{
|
||||||
|
$suggestions[] = $history->url;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (array_values(array_unique($suggestions)) as $index => $suggestion)
|
||||||
|
{
|
||||||
|
if ($index > $limit) break;
|
||||||
|
|
||||||
$this->suggestion->append(
|
$this->suggestion->append(
|
||||||
$history->url
|
$suggestion
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue