How to get counts and a summary listing of a matching term over multiple matched documents

Take a look at Script: Search results with context.

It doesn’t include count of matches but this could be added.