added log into Alphabet service since it can induce a large perf hit

This commit is contained in:
AT
2019-11-16 01:28:07 +02:00
parent dcb9e34d59
commit 9d98d26cc7
2 changed files with 6 additions and 6 deletions

View File

@@ -117,6 +117,12 @@ namespace Wox.Infrastructure
return false; return false;
} }
if (word.Length > 40)
{
Log.Debug($"|Wox.Infrastructure.StringMatcher.ScoreForPinyin|skip too long string: {word}");
return false;
}
var chinese = word.Select(PinyinHelper.toHanyuPinyinStringArray) var chinese = word.Select(PinyinHelper.toHanyuPinyinStringArray)
.Any(p => p != null); .Any(p => p != null);
return chinese; return chinese;

View File

@@ -131,12 +131,6 @@ namespace Wox.Infrastructure
{ {
if (!string.IsNullOrEmpty(source) && !string.IsNullOrEmpty(target)) if (!string.IsNullOrEmpty(source) && !string.IsNullOrEmpty(target))
{ {
if(source.Length > 40)
{
Log.Debug($"|Wox.Infrastructure.StringMatcher.ScoreForPinyin|skip too long string: {source}");
return 0;
}
if (Alphabet.ContainsChinese(source)) if (Alphabet.ContainsChinese(source))
{ {
var combination = Alphabet.PinyinComination(source); var combination = Alphabet.PinyinComination(source);