Fixes text search and select for "secured" documents

Fixes #2663.