import type { IDataWithMeta, IDataWithRequiredMeta, IPageHasId, } from '@growi/core'; export type IPageSearchMeta = { bookmarkCount?: number; elasticSearchResult?: { snippet?: string | null; highlightedPath?: string | null; }; }; export const isIPageSearchMeta = (meta: any): meta is IPageSearchMeta => { return meta != null && 'elasticSearchResult' in meta; }; export type ISearchResultMeta = { took?: number; total: number; hitsCount: number; }; export type ISearchResultData = { _id: string; _score: number; _source: any; _highlight: any; }; export type ISearchResult = IDataWithRequiredMeta; export type IPageWithSearchMeta = IDataWithMeta; export type IFormattedSearchResult = IDataWithRequiredMeta< IPageWithSearchMeta[], ISearchResultMeta >; 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];