Search Engine Library

The documentation is constantly evolving and updated alongside the project's progress. Since it is developed in parallel with the code, some sections may temporarily refer to earlier versions of the system-these are gradually adapted to the current state of the application. If you notice any outdated information, please report it or open an Issue / Pull Request.

Documentation

# Search Engine Library

DbM\SearchEngine is a standalone provider-based search aggregation library maintained with DBM Platform. It coordinates searches across application-specific content sources without coupling the core service to a particular database schema. Providers contain the source-specific query and pagination logic.

# Search flow

  1. Build a SearchContext with the query, page, limit, filters, and optional section names.
  2. Pass it to SearchService::search().
  3. The service skips providers that do not support every non-empty requested filter, and skips providers outside the selected sections.
  4. Each eligible SearchProviderInterface returns a SearchSectionResult. Empty sections are omitted; the remaining sections and their totals are combined in an AggregateResult.

Implement a provider's unique name, display label, supported filter list, and search() method. The provider is responsible for querying its own source and honoring the context's pagination (offset() is available). SearchResultDto is a convenient result shape with provider, identifier, title, description, optional route and route parameters, and creation time; providers can also return their own item type.

SearchForm provides request-facing helpers: it trims and bounds query length, records query errors, extracts filters, and validates supported date and status formats. Applications should inspect getErrors() and apply their own authorization and domain-specific validation before returning results.

$context = new SearchContext(
    query: $query,
    page: $page,
    limit: 20,
    filters: $filters,
    sections: ['articles', 'products'],
);

$results = $searchService->search($context);

The library has no built-in database or search-index adapter: providers connect it to application data. Its source describes future Elasticsearch and advanced ranking as possible extensions, not as current built-in capabilities. This library is proprietary and subject to the DBM Platform license.