private int termMatches(string text, string fieldLabel, string term)
{
RegexOptions flags = RegexOptions.IgnoreCase;
Dictionary<string, string> wordsMatch = _termForms[fieldLabel];
MatchCollection matches;
if (wordsMatch.ContainsKey(term))
{
if (_caseSensitive.ContainsKey(fieldLabel))
{
matches = Regex.Matches(text, term);
}
else
{
matches = Regex.Matches(text, term, flags);
}
return matches.Count;
}
return 0;
}