Fix SQL error when all apps are searchable.
Fix comments.
Merge pull request #4562 from openscholar/4551

Fix SQL error when all apps are searchable.