fixed universal search term
This commit is contained in:
parent
bd47fc1369
commit
1f5617b003
|
@ -60,15 +60,7 @@ open class TweetSearchLoader(
|
||||||
when (details.type) {
|
when (details.type) {
|
||||||
AccountType.TWITTER -> {
|
AccountType.TWITTER -> {
|
||||||
if (details.extras?.official ?: false) {
|
if (details.extras?.official ?: false) {
|
||||||
var universalQueryText = queryText
|
val universalQuery = UniversalSearchQuery(queryText)
|
||||||
if (maxId != null) {
|
|
||||||
universalQueryText += " max_id:$maxId"
|
|
||||||
}
|
|
||||||
if (sinceId != null) {
|
|
||||||
universalQueryText += " since_id:$sinceId"
|
|
||||||
}
|
|
||||||
|
|
||||||
val universalQuery = UniversalSearchQuery(universalQueryText)
|
|
||||||
universalQuery.setModules(UniversalSearchQuery.Module.TWEET)
|
universalQuery.setModules(UniversalSearchQuery.Module.TWEET)
|
||||||
universalQuery.setResultType(UniversalSearchQuery.ResultType.RECENT)
|
universalQuery.setResultType(UniversalSearchQuery.ResultType.RECENT)
|
||||||
universalQuery.setPaging(paging)
|
universalQuery.setPaging(paging)
|
||||||
|
@ -92,11 +84,25 @@ open class TweetSearchLoader(
|
||||||
|
|
||||||
protected open fun processQuery(details: AccountDetails, query: String): String {
|
protected open fun processQuery(details: AccountDetails, query: String): String {
|
||||||
if (details.type == AccountType.TWITTER) {
|
if (details.type == AccountType.TWITTER) {
|
||||||
|
if (details.extras?.official ?: false) {
|
||||||
|
return smQuery(query)
|
||||||
|
}
|
||||||
return "$query exclude:retweets"
|
return "$query exclude:retweets"
|
||||||
}
|
}
|
||||||
return query
|
return query
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected fun smQuery(query: String): String {
|
||||||
|
var universalQueryText = query
|
||||||
|
if (maxId != null) {
|
||||||
|
universalQueryText += " max_id:$maxId"
|
||||||
|
}
|
||||||
|
if (sinceId != null) {
|
||||||
|
universalQueryText += " since_id:$sinceId"
|
||||||
|
}
|
||||||
|
return universalQueryText
|
||||||
|
}
|
||||||
|
|
||||||
@WorkerThread
|
@WorkerThread
|
||||||
override fun shouldFilterStatus(database: SQLiteDatabase, status: ParcelableStatus): Boolean {
|
override fun shouldFilterStatus(database: SQLiteDatabase, status: ParcelableStatus): Boolean {
|
||||||
return InternalTwitterContentUtils.isFiltered(database, status, true)
|
return InternalTwitterContentUtils.isFiltered(database, status, true)
|
||||||
|
|
|
@ -21,6 +21,7 @@ package org.mariotaku.twidere.loader
|
||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import org.mariotaku.twidere.annotation.AccountType
|
import org.mariotaku.twidere.annotation.AccountType
|
||||||
|
import org.mariotaku.twidere.extension.model.official
|
||||||
import org.mariotaku.twidere.model.AccountDetails
|
import org.mariotaku.twidere.model.AccountDetails
|
||||||
import org.mariotaku.twidere.model.ParcelableStatus
|
import org.mariotaku.twidere.model.ParcelableStatus
|
||||||
import org.mariotaku.twidere.model.UserKey
|
import org.mariotaku.twidere.model.UserKey
|
||||||
|
@ -42,8 +43,11 @@ class UserMentionsLoader(
|
||||||
tabPosition, fromUser, makeGap, loadingMore) {
|
tabPosition, fromUser, makeGap, loadingMore) {
|
||||||
|
|
||||||
override fun processQuery(details: AccountDetails, query: String): String {
|
override fun processQuery(details: AccountDetails, query: String): String {
|
||||||
val screenName = if (query.startsWith("@")) query.substring(1) else query
|
val screenName = query.substringAfter("@")
|
||||||
if (details.type == AccountType.TWITTER) {
|
if (details.type == AccountType.TWITTER) {
|
||||||
|
if (details.extras?.official ?: false) {
|
||||||
|
return smQuery("to:$screenName")
|
||||||
|
}
|
||||||
return "to:$screenName exclude:retweets"
|
return "to:$screenName exclude:retweets"
|
||||||
}
|
}
|
||||||
return "@$screenName -RT"
|
return "@$screenName -RT"
|
||||||
|
|
Loading…
Reference in New Issue