import { SearchQuery, SearchResultView } from '@dorfteich/shared'; import { User } from '@prisma/client'; /** * Search behind an interface (ADR 0010, issue #49) so an external engine can * replace the PostgreSQL binding without touching call sites. Bound via DI as an * abstract-class token — a fake implementation can be provided in tests, which * is what proves the seam. `search` receives the requesting user so results are * permission-filtered; scope (pond, labels) lives in the query. */ export abstract class SearchProvider { /** (Re)compute the search entry for one page from its current content. */ abstract indexPage(pageId: string): Promise; /** Drop a page from the index (its cache row is also removed on purge). */ abstract removePage(pageId: string): Promise; /** Ranked, permission-filtered results for `user`. */ abstract search(query: SearchQuery, user: User): Promise; /** Rebuild the whole index from `page_content_cache`; returns rows indexed. */ abstract reindexAll(): Promise; }