From c21ea3d715c9e098f09b5086d89fd5c67fa762e1 Mon Sep 17 00:00:00 2001 From: RTHilton Date: Wed, 12 Mar 2025 13:52:40 -0700 Subject: [PATCH] Enable tag searching in model metadata Added the ability to search for tags (exact, case-insensitive) using the # operator. For example: #celebrity will return all models with the Celebrity tag #celebrit will return nothing --- .../ViewModels/CheckpointsPageViewModel.cs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/StabilityMatrix.Avalonia/ViewModels/CheckpointsPageViewModel.cs b/StabilityMatrix.Avalonia/ViewModels/CheckpointsPageViewModel.cs index a1c6a68c..8f24a6e0 100644 --- a/StabilityMatrix.Avalonia/ViewModels/CheckpointsPageViewModel.cs +++ b/StabilityMatrix.Avalonia/ViewModels/CheckpointsPageViewModel.cs @@ -213,6 +213,15 @@ protected override async Task OnInitialLoadedAsync() (Func)( file => string.IsNullOrWhiteSpace(SearchQuery) + || ( + SearchQuery.StartsWith("#") + && ( + file.ConnectedModelInfo?.Tags.Contains( + SearchQuery.Substring(1), + StringComparer.OrdinalIgnoreCase + ) ?? false + ) + ) || file.DisplayModelFileName.Contains( SearchQuery, StringComparison.OrdinalIgnoreCase