Skip to main content

Function: browseFacetedHandler()

browseFacetedHandler(c, params): Promise<{ 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; }>

Defined in: src/api/handlers/xrpc/graph/browseFaceted.ts:55

Handler for pub.chive.graph.browseFaceted query.

Parameters

c

Context<ChiveEnv>

Hono context with Chive environment

params

Validated faceted browse parameters

cursor

string = ...

Pagination cursor for next page.

energy

string[] = ...

limit

number = ...

Maximum items to return.

matter

string[] = ...

personality

string[] = ...

space

string[] = ...

time

string[] = ...

Returns

Promise<{ 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; }>

Matching preprints with available facet refinements

Remarks

PMEST Facets:

  • Personality: Discipline/subject (e.g., "physics", "biology")
  • Matter: Material/substance (e.g., "graphene", "protein")
  • Energy: Process/action (e.g., "synthesis", "analysis")
  • Space: Location/geography (e.g., "arctic", "laboratory")
  • Time: Time period/era (e.g., "2020s", "prehistoric")

Example

GET /xrpc/pub.chive.graph.browseFaceted?personality=physics&energy=simulation

Response:
{
"preprints": [...],
"facets": {
"matter": [{ "value": "graphene", "count": 15 }, ...],
"space": [{ "value": "laboratory", "count": 42 }, ...]
},
"total": 150
}