import { PostSearchEntity, TermSearchEntity, QueriedObject } from '../types/index.js'; import { FetchOptions, AbstractFetchStrategy, EndpointParams } from './AbstractFetchStrategy.js'; /** * The EndpointParams supported by the {@link SearchNativeFetchStrategy} */ export interface SearchParams extends EndpointParams { /** * Current page of the collection. * * @default 1 */ page?: number; /** * Maximum number of items to be returned in result set. * * @default 10 */ per_page?: number; /** * Limit results to those matching a string. */ search?: string; /** * Limit results to items of an object type. * * @default 'post' */ type?: 'post' | 'term' | 'post-format'; /** * Limit results to items of one or more object subtypes. */ subtype?: string | string[]; /** * Ensure result set excludes specific IDs. */ exclude?: number[]; /** * Limit result set to specific IDs. */ include?: number[]; } /** * The SearchNativeFetchStrategy is used to fetch search results for a given search query * Uses the native WordPress search endpoint. * * Note that custom post types and custom taxonomies should be defined in `headless.config.js` * * This strategy supports extracting endpoint params from url E.g: * - `/page/2/` maps to `{ page: 2 }` * - `/searched-term/page/2` maps to `{ search: 'searched-term', page: 2 }` * * @see {@link getParamsFromURL} to learn about url param mapping * * @category Data Fetching */ export declare class SearchNativeFetchStrategy extends AbstractFetchStrategy { path: string; locale: string; optimizeYoastPayload: boolean; getDefaultEndpoint(): string; getDefaultParams(): Partial

; /** * This strategy automatically extracts the search term and and pagination params from the URL * * @param path The URL path to extract params from * @param params The params passed to the strategy */ getParamsFromURL(path: string, params?: Partial

): Partial

; /** * Builds the endpoint url for the search endpoint * * @param params The params for the request * @returns */ buildEndpointURL(params: Partial

): string; /** * The fetcher function is overridden to disable throwing if not found * * If a search request returns not found we do not want to redirect to a 404 page, * instead the user should be informed that no posts were found * * @param url The url to parse * @param params The params to build the endpoint with * @param options FetchOptions */ fetcher(url: string, params: Partial

, options?: Partial): Promise<{ queriedObject: QueriedObject; isCached?: boolean; result: T[]; pageInfo: import("../types/index.js").PageInfo; }>; }