revise search data for missing fields
All checks were successful
Build Multiarch Container Image / call-reusable-workflow (push) Successful in 28m27s
All checks were successful
Build Multiarch Container Image / call-reusable-workflow (push) Successful in 28m27s
This commit is contained in:
parent
40db2c37bb
commit
97cf9db9ff
4 changed files with 18 additions and 17 deletions
|
@ -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<SqliteConnectionManager>) -> Result<(), DataStoreError> {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue