Cross-resource search palette (Cmd+K / Ctrl+K / "/") for Polysource — Linear / Notion-style fastest-path navigation.
Part of the Polysource monorepo. MIT-licensed.
SearchResultVO +SearchProviderInterface(3 methods: id / label / search with deadline contract).SearchAggregator— fan-out across tagged providers with 3 contention layers:- per-provider limit
- total budget 250 ms
- try/catch isolation per provider
ResourceSearchProvider— default impl wrapping any Polysource Resource viaDataSource::search().SearchController— JSON endpointGET /admin/search?q=….SearchExtensionTwig (polysource_search_palette()).- Stimulus
cmdk_controller.js— Cmd+K / Ctrl+K / "/" hooks, debounce 150 ms, arrow-keys + Enter nav, Esc close, results grouped per resource. - Accessible overlay template
_palette.html.twig.
See ADR-023. Future bridges (search-meilisearch, search-algolia, search-elasticsearch) extend via SearchProviderInterface.
SearchProviderInterface is 3 methods (getId / getLabel / search). To plug Algolia, Elasticsearch, your custom service into the Cmd+K palette:
#[AutoconfigureTag('polysource.search.provider')]
final class AlgoliaSearchProvider implements SearchProviderInterface
{
public function getId(): string { return 'algolia:products'; }
public function getLabel(): string { return 'Products (Algolia)'; }
public function search(string $query, int $limit, float $deadline): array
{
// Respect the deadline; the aggregator enforces a 250ms global budget.
}
}Done. The aggregator fan-outs across every tagged provider. See extensibility map.
composer require polysource/searchRegister the bundle:
return [
Polysource\Search\PolysourceSearchBundle::class => ['all' => true],
];