Skip to content

Commit b514a30

Browse files
committed
More special charaters to split keyword when searching for related titles
1 parent d9e4400 commit b514a30

File tree

1 file changed

+3
-3
lines changed
  • source-api/src/commonMain/kotlin/eu/kanade/tachiyomi/source/online

1 file changed

+3
-3
lines changed

source-api/src/commonMain/kotlin/eu/kanade/tachiyomi/source/online/HttpSource.kt

+3-3
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ import uy.kohesive.injekt.api.get
3333
import java.net.URI
3434
import java.net.URISyntaxException
3535
import java.security.MessageDigest
36-
import java.util.Locale
3736

3837
/**
3938
* A simple implementation for sources from a website.
@@ -322,15 +321,16 @@ abstract class HttpSource : CatalogueSource {
322321
protected open suspend fun getRelatedMangaListBySearch(manga: SManga): List<SManga> {
323322
fun String.stripKeyword(): List<String> {
324323
val regexWhitespace = Regex("\\s+")
325-
val regexSpecialCharacters = Regex("[\\[(!~@#$%^&*|,?:\"<>)\\]]")
324+
val regexSpecialCharacters =
325+
Regex("([!~#$%^&*+_|/\\\\,?:;'“”‘’\"<>(){}\\[\\]。・~:—!?、―«»《》〘〙【】「」|]|\\s-|-\\s|\\s\\.|\\.\\s)")
326326
val regexNumberOnly = Regex("^\\d+$")
327327

328328
return replace(regexSpecialCharacters, " ")
329329
.split(regexWhitespace)
330330
.map {
331331
// remove number only
332332
it.replace(regexNumberOnly, "")
333-
.lowercase(Locale.getDefault())
333+
.lowercase()
334334
}
335335
// exclude single character
336336
.filter { it.length > 1 }

0 commit comments

Comments
 (0)