Skip to content

Search

ORCID exposes one Solr index through two routes, and both live on client.records. The Solr route (/search/) answers one identifier per hit through search(), iterate(), collect(), first(), and count(), all typed SolrResult. The expanded route (/expanded-search/) answers profile fields per hit through expanded_search() and iterate_expanded(), both typed ExpandedResult. Every entry point requires a non-blank query and raises ConfigurationError without one. The rows and start parameters of the API map to the bibliofabric paging arguments: page_size sets the page size, and page turns into a zero-based offset; see paging for the shared operations. The snippets of this page run top to bottom with top-level await, and the first block creates the client every later block reuses.

Search identifiers only

/search/ answers one orcid-identifier per result and no profile fields, so it costs less per page when you only need iDs.

from bibliofabric.orcid import OrcidClient

client = OrcidClient()

page = await client.records.search(query="family-name:Hickey", page_size=5)
print(page.total, "solr results")
for result in page.results:
    print("   ", result.orcid_identifier.path)
520 solr results
    0000-0003-4544-3254
    0000-0001-8266-8597
    0000-0002-3030-4289
    0000-0001-9199-3316
    0000-0001-7692-3061

first() returns the first match or None, and count() returns the total in one request.

found = await client.records.first(query="Turing")
print(found.orcid_identifier.path)

print(await client.records.count(query="family-name:Hickey"), "via count()")
0000-0002-0185-5110
520 via count()

collect() gathers results into a list up to limit, and iterate() walks pages until limit records are read.

results = await client.records.collect(query="family-name:Hickey", limit=7)
print(len(results), "collected;", [r.orcid_identifier.path for r in results])

async for result in client.records.iterate(
    query="family-name:Hickey", page_size=10, limit=10
):
    print("iterated", result.orcid_identifier.path)
7 collected; ['0000-0003-4544-3254', '0000-0001-8266-8597', '0000-0002-3030-4289', '0000-0001-9199-3316', '0000-0001-7692-3061', '0000-0002-0360-5975', '0000-0001-5584-9528']
iterated 0000-0003-4544-3254
iterated 0000-0001-8266-8597
iterated 0000-0002-3030-4289
iterated 0000-0001-9199-3316
iterated 0000-0001-7692-3061
iterated 0000-0002-0360-5975
iterated 0000-0001-5584-9528
iterated 0000-0002-1503-935X
iterated 0000-0003-1889-8114
iterated 0000-0001-6018-9915

The client caps page_size at 100, the dialect maximum, before it sends a request.

Search expanded profiles

expanded_search() answers one expanded profile per result: names, credit name, other names, emails, and institutions.

page = await client.records.expanded_search(
    query="family-name:Hickey", page_size=5, page=2
)
print("total:", page.total, "| page:", page.page)
for result in page.results:
    print(
        "   ",
        result.orcid_id,
        result.given_names,
        result.family_names,
        result.institution_name,
    )
total: 520 | page: 2
    0000-0001-8323-5187 Jean-Pierre Hickey []
    0000-0001-5659-1813 Terry Hickey []
    0000-0002-3278-4933 Gary Hickey []
    0000-0002-3653-953X Molly Hickey []
    0000-0002-3487-1643 Zachary Hickey []

institution_name is a list, and many records carry none. A page past the total answers an empty result list with the total intact. The same 100-row cap applies, and iterate_expanded() walks pages the same way.

async for result in client.records.iterate_expanded(
    query="family-name:Hickey", page_size=10, limit=10
):
    print("iterated", result.orcid_id)
iterated 0000-0003-4544-3254
iterated 0000-0001-8266-8597
iterated 0000-0002-3030-4289
iterated 0000-0001-9199-3316
iterated 0000-0001-7692-3061
iterated 0000-0002-0360-5975
iterated 0000-0001-5584-9528
iterated 0000-0002-1503-935X
iterated 0000-0003-1889-8114
iterated 0000-0001-6018-9915

Download CSV

csv() queries the same index and returns CSV text with a header row. select picks the columns through the fl parameter; without it ORCID answers its nine default columns (orcid, email, given-names, family-name, given-and-family-names, current-institution-affiliation-name, past-institution-affiliation-name, credit-name, other-names). page_size sets the row count and offset the zero-based start row. A page_size above 100 raises ConfigurationError before any request is sent, because a larger page makes Solr fail with HTTP 500.

from bibliofabric.exceptions import ConfigurationError

csv_text = await client.records.csv(
    "family-name:hickey",
    select=["orcid", "given-names", "family-name"],
    page_size=5,
)
for line in csv_text.splitlines()[:3]:
    print("   ", line)

try:
    await client.records.csv("family-name:hickey", page_size=101)
except ConfigurationError as error:
    print("rejected:", error)
    orcid,given-names,family-name
    0000-0003-4544-3254,Delia,Hickey
    0000-0001-8266-8597,Brice,Hickey
rejected: page_size above 100 makes the ORCID CSV search fail with HTTP 500, got 101.

Query syntax

The query is a Solr query string over indexed fields: family-name:Kucsko, given-names:Georg, text-and-title:magnetic, doi:10.1088/..., and so on. A plain word searches the default fields. An unknown field name makes the server answer HTTP 500 rather than a validation error, so quote field values and check spellings before paging through results.