If there is more than one page of results when doing a query with the MediaWiki API, wikibase:apiOrdinal resets for each page.
This query, for example, returns 10 rows with ?num set to 0:
SELECT * WHERE {
SERVICE wikibase:mwapi {
bd:serviceParam wikibase:api "Search" .
bd:serviceParam wikibase:endpoint "www.wikidata.org" .
bd:serviceParam mwapi:srsearch "test" .
?title wikibase:apiOutput mwapi:title .
?num wikibase:apiOrdinal true .
}
} order by ?num limit 10