@Override
 public void writeTo(StreamOutput out) throws IOException {
   super.writeTo(out);
   out.writeBoolean(valid);
   out.writeOptionalString(explanation);
   out.writeOptionalString(error);
 }
 @Override
 public void writeTo(StreamOutput out) throws IOException {
   super.writeTo(out);
   out.writeInt(numDocs);
   out.writeInt(termsList.size());
   for (TermInfo ti : termsList) ti.writeTo(out);
 }
 @Override
 public void readFrom(StreamInput in) throws IOException {
   super.readFrom(in);
   valid = in.readBoolean();
   explanation = in.readOptionalString();
   error = in.readOptionalString();
 }
 @Override
 public void readFrom(StreamInput in) throws IOException {
   super.readFrom(in);
   numDocs = in.readInt();
   int n = in.readInt();
   termsList = new ArrayList<>();
   for (int i = 0; i < n; i++) {
     TermInfo ti = new TermInfo();
     ti.readFrom(in);
     termsList.add(ti);
   }
 }