(bug 43873) enable continuation in ApiSearchEntities again

The continuation in ApiSearchEntities was disabled when fixing
bug 43858, where the module ran out of memory. This implements
continuation in a different way. It also extends the TermStore
so  that it provides the terms for a number of IDs in a single
go, and to return a fixed number of distinct IDs  and not just
a fixed number of terms per the LIMIT operator.

Change-Id: I28a3d7aca43b841f5bda43a08e4f02db53df3a4a
Merge "(bug 43873) enable continuation in ApiSearchEntities again"