getVistibleDocuments performance update

Query optimized