whatsapp has e2e encrypted messages and searching works fine.
Realtime collaboration — assuming you use CRDTs — can be achieved with e2e encryption as well, with backend acting like a mere router of requests.