Sort correctly by folder content in search