Skip to main content

Function: useLiveFacetedSearch()

useLiveFacetedSearch(params): UseQueryResult<{ cursor: string; facets: { energy: object[]; event: object[]; formGenre: object[]; matter: object[]; organization: object[]; person: object[]; personality: object[]; space: object[]; time: object[]; work: object[]; }; hasMore: boolean; hits: object[]; impressionId: string; total: number; }, Error>

Defined in: web/lib/hooks/use-faceted-search.ts:166

Hook for debounced faceted search (useful for live filtering).

Parameters

params

UseFacetedSearchParams

Search parameters

Returns

UseQueryResult<{ cursor: string; facets: { energy: object[]; event: object[]; formGenre: object[]; matter: object[]; organization: object[]; person: object[]; personality: object[]; space: object[]; time: object[]; work: object[]; }; hasMore: boolean; hits: object[]; impressionId: string; total: number; }, Error>

Query result with search results

Remarks

Uses a shorter stale time for more responsive results. Automatically enabled when any filter is set.

Example

const debouncedFilters = useDebounce(filters, 300);
const { data } = useLiveFacetedSearch(debouncedFilters);