Example #1
0
 @Override
 public void writeTo(StreamOutput out) throws IOException {
   out.writeVInt(suggestions.size());
   for (Suggestion command : suggestions) {
     command.writeTo(out);
   }
 }
Example #2
0
 @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;
 }
Example #3
0
 @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);
   }
 }