import type { ItemBadge, REDOCLY_ROUTE_RBAC } from '@redocly/config'; import type { CollectionFieldSchema } from 'typesense/lib/Typesense/Collection'; import type { FacetCountsRequestParams, SearchRequestParams, SearchResponse } from '../../../types/index.js'; import type { ProductConfig } from '@redocly/theme/config'; import type { SearchFacet, SearchFacetCount, OperationParameter } from '@redocly/theme/core/types'; import type { ExportHandler } from 'flexsearch'; import type { AuthDetails } from '../../types'; import type { SEARCH_DOCUMENT_METADATA_KEY } from '../../constants/plugins/search'; export type SearchEngineType = 'flexsearch' | 'typesense'; export type SearchEngine = { addDocuments(documents: SearchDocument[], params: AddDocumentsParams): Promise; search(params: SearchRequestParams): Record; exportDocuments(outDir: string, facets: Map): Promise; exportIndexes(outDir: string, facets: Map): Promise; import(sourceDir: string): Promise; countFacets(params: FacetCountsRequestParams, facets: Map): Record | object; }; export type SearchDocumentMetadata = Partial<{ includes: string[]; excludes: string[]; curated: boolean; }>; export type SearchParameters = { auth: AuthDetails; query: string; offset: number; groupFacetField?: string; product?: string; versions?: string[]; }; export type SearchIndex = { add(document: SearchDocument): void; search(params: SearchParameters): Promise; export(handler: ExportHandler): void; import(searchData: FlexSearchData): void; clearDocuments(): void; }; export type AddDocumentsParams = { group: string; locale: string; outDir: string; }; export type FlexSearchData = { documents: [number, SearchDocument][]; index: Record; }; export type TypesenseSearchData = { documents: SearchDocument[]; schemaFields: CollectionFieldSchema[]; }; export type AiSearchDocument = { url: string; fsPath: string; content: string; title: string; locale: string; product?: string; facets?: Record; }; export type SearchDocument = { id: string; url: string; title: string | string[]; text: string | string[]; path?: string[]; httpMethod?: string; httpPath?: string | string[]; deprecated?: boolean; security?: string[]; parameters?: OperationParameter[]; version?: string; versionFolderId?: string; isDefaultVersion?: boolean; isAdditionalOperation?: boolean; product?: ProductConfig; 'redocly::teams-rbac'?: { [x: string]: string; }; [REDOCLY_ROUTE_RBAC]?: { slug?: string; fsPath?: string; }; badges?: ItemBadge[]; facets?: Record; tags?: string[]; rbacTeams?: string[]; [SEARCH_DOCUMENT_METADATA_KEY]?: SearchDocumentMetadata; }; export type TypesenseSearchDocument = Omit & { metadata_curated?: boolean; metadata_keywords_includes?: string[]; metadata_keywords_excludes?: string[]; }; //# sourceMappingURL=search.d.ts.map