Rewrite write() to not user ResultDocSet.