An infestation of small black flies in a house is usually caused by:
1. Most commonly, that your kitchen drain pipe has separated under the
floor and is spilling solids into the crawl space under your floor.
Flies will lay their eggs in that accumulation of soft solid material
and you'll have a continuous source of new flies infesting your house
2. Not taking out your garbage often enough and "fruit" flies laying the
eggs in the soft solids in the garbage can (like apple or banana peels
or discarded animal tissue). So every three weeks you get a new batch
of the little critters emerging from 8 or 9 week old garbage.
I've had this happen to me twice where a tenant in a bottom floor suite
would come to me and ask me to do something about the small flies in his
apartment. In both cases I tell them it's because they're not taking
their garbage out often enough, but in both cases it turned out to be a
separated kitchen drain pipe.
The solids that do down the kitchen drain pipe are just the kind of soft
nutritious stuff that flies look for to lay their eggs in so the maggots
that develop are surrounded by food when they start becoming active.