Skip to main content
Search for concepts by text. The SDK normalises three possible server response shapes ({ concepts: [...] }, legacy { data: [...] }, bare Concept[]) into a stable SearchResult - data.concepts is always a Concept[]:

Parameters

Filter Combinations

Autocomplete

Get compact suggestions as the user types. The response is { query, suggestions: [...], page_size }; each entry contains the matched suggestion, its type, and the number of matching concepts.
Autocomplete returns grouped typeahead values, not concept records. Use basic search when you need concept IDs and other concept metadata.

Pagination

Manual Pagination

Auto-Pagination Iterator

basicIter is an async generator that walks every page and yields one concept at a time:
Async iterators throw OMOPHubIteratorError on page failure (generators can’t gracefully yield discriminated errors). Use the eager basicAll(...) variant if you prefer accumulating errors as values. See Error Handling.

Eager Collect

POST-based search with relationship filters:

Advanced Search Parameters

Relationship Filters

Embedding-based natural-language search. The SDK normalises the response so data.results is always a populated array:
With filters:

Semantic Search Parameters

Semantic Search Iterator

Run up to 50 keyword searches in a single API call:
The per-search entries (BulkBasicSearchInput) use snake_case keys (search_id, vocabulary_ids, domain_ids, page_size) - they’re a direct pass-through of the API payload, not a camelCase options object. The outer defaults object follows the same convention. This is the only place in the SDK where snake_case appears at the TypeScript surface.

Bulk Basic Parameters

Up to 25 semantic searches per call:

Find Similar Concepts

Find concepts similar to a reference. Provide exactly one of conceptId, conceptName, or query. The discriminated union enforces this at the type level; a runtime check defends against JS callers:
similar() uses a two-arg signature similar(options, requestOptions?) - its query XOR variant would otherwise collide with PerCallOptions.query (the escape-hatch params record). Pass signal, headers, or idempotencyKey via the second argument.

Similar Concepts Parameters

includeInvalid: true is supported only with algorithm: 'lexical'. The embedding index contains valid concepts only, so combining it with semantic or hybrid returns a 400 naming the combination rather than silently ignoring the filter.

Pagination

Pagination arrives in the response envelope, alongside data:
total_candidates counts the concepts that cleared similarityThreshold inside a bounded candidate pool — not the concepts evaluated. It and the pagination totals may therefore be lower bounds — data.search_metadata.totals_are_lower_bound says when. Reachable depth is bounded at roughly 500 / pageSize pages — the pool is a constant 500 candidates, so a score never changes with pageSize; a page past the end returns an empty array with has_next: false, not an error.

Result Fields

Algorithm Comparison

hybrid fuses both signals as 0.7 × semantic + 0.3 × lexical. Every candidate is scored by that rule, with a signal neither retrieval established counting as 0. So a concept sharing no words with the query keeps only 0.7 × its semantic score, and one the embedding search did not return keeps only 0.3 × its lexical score — capping it at 0.3. Hybrid scores sit on a different scale from both semantic and lexical scores, and the same similarityThreshold is stricter than in either. Lower the threshold for hybrid, use semantic for conceptual matches that share no vocabulary, or use lexical for exact name and code matches: hybrid is not a superset of the other two. If the embedding service is unavailable it serves its lexical half and reports algorithm_used: 'lexical' with degraded_from: 'hybrid' rather than failing.