Skip to main content

Function: usePreprintSearch()

usePreprintSearch(query, options): object

Defined in: web/lib/hooks/use-preprint-search.ts:322

Hook for federated preprint search across external sources.

Parameters

query

string

Search query

options

UsePreprintSearchOptions = {}

Search options

Returns

object

Search results with facets

error

error: null | Error = result.error

facets

facets: undefined | { sources: Record<string, number>; } = result.data.facets

isFetching

isFetching: boolean = result.isFetching

isLoading

isLoading: boolean = result.isLoading

preprints

preprints: readonly ExternalPreprint[]

refetch()

refetch: (options?) => Promise<QueryObserverResult<SearchPreprintsResponse, Error>> = result.refetch

Parameters

options?

RefetchOptions

Returns

Promise<QueryObserverResult<SearchPreprintsResponse, Error>>

Remarks

Performs federated search across all configured sources:

  • arXiv, OpenReview, PsyArXiv (real-time API search)
  • LingBuzz, Semantics Archive (local index search)

Results include source facets for filtering UI.

Example

const { preprints, facets, isLoading } = usePreprintSearch('attention mechanism', {
sources: 'arxiv,openreview',
limit: 20,
});

return (
<>
<SourceFacets facets={facets} />
<PreprintList preprints={preprints} isLoading={isLoading} />
</>
);