Search by

The search: endpoints of Orion as a PSR-15 middleware: the manifest's declared routes served through the scoped searcher, RFC 9457 problems, a request-scoped tenant resolver

Package info

github.com/univeros/orion.psr15

pkg:composer/orion-search/psr15

Statistics

Installs: 0

Dependents: 1

Suggesters: 0

Stars: 0

Open Issues: 0

dev-main / 1.0.x-dev 2026-10-27 18:15 UTC

This package is auto-updated.

Last update: 2026-10-27 19:15:57 UTC


README

The search: endpoints of Orion as a PSR-15 middleware. Each search block in a manifest declares a route; the middleware serves it through the scoped searcher and answers failures as RFC 9457 problems.

composer require orion-search/psr15
use Orion\Psr15\SearchMiddleware;

$middleware = new SearchMiddleware(
    $graph->manifest(),
    $graph->searcher(),
    $responseFactory,     // PSR-17
    $streamFactory,       // PSR-17
    $authorizer,          // optional: checks the permission an endpoint declares
    $logger,              // optional
    prefix: '/api',       // where the host mounts the routes
);

A GET endpoint reads its query string, a POST endpoint a JSON body, with the same keys: q, filter, sort, page, size, and vector on a hybrid endpoint. A request may only name what the endpoint declares, and only these keys: any other parameter (a tracking tag, a cache buster) is a 400, so a typo never silently drops a filter.

Failure Status Problem type
no tenant in the request 401 no-tenant
the permission the endpoint declares is missing 403 forbidden
input that does not fit the endpoint or the schema 400 invalid-request
a clause the engine cannot run, a page past the window 400 unsupported-clause
a declared path with another method 405 method-not-allowed
configuration that does not fit, an engine failure 500 search-failed (logged)

RequestTenant is a request-scoped tenant resolver for hosts without Polaris: a middleware that reads the tenant from the request (an attribute the host's authentication set) and the TenantResolver Orion is configured with.

Declaring endpoints and calling them: the Frameworks guide.