import { IPageWithMeta } from './page'; export type IPageSearchMeta = { bookmarkCount?: number, elasticSearchResult?: { snippet: string; highlightedPath: string; isHtmlInPath: boolean; }; } // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/explicit-module-boundary-types export const isIPageSearchMeta = (meta: any): meta is IPageSearchMeta => { return meta != null && 'elasticSearchResult' in meta; }; export type ISearchResult = ISearchResultMeta & { data: T[], } export type ISearchResultMeta = { meta: { took?: number total: number hitsCount: number }, } export type IFormattedSearchResult = ISearchResult>; export const SORT_AXIS = { RELATION_SCORE: 'relationScore', CREATED_AT: 'createdAt', UPDATED_AT: 'updatedAt', } as const; export type SORT_AXIS = typeof SORT_AXIS[keyof typeof SORT_AXIS]; export const SORT_ORDER = { DESC: 'desc', ASC: 'asc', } as const; export type SORT_ORDER = typeof SORT_ORDER[keyof typeof SORT_ORDER];