Search Bug fixed

This commit is contained in:
tom5079
2019-06-07 21:50:22 +09:00
parent 3acb43ace2
commit 05d11bda0f
4 changed files with 11 additions and 5 deletions

View File

@@ -11,9 +11,11 @@ fun doSearch(query: String) : List<Int> {
val terms = query
.trim()
.replace(Regex("""^\?"""), "")
.replace('_', ' ')
.toLowerCase()
.split(Regex("\\s+"))
.map {
it.replace('_', ' ')
}
val positiveTerms = LinkedList<String>()
val negativeTerms = LinkedList<String>()
@@ -42,7 +44,8 @@ fun doSearch(query: String) : List<Int> {
//positive results
positiveTerms.map {
launch(searchDispatcher) {
filterPositive(getGalleryIDsForQuery(it).sorted())
val newResults = getGalleryIDsForQuery(it)
filterPositive(newResults.sorted())
}
}.forEach {
it.join()

View File

@@ -7,7 +7,9 @@ import java.net.URL
class UnitTest {
@Test
fun test() {
print(File("C:\\asdf").list()?.size ?: 0)
val galleries = getGalleryIDsForQuery("series:touhou_project")
println(galleries.size)
}
@Test