quintodrome/server/subsonic
Deluan Quintão b59eb32961
feat(subsonic): sort search3 results by relevance (#5086)
* fix(subsonic): optimize search3 for high-cardinality FTS queries

Use a two-phase query strategy for FTS5 searches to avoid the
performance penalty of expensive LEFT JOINs (annotation, bookmark,
library) on high-cardinality results like "the".

Phase 1 runs a lightweight query (main table + FTS index only) to get
sorted, paginated rowids. Phase 2 hydrates only those few rowids with
the full JOINs, making them nearly free.

For queries with complex ORDER BY expressions that reference joined
tables (e.g. artist search sorted by play count), the optimization is
skipped and the original single-query approach is used.

* fix(search): update order by clauses to include 'rank' for FTS queries

Signed-off-by: Deluan <deluan@navidrome.org>

* fix(search): reintroduce 'rank' in Phase 2 ORDER BY for FTS queries

Signed-off-by: Deluan <deluan@navidrome.org>

* fix(search): remove 'rank' from ORDER BY in non-FTS queries and adjust two-phase query handling

Signed-off-by: Deluan <deluan@navidrome.org>

* fix(search): update FTS ranking to use bm25 weights and simplify ORDER BY qualification

Signed-off-by: Deluan <deluan@navidrome.org>

* fix(search): refine FTS query handling and improve comments for clarity

Signed-off-by: Deluan <deluan@navidrome.org>

* fix(search): refactor full-text search handling to streamline query strategy selection and improve LIKE fallback logic.

Increase e2e coverage for search3

Signed-off-by: Deluan <deluan@navidrome.org>

* refactor: enhance FTS column definitions and relevance weights

Signed-off-by: Deluan <deluan@navidrome.org>

* fix(search): refactor Search method signatures to remove offset and size parameters, streamline query handling

Signed-off-by: Deluan <deluan@navidrome.org>

* fix(search): allow single-character queries in search strategies and update related tests

Signed-off-by: Deluan <deluan@navidrome.org>

* fix(search): make FTS Phase 1 treat Max=0 as no limit, reorganize tests

FTS Phase 1 unconditionally called Limit(uint64(options.Max)), which
produced LIMIT 0 when Max was zero. This diverged from applyOptions
where Max=0 means no limit. Now Phase 1 mirrors applyOptions: only add
LIMIT/OFFSET when the value is positive. Also moved legacy backend
integration tests from sql_search_fts_test.go to sql_search_like_test.go
and added regression tests for the Max=0 behavior on both backends.

* refactor: simplify callSearch function by removing variadic options and directly using QueryOptions

Signed-off-by: Deluan <deluan@navidrome.org>

* fix(search): implement ftsQueryDegraded function to detect significant content loss in FTS queries

Signed-off-by: Deluan <deluan@navidrome.org>

---------

Signed-off-by: Deluan <deluan@navidrome.org>
2026-02-23 08:51:54 -05:00
..
filter fix(subsonic): only use genre tag when searching by genre (#4361) 2025-07-19 21:52:29 -04:00
responses refactor: run Go modernize (#5002) 2026-02-08 09:57:30 -05:00
album_lists.go feat: Multi-library support (#4181) 2025-07-18 18:41:12 -04:00
album_lists_test.go feat: Multi-library support (#4181) 2025-07-18 18:41:12 -04:00
api.go refactor: move playlist business logic from repositories to service layer (#5027) 2026-02-21 19:57:13 -05:00
api_suite_test.go feat:(server): support reading lyrics from filesystem (#2897) 2025-04-30 08:10:19 -04:00
api_test.go fix(subsonic): validate JSONP callback parameter 2026-02-08 10:33:46 -05:00
bookmarks.go feat(subsonic): implement indexBasedQueue extension (#4244) 2025-11-09 12:52:05 -05:00
browsing.go feat: add similar songs functionality in agents, and Instant Mix (song-based) to UI (#4919) 2026-01-25 16:16:43 -05:00
browsing_test.go feat: Multi-library support (#4181) 2025-07-18 18:41:12 -04:00
helpers.go refactor: run Go modernize (#5002) 2026-02-08 09:57:30 -05:00
helpers_test.go fix(subsonic): fix support for LegacyClients 2026-01-25 18:06:48 -05:00
jukebox.go refactor: small improvements and clean up (#3423) 2024-10-22 22:54:31 -04:00
library_scanning.go feat(scanner): implement selective folder scanning and file system watcher improvements (#4674) 2025-11-14 22:15:43 -05:00
library_scanning_test.go feat(scanner): implement selective folder scanning and file system watcher improvements (#4674) 2025-11-14 22:15:43 -05:00
media_annotation.go feat(plugins): experimental support for plugins (#3998) 2025-06-22 20:45:38 -04:00
media_annotation_test.go feat: Multi-library support (#4181) 2025-07-18 18:41:12 -04:00
media_retrieval.go refactor: run Go modernize (#5002) 2026-02-08 09:57:30 -05:00
media_retrieval_test.go feat(prometheus): add metrics to Subsonic API and Plugins (#4266) 2025-06-27 22:13:57 -04:00
middlewares.go feat: rename "reverse proxy authentication" to "external authentication" (#4418) 2025-12-02 12:01:48 -05:00
middlewares_test.go feat: rename "reverse proxy authentication" to "external authentication" (#4418) 2025-12-02 12:01:48 -05:00
opensubsonic.go feat(subsonic): implement indexBasedQueue extension (#4244) 2025-11-09 12:52:05 -05:00
opensubsonic_test.go feat(subsonic): implement indexBasedQueue extension (#4244) 2025-11-09 12:52:05 -05:00
playlists.go refactor: move playlist business logic from repositories to service layer (#5027) 2026-02-21 19:57:13 -05:00
playlists_test.go refactor: move playlist business logic from repositories to service layer (#5027) 2026-02-21 19:57:13 -05:00
radio.go Replace all utils.Param* with req.Params 2023-12-21 17:41:09 -05:00
searching.go feat(subsonic): sort search3 results by relevance (#5086) 2026-02-23 08:51:54 -05:00
searching_test.go refactor: run Go modernize (#5002) 2026-02-08 09:57:30 -05:00
sharing.go fix(subsonic): make Share's lastVisited optional 2025-01-09 16:10:53 -05:00
stream.go Add log.IsGreaterOrEqualTo, that take into consideration path-scoped log levels 2023-12-25 16:35:16 -05:00
system.go Some cleanup, adding missing context handling 2022-12-06 19:57:47 -05:00
users.go fix(subsonic): make getUser?username comparison case-insensitive 2025-12-19 17:56:40 -05:00
users_test.go fix(subsonic): add username parameter validation for GetUser endpoint 2025-12-10 18:30:26 -05:00