perf(search): prefix-by-default Deployments and config-audit search; bounded Contains opt-in (ScadaBridge#50)

Deployments free-text search and the config-audit EntityName filter no longer
emit LIKE '%term%' by default. Prefix (LIKE 'term%') is the default; substring
is an explicit opt-in (DeploymentSearchMode.Contains / entityNameContains)
always bounded by a DeployedAt/Timestamp window (explicit, else 30 days).
Migration PrefixSearchIndexes adds DeployedBy, RevisionHash and EntityName
indexes. Deployments page gains a 'Match anywhere' checkbox.

Claude-Session: https://claude.ai/code/session_01GT67AEHd2Acv1YPwGfXEoV
This commit is contained in:
Joseph Doherty
2026-11-09 15:42:56 -05:00
parent 0ce6633270
commit 47f3a703bf
15 changed files with 2620 additions and 44 deletions
@@ -75,6 +75,15 @@
data-test="deploy-search"
value="@_searchInput"
@oninput="OnSearchInput" />
<div class="form-check mt-1">
<input id="dep-search-contains" type="checkbox" class="form-check-input"
data-test="deploy-search-contains"
checked="@_searchContains"
@onchange="SetSearchContainsAsync" />
<label class="form-check-label small text-muted" for="dep-search-contains">
Match anywhere in the text (last 30 days only; default matches the start)
</label>
</div>
</div>
<div class="col-auto">
<button class="btn btn-outline-secondary btn-sm" data-test="deploy-clear-filters"
@@ -522,6 +531,19 @@
}
}
/// <summary>
/// Opt-in substring search. Scans, so the repository bounds it to the last 30 days
/// (ScadaBridge#50); the default is an index-friendly prefix match.
/// </summary>
private bool _searchContains;
private async Task SetSearchContainsAsync(ChangeEventArgs e)
{
_searchContains = e.Value is true;
_currentPage = 1;
await LoadDataAsync();
}
private async Task SetStatusFilterAsync(DeploymentStatus? status)
{
// Clicking the active tile clears it — a toggle, so the tiles are both the
@@ -536,6 +558,7 @@
_statusFilter = null;
_searchInput = string.Empty;
_appliedSearch = string.Empty;
_searchContains = false;
_currentPage = 1;
// A cleared box must not be re-queried by an armed keystroke timer.
@@ -587,7 +610,8 @@
var filter = new DeploymentListFilter(
Status: _statusFilter,
Search: _appliedSearch,
SiteIdScope: siteScope);
SiteIdScope: siteScope,
SearchMode: _searchContains ? DeploymentSearchMode.Contains : DeploymentSearchMode.Prefix);
var page = await DeploymentManagerRepository
.QueryDeploymentListPageAsync(filter, pageToQuery, PageSize);