Encapsulation is your friend on this occasion.
Do you know the fibre type? If its synthetic then you could use Chemspec Enzyme Carpet Shampoo which is the fastest I have found when there are lots of food spots.
If its wool there are Woolsafe Approved products such as Chemspec Formula 161 or Prochem Procaps alternatively there are Encap products that will also prove effective.
The key will be the right level of agitation. Shampoo brush, bonnets, agitation pads (synthetic for cut or loop pile, microfibre for cut pile)
We have many customers using these methods for this type of work with great success.
Happy to discuss further if you like.