| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 |
- 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<T> = IDataWithRequiredMeta<T[], ISearchResultMeta>;
- export type IPageWithSearchMeta = IDataWithMeta<IPageHasId, IPageSearchMeta>;
- 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];
|