API:Page info in search results

It's useful to show users context when presenting Wikipedia search results.

When you search in the Wikipedia mobile apps, as you type they show a drop-down list of matching terms. They also show the lead image for the article and a description of it.

The lead image comes from Extension:PageImages, which adds a page_image property to pages giving its guess as to an appropriate image for the page. The description comes from Wikidata, which maintains a localized description of the subject of each wiki page.

A slow way to do this would be to query for pages matching what the user types, then make an API  request for the   property of the set of titles, and make another API query to wikidata.org requesting the Wikidata description. This works but involves multiple API queries.

How it works on Wikimedia wikis
Instead, WMF added an extension to each wiki that allows you to query for the page info https://en.wikipedia.org/wiki/Special:ApiSandbox#action=query&prop=pageterms&format=json&titles=Albert_Einstein

Furthermore, you can use a prefixsearch as a generator for query results. Instead of getting a set of page titles – Albert_Einstein|Albert_Edward, Prince of Wales|Albert_Elllis – and then passing this to a query, you can get the properties of the results of another query, in a single API request. ...

How it works in the MediaWiki code
When MediaWiki writes a change to the RecentChanges page, it also calls. The lets you configure different kinds of recent changes feeds, with different kinds of formatting. includes/rcfeed in core has their implementation. If you run a wiki of your own and would like to adapt these visualizations and monitors to it, you can enable similar feeds to a similar client that publishes changes over WebSockets or on an IRC channel. As usual, all aspects of WMF's setup are free and open source.

Going beyond
The Wikipedia mobile applications use face detection to show a better part of the image...

Alternatives
As an alternative, the Hovercards extension (Popups) uses the TextExtracts extension to show the lead information about an article from the local wiki.