diff --git a/src/db.rs b/src/db.rs index 3e64d9f..62afddd 100644 --- a/src/db.rs +++ b/src/db.rs @@ -38,7 +38,6 @@ pub fn get_db_pool() -> SqlitePool { let conn_opts = SqliteConnectOptions::new() .foreign_keys(true) - .auto_vacuum(sqlx::sqlite::SqliteAutoVacuum::Incremental) .journal_mode(SqliteJournalMode::Wal) .synchronous(sqlx::sqlite::SqliteSynchronous::Normal) .filename(&db_filename) @@ -46,6 +45,7 @@ pub fn get_db_pool() -> SqlitePool { .extension("./libjulid") .busy_timeout(Duration::from_secs(TIMEOUT)) .create_if_missing(true) + .optimize_on_close(true, None) .pragma("mmap_size", "3000000000"); let pool = SqlitePoolOptions::new() diff --git a/src/watches/handlers.rs b/src/watches/handlers.rs index 6762ddd..fac2c5b 100644 --- a/src/watches/handlers.rs +++ b/src/watches/handlers.rs @@ -251,7 +251,7 @@ pub async fn get_search_watch( query_as(DEFAULT_WATCHES_QUERY) } else if let Some(title) = search_query.title { query_as( - "select * from watches where id in (select id from watch_search where title match ?)", + "select * from watches where id in (select id from watch_search where title match ? order by rank)", ) .bind(title) } else if let Some(ref search) = search_query.search {