@Override public void writeTo(StreamOutput out) throws IOException { out.writeVInt(suggestions.size()); for (Suggestion command : suggestions) { command.writeTo(out); } }
@Override public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException { builder.startObject(Fields.SUGGEST); for (Suggestion suggestion : suggestions) { suggestion.toXContent(builder, params); } builder.endObject(); return null; }
@Override public void readFrom(StreamInput in) throws IOException { int size = in.readVInt(); suggestions = new ArrayList<Suggestion>(size); for (int i = 0; i < size; i++) { Suggestion suggestion = new Suggestion(); suggestion.readFrom(in); suggestions.add(suggestion); } }