Fix search in shared files stable7

@icewind1991 @PVince81 @schiesbn backport of https://github.com/owncloud/core/pull/10048 to stable7, a fix for #10009