How to know the number of terms in query string matched

Hello everyone.
The term splited from query string are the same to each other in my querying.
i just want to know how many term matched to a document.
i dont need es score. i will caculate the score myself with the count of matched term in script score.

for example: the word "iphone 5s" will splited into two words: "iphone" "5s"
in my scoring script, i may know the number of matched term are 2, 1 or 0.
then i will caculate the score like: N * 30 + other_score;

can this be possible?

i dont know how to get the number of matched term to one doc.
i now just think of constant_score that would implement this.