feat: enable cross-library search in unified search query

Updates SearchMediaItemsUnified query to support searching across all
libraries when library_id parameter is not provided. Changes SQL from
requiring library_id to checking for NULL:

  AND (sqlc.narg('library_id')::uuid IS NULL
      OR mi.library_id = sqlc.narg('library_id')::uuid)

The explicit ::uuid cast ensures PostgreSQL handles type inference
correctly when comparing UUID columns with nullable parameters.

Regenerates Go database code including queries.sql.go and querier.go
to reflect the updated SQL schema.

This enables the /api/media-items/search endpoint to search all libraries
by omitting the library_id query parameter, matching the behavior of
the OPDS search endpoint.
This commit is contained in:
2026-03-24 16:47:23 -04:00
parent e6bca1457c
commit fe8a65af84
3 changed files with 10 additions and 224 deletions
-1
View File
@@ -288,7 +288,6 @@ type Querier interface {
SearchLanguageValues(ctx context.Context, arg SearchLanguageValuesParams) ([]SearchLanguageValuesRow, error)
// Search Media Items queries
SearchMediaItems(ctx context.Context, arg SearchMediaItemsParams) ([]SearchMediaItemsRow, error)
SearchMediaItemsFuzzy(ctx context.Context, arg SearchMediaItemsFuzzyParams) ([]SearchMediaItemsFuzzyRow, error)
SearchMediaItemsUnified(ctx context.Context, arg SearchMediaItemsUnifiedParams) ([]SearchMediaItemsUnifiedRow, error)
SearchSeriesValues(ctx context.Context, arg SearchSeriesValuesParams) ([]SearchSeriesValuesRow, error)
// Library Visibility queries