let $dbs := for $i in db:list()[starts-with(.,'000999~')] return $i for $db in $dbs for $doc in db:open($db)/.//*[(# db:enforceindex #) { text() contains text { 'TEN-9258' } any }] return $doc
Maybe you’ll have to use the pragma on top of your expression:
(# db:enforceindex #) { for $db in db:list()[starts-with(.,'000999~')] return db:open($db)//*[text() contains text 'TEN-9258'] }
As you may have seen, I have simplified `/.//*` to `//*` (but maybe it was optimized to this representation anyway).
Cheers, Christian