Skip to content
This repository has been archived by the owner on Oct 31, 2022. It is now read-only.

Commit

Permalink
Added advanced search feature
Browse files Browse the repository at this point in the history
close #9
  • Loading branch information
Taskeren committed Sep 18, 2022
1 parent 8491aa7 commit be8e428
Showing 1 changed file with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,18 @@ class MongoProvider(private val config: MongoExplodeConfig, val detonate: Detona
val filters = buildList {

if(filterName.isNotEmpty()) {
this += (MongoSet::musicName.regex(filterName, "i"))
if(filterName.startsWith('#')) {
val diffLevel = filterName.substring(1).toIntOrNull() ?: 99
this += MongoSet::charts elemMatch (MongoChart::difficultyValue eq diffLevel)
} else if(filterName.startsWith('@')) {
val noterNameOrId = filterName.substring(1)
this += or(MongoSet::noterDisplayOverride eq noterNameOrId, MongoSet::noterId eq noterNameOrId)
} else if(filterName.startsWith('&')) {
val composerName = filterName.substring(1)
this += MongoSet::composerName eq composerName
} else {
this += (MongoSet::musicName.regex(filterName, "i"))
}
}

when(filterCategory) {
Expand Down

0 comments on commit be8e428

Please sign in to comment.