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

@@ -9,8 +9,8 @@ android {
applicationId "xyz.quaver.pupil" applicationId "xyz.quaver.pupil"
minSdkVersion 16 minSdkVersion 16
targetSdkVersion 28 targetSdkVersion 28
versionCode 11 versionCode 12
versionName "2.5.2" versionName "2.5.3"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
} }
buildTypes { buildTypes {

View File

@@ -1,5 +1,6 @@
package xyz.quaver.pupil.adapters package xyz.quaver.pupil.adapters
import android.graphics.Bitmap
import android.graphics.BitmapFactory import android.graphics.BitmapFactory
import android.view.LayoutInflater import android.view.LayoutInflater
import android.view.View import android.view.View

View File

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

View File

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