Add search index (#15)

- Add utility rebuild script
- Add Search to header
- Add shell of search page
- Add search query support to ItemList
This commit is contained in:
2024-05-26 14:18:20 -04:00
parent 210377b4da
commit 9d59bfb1c6
5 changed files with 122 additions and 10 deletions

View File

@@ -134,6 +134,22 @@ class ItemList {
"/feed/items?id=$feedId&bookmarked");
}
/**
* Create an item list with items matching given search terms
*
* @param string $search The item search terms / query
* @param SQLite3 $db The database connection to use to obtain items
* @return static An item list match the given search terms
*/
public static function matchingSearch(string $search, SQLite3 $db): static {
$list = new static($db,
self::makeQuery($db, ['item.id IN (SELECT ROWID FROM item_search WHERE content MATCH :search)'],
[[':search', $search]]), 'Matching', "/search?search=$search");
$list->showIndicators = true;
$list->displayFeed = true;
return $list;
}
/**
* Render this item list
*/