Introducing a new way to review your PRs.

Read the announcement

huynhsontung / screenbox

LibVLC-based media player for the Universal Windows Platform

View on GitHub

19 documents · Updated Nov 23, 2026

docs / search-and-content-discovery

Search and content discovery

Search and content discovery gives users one local search entry point for albums, artists, songs, videos, and playlists. It turns a query into typed suggestions or a grouped result view, then lets the user play media or open the matching content.

Search scope

The search service searches the current music library, video library, and playlist collection. It matches the name of each item without case sensitivity and keeps matches grouped by content type, so the result view can present each kind of content in its own context. It does not search remote services or metadata fields beyond the item name.

Search result model

Screenbox.Core.Models.SearchResult is the shared result model for a query. It carries the query text and separate lists for songs, videos, artists, albums, and playlists. The model also provides one empty-result check for the result page.

References: Screenbox.Core/…/SearchResult.cs• L6-50 Screenbox.Core/…/SearchService.cs• L32-71

Search suggestions

Suggestions provide a short, typed preview while the user enters a query. The service gathers candidates from all five content groups, limits the number taken from each group, ranks names by how closely the query occurs, and returns a small total set. A non-empty query with no match produces a typed empty suggestion so the search box can show a clear no-result state.

References: Screenbox.Core/…/ISearchService.cs• L6-15 Screenbox.Core/…/SearchService.cs• L73-129 Screenbox.Core/…/SearchSuggestion.cs• L5-32 Screenbox.Core/…/SearchSuggestionType.cs• L3-16 Screenbox/…/SearchSuggestionTemplateSelector.cs• L8-35

Search entry flow

The main page owns the search box and keeps its suggestions in sync with user input. A chosen suggestion acts as a direct action, while a submitted query without a chosen suggestion creates the grouped search result page.

This diagram shows how search input becomes either a direct content action or a full result view.

flowchart TD
    A[User enters query] --> B[Search service finds local matches]
    B --> C[Typed suggestions]
    B --> D[Grouped search result]
    C --> E{Suggestion selected?}
    E -->|Song or video| F[Play media]
    E -->|Album, artist, or playlist| G[Open content details]
    E -->|No suggestion| D
    D --> H[Open result sections]

Query submission

The main page trims the submitted text and ignores an empty query. A valid query is passed to the search service, and the resulting SearchResult becomes the navigation parameter for the grouped result page. After submission, the search box clears its suggestions and closes its pane when the layout allows it.

References: Screenbox.Core/…/MainPageViewModel.cs• L154-223 Screenbox/…/MainPage.xaml.cs• L306-342

Suggestion actions

Each suggestion carries both a display name and the matching view model. Selecting media starts playback. Selecting an album, artist, or playlist opens its detail page. This keeps suggestions useful as actions rather than treating them only as alternate query text.

References: Screenbox.Core/…/MainPageViewModel.cs• L205-223 Screenbox.Core/…/SearchSuggestion.cs• L11-32

Result navigation

The grouped result page is the central discovery view. It shows only the content groups that have matches, gives each group a suitable media view, and exposes a full category page when the group has more items than the compact view displays.

Grouped result view

SearchResultPageViewModel keeps the complete result model while exposing observable collections for the page. Artists and albums use grid sections. Songs use a list. Videos and playlists use media cards. The page supports direct opening of artists, albums, and playlists, plus playback for songs and videos.

References: Screenbox.Core/…/SearchResultPageViewModel.cs• L15-127 Screenbox/…/SearchResultPage.xaml• L91-229 Screenbox/…/SearchResultPage.xaml• L231-340

Category result views

The grouped page offers a separate view for artists, albums, songs, videos, or playlists when the compact section is not enough. These views reuse the loaded search result and present the full list for one category, so moving to a category view does not require a second search.

References: Screenbox.Core/…/SearchResultPageViewModel.cs• L129-157 Screenbox/…/ArtistSearchResultPage.xaml• L30-79 Screenbox/…/AlbumSearchResultPage.xaml• L33-88 Screenbox/…/SongSearchResultPage.xaml• L51-91 Screenbox/…/VideoSearchResultPage.xaml• L43-79 Screenbox/…/PlaylistSearchResultPage.xaml• L29-68

Content navigation

Search results connect discovery to the wider media library. Artists, albums, and playlists open their detail or collection views. Media items can play at once, and songs can also start playback with the complete song result list as the play queue.

References: Screenbox.Core/…/SearchResultPageViewModel.cs• L116-156 Screenbox/…/SearchResultPage.xaml• L27-87 Screenbox/…/PlaylistSearchResultPage.xaml• L39-64

Change checklist

When these files or sections are changed, remember to consider these:

  • Keep the five result categories aligned across SearchService, SearchResult, the main grouped page, and the category pages.
  • Keep suggestion types aligned with their display template, ranking input, and action mapping in MainPageViewModel.
  • Preserve the shared SearchResultPageViewModel hand-off when changing category navigation. The category pages depend on the loaded query and result lists.
  • Keep media suggestion actions consistent with the distinction between immediate playback and detail-page navigation.

Important failure modes

TriggerConsequenceGuard
A result category is added in only one layerThe search service can find content that the model or UI cannot showUpdate the service, result model, grouped view, category view, and suggestion mapping together
A suggestion has no matching data objectChoosing it does not navigate or play anythingKeep data-bearing suggestions separate from the explicit None suggestion
A category page receives no shared result view modelIts query and item list are unavailableNavigate with the loaded SearchResultPageViewModel
A blank query reaches the search flowThe user can enter a result flow with no useful search termTrim input and reject empty submissions before creating a result

Key files

FileWhy to read it
Screenbox.Core/…/SearchService.csDefines local search scope, match behavior, and suggestion ranking.
Screenbox.Core/…/SearchResult.csDefines the cross-category result contract.
Screenbox.Core/…/SearchSuggestion.csDefines the data carried by search-box suggestions.
Screenbox.Core/…/MainPageViewModel.csConnects search-box input and selection to playback or navigation.
Screenbox.Core/…/SearchResultPageViewModel.csCoordinates grouped results, playback, and category navigation.
Screenbox/Pages/Search/SearchResultPage.xamlShows how the grouped result experience is organized.
Screenbox/Pages/Search/SongSearchResultPage.xamlShows the full-category media result pattern.
Screenbox/Pages/Search/ArtistSearchResultPage.xamlShows the full-category entity result pattern.
Screenbox/Pages/Search/AlbumSearchResultPage.xamlShows album discovery and related artist navigation.
Screenbox/Pages/Search/VideoSearchResultPage.xamlShows video playback from search results.
Screenbox/Pages/Search/PlaylistSearchResultPage.xamlShows playlist navigation and actions from search results.