mirror of
https://github.com/lrnselfreliance/wrolpi.git
synced 2026-12-03 13:19:58 -05:00
Add Docs module for searching and organizing PDFs and EPUBs
Create a new Docs module that consolidates PDF and eBook handling into a unified system with subjects and authors support. This replaces the separate PDF/eBook modelers with a single Doc model backed by an alembic migration (rename ebook to doc). Key changes: - New modules/docs package with models, API, extractors, and lib - Subject and author metadata extraction with case-insensitive normalization for cleaner PDF metadata - Frontend Docs pages with AuthorsPage, SubjectsPage using CollectionTable, and doc card deletion - Global search integration for subjects and authors - Generic collection item count support - Frontend file card metadata adjusted to match collection sort - Bump yt-dlp version
This commit is contained in:
parent
4a21499bdd
commit
aefc7b1def
90 changed files with 4484 additions and 1189 deletions
|
|
@ -64,7 +64,7 @@ export const useSearch = (defaultLimit = 48, totalPages = 0, emptySearch = false
|
|||
const pages = usePages(defaultLimit, totalPages);
|
||||
// text/html, video*, image*, etc.
|
||||
const filter = searchParams.get('filter');
|
||||
// archive/video/ebook/etc.
|
||||
// archive/video/doc/etc.
|
||||
const model_ = searchParams.get('model') || model;
|
||||
|
||||
const anySearch = (!datesIsEmpty) || searchStr || (activeTags && activeTags.length > 0) || filter || model;
|
||||
|
|
@ -121,6 +121,8 @@ export function useSuggestions(searchStr, tagNames, filter, anyTag) {
|
|||
fileGroups: [],
|
||||
channels: [],
|
||||
domains: [],
|
||||
authors: [],
|
||||
subjects: [],
|
||||
zimsEstimates: [],
|
||||
}
|
||||
const [suggestions, setSuggestions] = React.useState(defaultSuggestions);
|
||||
|
|
@ -162,6 +164,8 @@ export function useSuggestions(searchStr, tagNames, filter, anyTag) {
|
|||
...prevState,
|
||||
channels: generalData.channels,
|
||||
domains: generalData.domains,
|
||||
authors: generalData.authors,
|
||||
subjects: generalData.subjects,
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
@ -274,6 +278,30 @@ export function useSearchSuggestions(defaultSearchStr, defaultTagNames, anyTag)
|
|||
})
|
||||
}
|
||||
}
|
||||
if (newSuggestions.authors && newSuggestions.authors.length > 0) {
|
||||
results.authors = {
|
||||
name: 'Authors', results: newSuggestions.authors.map(i => {
|
||||
return {
|
||||
type: 'author',
|
||||
title: i.name,
|
||||
id: i.id,
|
||||
location: `/docs?author=${encodeURIComponent(i.name)}`
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
if (newSuggestions.subjects && newSuggestions.subjects.length > 0) {
|
||||
results.subjects = {
|
||||
name: 'Subjects', results: newSuggestions.subjects.map(i => {
|
||||
return {
|
||||
type: 'subject',
|
||||
title: i.name,
|
||||
id: i.id,
|
||||
location: `/docs?subject=${encodeURIComponent(i.name)}`
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// Match at most 5 Tags.
|
||||
const matchingTags = searchStr ? fuzzyMatchTagsByName(searchStr).slice(0, 5) : null;
|
||||
|
|
@ -304,6 +332,8 @@ export function useSearchSuggestions(defaultSearchStr, defaultTagNames, anyTag)
|
|||
otherSum: otherSum,
|
||||
channels: newSuggestions.channels.length,
|
||||
domains: newSuggestions.domains.length,
|
||||
authors: newSuggestions.authors?.length,
|
||||
subjects: newSuggestions.subjects?.length,
|
||||
tags: matchingTags?.length,
|
||||
apps: matchingApps?.length,
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue