Repository navigation
Add library search by file path when query looks like a file name - #5681
Open
nathanpride wants to merge 1 commit into
Open
nathanpride wants to merge 1 commit into
nathanpride wants to merge 1 commit into
Conversation
Queries ending with a supported audio or ebook extension (e.g. lalalalala.mp3) now additionally match library items by their stored file paths or item folder path. Matches are merged into the existing book/podcast search buckets, deduplicated and permission-filtered by the existing query. Metadata-only queries are unchanged and pay no extra cost. - New server/utils/queries/searchFileHelpers.js (isFileSearchQuery, getFileMatchIds) with unit + in-memory sqlite integration tests - Book and podcast filter search() integration, podcast episode file matches attributed to the parent podcast
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Brief summary
Library search now recognizes file-shape queries: when the query ends with a supported audio or ebook extension (e.g.
lalalalala.mp3,dune.epub), items are additionally matched by their stored file paths and item folder path. Matches merge into the existing book/podcast result buckets.Which issue is fixed?
Fixes #5680
In-depth Description
The trigger is a whitelist of extensions derived from the existing
globals.SupportedAudioTypes+SupportedEbookTypeslists, so the extra path search only runs for queries that cannot match metadata fields anyway — ordinary searches are byte-for-byte unchanged and pay no extra cost (relevant to #5667: nolibraryFilesscan on normal keystrokes).server/utils/queries/searchFileHelpers.js:isFileSearchQuery(query)— case-insensitive suffix check against the extension whitelist (bare.mp3counts)getFileMatchIds(libraryId, textSearchQuery)— guardedjson_eachquery overlibraryFiles[].metadata.path(mirrors the existing narrator/tag/genre raw-SQL pattern,json_validguard, LIMIT 1000) plus a plainlibraryItems.pathscan for folder-only matcheslibraryItemsBookFilters.search()/libraryItemsPodcastFilters.search(): when triggered, one extra OR-term.id$ IN (...)is added to the existing findAll — dedup, limit/offset and user-permission filtering come from the existing query machineryTextSearchQuery: case-insensitive, accent-folded)How have you tested this?
test/server/utils/queries/(unit for the trigger incl. unicode/whitespace/edge inputs; in-memory sqlite integration for path matching, dedup, restricted-user exclusion, bare-extension query, metadata-only regression, podcast episode attribution)npm run build:server && mocha dist-server/test→ 388 passing, 0 failingeslintclean on all changed filestrack.mp3returns items whose audio file matches;dunebehaves exactly as beforeScreenshots
N/A — server-only change, no UI changes (results render in the existing search shelves).