For a pet accident like vomit or urine, a mixture of baking soda and vinegar does a great job.
Clean up the vomit and then use a wet rag to remove as much liquid as possible. Pour a thin coating of baking soda over the area to absorb the liquid and odor. You can also work the baking soda into the carpet by hand.
Now mix white vinegar and warm water together in a spray bottle and spray the baking soda. The vinegar and baking soda will interact to help loosen particles and stains.
Let the area dry and then rinse with warm water.
Vinegar is a disinfectant, it has antibacterial properties and removes many household odors.
Vinegar works well on most surfaces. I would start with a 50-50 mix with warm water and test a hidden spot if you are worried about colorfastness.
Do not use vinegar on stone, marble or travertine.