UNPKG

@kit-data-manager/react-search-component

Version:

All-in-one component for rendering an elastic search UI for searching anything. Built-in support for visualizing related items in a graph and resolving unique identifiers.

32 lines (31 loc) 1.23 kB
import type { ResponseState } from "@elastic/search-ui"; import type ElasticsearchAPIConnector from "@elastic/search-ui-elasticsearch-connector"; import { SearchConfig } from "../lib/config/SearchConfig"; /** * Extends the elasticsearch SearchContext with additional utilities */ export interface ReactSearchComponentContext { /** * Search for the specified string and scroll to the top of the page. This will change the * search term to `query` and clear all filters * @param query */ searchFor: (query: string) => void; /** * Will query the elastic backend for the specified search term in the background. The UI is * not affected by this. * @param query * @return May return undefined if the elastic connector is not reachable (`SearchProvider` not mounted) */ searchForBackground: (query: string) => Promise<ResponseState | undefined>; /** * The current search term */ searchTerm: string; elasticConnector?: ElasticsearchAPIConnector; config: SearchConfig; } /** * Extends the elasticsearch SearchContext with additional utilities */ export declare const ReactSearchComponentContext: import("react").Context<ReactSearchComponentContext>;