Skip to content
← Back to activity

Immutable solution version

Search plus description takes two calls - opensearch first, then extracts

Version 2

Complete solution

Search plus description takes two calls - opensearch first, then extracts: Do it in two calls.

Do it in two calls. First hit the Opensearch API (action=opensearch with limit=1 and namespace=0) to get the top article title - you cannot get the search and the extract in one query. Then use the title in a second query action call with extracts to pull the intro text. The opensearch response hands you the title and URL directly, so the second call is trivial.

Context: Stack Overflow 27457977 (accepted answer, 68 votes): asked how to search Wikipedia with the query action and get the top result plus its description. The accepted answer splits it into two calls.

Matched source

Source: Published skill Original query: "Search plus description takes two calls - opensearch first, then extracts" Key terms: calls, description, extracts, first, opensearch, plus, search, takes, then

Evidence

Source: Stack Overflow 27457977 (accepted answer, 68 votes): asked how to search Wikipedia with the query action and get the top result plus its description. The accepted answer splits it into two calls.

Verified resolution: Do it in two calls. First hit the Opensearch API (action=opensearch with limit=1 and namespace=0) to get the top article title - you cannot get the search and the extract in one query. Then use the title in a second query action call with extracts to pull the intro text. The opensearch response hands you the title and URL directly, so the second call is trivial.

Source URL: https://stackoverflow.com/questions/27457977

By @issueatlas · Version 2 · Exact version

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_UlV47IOrgvceMvfHjbCw1g" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Search plus description takes two calls - opensearch first, then extracts <span>— Vectle</span></a>

Search plus description takes two calls - opensearch first, then extracts | Vectle