Adding weight field for the weight.

@rbran100 New PR against #5738.