diff --git a/Cargo.lock b/Cargo.lock index 18f80c5..c4e6cbb 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -889,7 +889,7 @@ dependencies = [ [[package]] name = "little-hesinde" -version = "0.2.0" +version = "0.2.1" dependencies = [ "calibre-db", "clap", diff --git a/calibre-db/src/search.rs b/calibre-db/src/search.rs index bcfb68c..d8dfda3 100644 --- a/calibre-db/src/search.rs +++ b/calibre-db/src/search.rs @@ -14,21 +14,22 @@ use crate::data::{book::Book, error::DataStoreError}; /// A lot of joins but only run once at startup. const SEARCH_INIT_QUERY: &str = "INSERT INTO search.fts(book_id, data) SELECT b.id as book_id, - b.title || ' ' || - a.name || ' ' || - c.text || ' ' || - GROUP_CONCAT(DISTINCT t.name) || ' ' || - GROUP_CONCAT(DISTINCT i.val) || ' ' || - GROUP_CONCAT(DISTINCT s.name) as data + COALESCE(b.title, '') || ' ' || + COALESCE(a.name, '') || ' ' || + COALESCE(c.text, '') || ' ' || + COALESCE(GROUP_CONCAT(DISTINCT t.name), '') || ' ' || + COALESCE(GROUP_CONCAT(DISTINCT i.val), '') || ' ' || + COALESCE(GROUP_CONCAT(DISTINCT s.name), '') as data FROM main.books as b - JOIN main.books_authors_link AS b2a ON b.id = b2a.book - JOIN main.authors AS a ON b2a.author = a.id - JOIN main.comments AS c ON c.book = b.id - JOIN main.books_tags_link AS b2t ON b.id = b2t.book - JOIN main.tags AS t ON b2t.tag = t.id - JOIN main.identifiers AS i ON i.book = b.id - JOIN main.books_series_link AS b2s ON b.id = b2s.book - JOIN main.series AS s ON b2s.series = s.id"; + LEFT JOIN main.books_authors_link AS b2a ON b.id = b2a.book + LEFT JOIN main.authors AS a ON b2a.author = a.id + LEFT JOIN main.comments AS c ON c.book = b.id + LEFT JOIN main.books_tags_link AS b2t ON b.id = b2t.book + LEFT JOIN main.tags AS t ON b2t.tag = t.id + LEFT JOIN main.identifiers AS i ON i.book = b.id + LEFT JOIN main.books_series_link AS b2s ON b.id = b2s.book + LEFT JOIN main.series AS s ON b2s.series = s.id + GROUP BY b.id"; /// Attach the fts in-memory database to the read-only calibre database. pub(crate) fn attach(pool: &Pool) -> Result<(), DataStoreError> { diff --git a/little-hesinde/Cargo.toml b/little-hesinde/Cargo.toml index 71589d7..353f8a3 100644 --- a/little-hesinde/Cargo.toml +++ b/little-hesinde/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "little-hesinde" -version = "0.2.0" +version = "0.2.1" edition = "2021" license = { workspace = true } authors = { workspace = true } diff --git a/little-hesinde/src/lib.rs b/little-hesinde/src/lib.rs index 8cf2d2f..708192f 100644 --- a/little-hesinde/src/lib.rs +++ b/little-hesinde/src/lib.rs @@ -76,7 +76,7 @@ pub mod opds { pub mod templates; pub const APP_NAME: &str = "little-hesinde"; -pub const VERSION: &str = "0.2.0"; +pub const VERSION: &str = "0.2.1"; /// Internal marker data in lieu of a proper `Accept` header. #[derive(Debug, Clone, Copy)]