Search Bug fixed
This commit is contained in:
@@ -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 {
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -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()
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user