Fix a bug in suggestion algorithm not returning all matches. Fixes 2170908.

Native code was not returning the correct count for found matches. Fixed the
incorrect assumption that words usually get inserted in descending order of
frequency.
main
Amith Yamasani 2009-10-06 15:38:24 -07:00
parent 142dc94031
commit 379bcf8064
1 changed files with 2 additions and 1 deletions

View File

@ -139,7 +139,8 @@ Dictionary::addWord(unsigned short *word, int length, int frequency)
} }
*dest = 0; // NULL terminate *dest = 0; // NULL terminate
// Update the word count // Update the word count
if (insertAt + 1 > mWords) mWords = insertAt + 1; mWords = 0;
while (mFrequencies[mWords] > 0) mWords++;
if (DEBUG_DICT) LOGI("Added word at %d\n", insertAt); if (DEBUG_DICT) LOGI("Added word at %d\n", insertAt);
return true; return true;
} }