mirror of
https://github.com/rommapp/romm.git
synced 2026-11-30 10:32:57 +01:00
fix(search): full-text indexes+caching
Adds a few new indexes to handle full-text searches instead of doing `ILIKE` matching, improving performance substantially. Alongside that, a few other things were done in order to improve search performance, such as caching filter values so they're not computed on each request to /api/roms. Overall, this should have a very noticeable impact on large collections when using the search feature.
This commit is contained in:
@@ -130,12 +130,17 @@ function updateSelectedRom(rom: SimpleRom) {
|
||||
type SortBy = { key: keyof SimpleRom; order: "asc" | "desc" }[];
|
||||
|
||||
function updateOptions({ sortBy }: { sortBy: SortBy }) {
|
||||
if (!sortBy[0]) return;
|
||||
const { key, order } = sortBy[0];
|
||||
|
||||
romsStore.resetPagination();
|
||||
romsStore.setOrderBy(key);
|
||||
romsStore.setOrderDir(order);
|
||||
if (sortBy[0]) {
|
||||
const { key, order } = sortBy[0];
|
||||
romsStore.setOrderBy(key);
|
||||
romsStore.setOrderDir(order);
|
||||
} else {
|
||||
// Clear the `orderBy` key when the user removes
|
||||
// the sort column from the table
|
||||
romsStore.setOrderBy(null);
|
||||
romsStore.setOrderDir("asc");
|
||||
}
|
||||
romsStore.fetchRoms();
|
||||
}
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user