diff --git a/shorts-crawler/src/main/kotlin/com/mashup/shorts/core/CrawlerCore.kt b/shorts-crawler/src/main/kotlin/com/mashup/shorts/core/CrawlerCore.kt index 2a198d67..d6f231ce 100644 --- a/shorts-crawler/src/main/kotlin/com/mashup/shorts/core/CrawlerCore.kt +++ b/shorts-crawler/src/main/kotlin/com/mashup/shorts/core/CrawlerCore.kt @@ -163,7 +163,8 @@ class CrawlerCore( val sortedKeywords = keywordsCountingPair.toList().sortedByDescending { it.second } val keywordRanking = StringBuilder() - for (rank: Int in 0..9) { + val rankingSize = if (sortedKeywords.size < 10) sortedKeywords.size else 10 + for (rank: Int in 0 until rankingSize) { keywordRanking.append(sortedKeywords[rank]).append(", ") }