"I had a nice lunch in that restaurant" is correct, but if you take away the word "nice", you have to take away the "a" as well: "I had lunch in that restaurant. It was very nice."
"I had a lunch there" would mean "an event". Example: Prince Charles said, "I had a lunch at Windsor Castle for Sheik Maktoum al Maktoum."
I had a lunch with John = I held a lunch event together with John (for some clients or to raise funds, etc).
Example: Prince Charles said, "I had a lunch with Mummy at Windsor for the Sultan of Brunei."
It is always "have lunch" if you mean "eat some food at midday".
"Have a lunch" means something entirely different. It means organise, host or hold a lunch event, as in:
"What shall we do to warm up this client?"
"Let's have a lunch."
It means, let's use the device of a lunch and contrive or organise one.
Alternatively, it means a diary engagement:
"Are you free tomorrow for lunch?"
"Let me look at my diary. I already have a lunch tomorrow."
It means you already have a prior lunch appointment.
It's not a matter of statistics.
That's really interesting to see the stats, however in your example the correct sentence is "I had lunch with John." When speaking in general, we tend to say "have lunch" whereas if you are speaking about one lunch in particular (say for example at a certain place, or if you want to describe the lunch), then you could say "have a lunch".
Here are some examples:
Having lunch is the best part of my workday!
Yesterday I had lunch with my best friend.
What time do you usually eat lunch?
I had a really nice lunch at that new restaurant.
The lunch being served at that cafeteria is really expensive.
I usually have an early lunch when I'm at work.