Skip to main content

Function: useFacetedSearch()

useFacetedSearch(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:70

Performs a 10-dimensional faceted search across PMEST and FAST dimensions.

Parameters

params

UseFacetedSearchParams

Search parameters including facet filters

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 and facet counts

Remarks

Uses TanStack Query with a 30-second stale time. Returns both results and facet counts for refinement.

The 10 dimensions are:

  • PMEST: Personality, Matter, Energy, Space, Time
  • FAST: Person, Organization, Event, Work, Form-Genre

Example

const { data, isLoading } = useFacetedSearch({
matter: ['computer-science'],
energy: ['classification'],
limit: 20,
});

if (data) {
console.log(`Found ${data.total} results`);
console.log('Available facets:', data.facets);
}