Add number of occurence to tags

It can be a bit frustrating to click on a tag only to realise it was the
only example with that tag.
This commit is contained in:
Maximilian Krög
2020-07-19 17:21:32 +02:00
parent aa0a895212
commit 50404ca409
3 changed files with 91 additions and 38 deletions

View File

@@ -43,15 +43,15 @@
}
};
words.forEach(function (word) {
const dict = info.index[word];
const dict = info.wordIndex[word];
if (dict) {
updateScores(dict, word);
} else {
const r = new RegExp(word);
// eslint-disable-next-line prefer-const
for (let idx in info.index) {
for (let idx in info.wordIndex) {
if (r.test(idx)) {
updateScores(info.index[idx], word);
updateScores(info.wordIndex[idx], word);
}
}
}