Add a search provider
Make a slice findable in the ⌘K palette by implementing one interface. The backend fans queries out to every provider in parallel and merges the ranked lanes.
Implement ISearchProvider
csharp
public sealed class ProjectSearchProvider : ISearchProvider
{
public string Key => "projects"; // stable; also names the admin toggle
public async Task<IEnumerable<SearchHit>> SearchAsync(SearchContext ctx, string term, CancellationToken ct)
{
if (!ctx.Can(ProjectPermissions.Read)) return []; // scope to the current user
var t = term.ToLower();
return await ctx.Db.Set<Project>().AsNoTracking()
.Where(p => p.Name.ToLower().Contains(t)) // case-insensitive
.Take(5)
.Select(p => new SearchHit("projects", p.Name, $"/projects/{p.Id}", icon: "folder"))
.ToListAsync(ct);
}
}Register it
Register via the slice's IServiceRegistrar so it's discovered automatically.
Add the admin toggle
Co-locate an ISettingsContributor registering SearchProviderSettings.EnabledKey(Key) — a Search.{Key} App-scoped bool (default true). Admins can then switch the lane on/off from /admin/settings, and SearchService skips a provider whose toggle is off.
That's it — the palette aggregates your lane, permission-scoped and ranked, with no central registry to edit. See Command palette & search.