/* (non-Javadoc)
  * @see cn.com.rebirth.commons.io.stream.Streamable#writeTo(cn.com.rebirth.commons.io.stream.StreamOutput)
  */
 @Override
 public void writeTo(StreamOutput out) throws IOException {
   out.writeVInt(facets.size());
   for (Facet facet : facets) {
     InternalFacet internalFacet = (InternalFacet) facet;
     out.writeUTF(internalFacet.streamType());
     internalFacet.writeTo(out);
   }
 }
 /* (non-Javadoc)
  * @see cn.com.rebirth.search.commons.xcontent.ToXContent#toXContent(cn.com.rebirth.search.commons.xcontent.XContentBuilder, cn.com.rebirth.search.commons.xcontent.ToXContent.Params)
  */
 @Override
 public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException {
   builder.startObject(Fields.FACETS);
   for (Facet facet : facets) {
     ((InternalFacet) facet).toXContent(builder, params);
   }
   builder.endObject();
   return builder;
 }