From b514a30f220c5e353e3ee2bb3a783e21447dcbe7 Mon Sep 17 00:00:00 2001 From: "Cuong M. Tran" Date: Mon, 29 Apr 2024 03:54:35 +0700 Subject: [PATCH] More special charaters to split keyword when searching for related titles --- .../kotlin/eu/kanade/tachiyomi/source/online/HttpSource.kt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/source-api/src/commonMain/kotlin/eu/kanade/tachiyomi/source/online/HttpSource.kt b/source-api/src/commonMain/kotlin/eu/kanade/tachiyomi/source/online/HttpSource.kt index 3412ce50c..08c77b586 100644 --- a/source-api/src/commonMain/kotlin/eu/kanade/tachiyomi/source/online/HttpSource.kt +++ b/source-api/src/commonMain/kotlin/eu/kanade/tachiyomi/source/online/HttpSource.kt @@ -33,7 +33,6 @@ import uy.kohesive.injekt.api.get import java.net.URI import java.net.URISyntaxException import java.security.MessageDigest -import java.util.Locale /** * A simple implementation for sources from a website. @@ -322,7 +321,8 @@ abstract class HttpSource : CatalogueSource { protected open suspend fun getRelatedMangaListBySearch(manga: SManga): List { fun String.stripKeyword(): List { val regexWhitespace = Regex("\\s+") - val regexSpecialCharacters = Regex("[\\[(!~@#$%^&*|,?:\"<>)\\]]") + val regexSpecialCharacters = + Regex("([!~#$%^&*+_|/\\\\,?:;'“”‘’\"<>(){}\\[\\]。・~:—!?、―«»《》〘〙【】「」|]|\\s-|-\\s|\\s\\.|\\.\\s)") val regexNumberOnly = Regex("^\\d+$") return replace(regexSpecialCharacters, " ") @@ -330,7 +330,7 @@ abstract class HttpSource : CatalogueSource { .map { // remove number only it.replace(regexNumberOnly, "") - .lowercase(Locale.getDefault()) + .lowercase() } // exclude single character .filter { it.length > 1 }