Skip to content

Commit

Permalink
improvement: Prioritize correct URL during forming suggestions a bit …
Browse files Browse the repository at this point in the history
…more
  • Loading branch information
AChep committed Dec 14, 2024
1 parent 6538c1d commit 0d2eb37
Showing 1 changed file with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ class GetSuggestionsImpl(
}
avgScore /= avgSize.coerceAtLeast(1)
val threshold =
if (maxScore >= 10f) maxScore.div(3f).coerceAtLeast(10f) else avgScore / 1.5f
if (maxScore >= 10f) maxScore.div(2.25f).coerceAtLeast(10f) else avgScore / 1.5f
Log.e("SuggestionsTest", "threshold $threshold")
c
.filter { (score, _) -> score >= threshold && score > scoreThreshold }
Expand Down Expand Up @@ -356,7 +356,7 @@ private fun GetSuggestionsImpl.AutofillTargetAndroid.findByApp(
uri.match != DSecret.Uri.MatchType.Never
}
.let { directMatch ->
if (directMatch) 30f else 0f
if (directMatch) 35f else 0f
}
val scoreByName = appNameTokens?.let {
findAlike(
Expand Down Expand Up @@ -395,13 +395,13 @@ private suspend fun GetSuggestionsImpl.AutofillTargetWeb.findByWebDomain(
@Suppress("MoveVariableDeclarationIntoWhen")
val matchType = uri.match ?: defaultMatchDetection
when (matchType) {
DSecret.Uri.MatchType.Domain -> 10f
DSecret.Uri.MatchType.Domain -> 15f
DSecret.Uri.MatchType.Host -> 20f
DSecret.Uri.MatchType.StartsWith -> 25f
DSecret.Uri.MatchType.Exact -> 25f
DSecret.Uri.MatchType.RegularExpression -> 30f
DSecret.Uri.MatchType.RegularExpression -> 27f
DSecret.Uri.MatchType.Never -> 0f
}
} * 1.6f
} else {
0f
}
Expand All @@ -415,7 +415,7 @@ private suspend fun GetSuggestionsImpl.AutofillTargetWeb.findByWebDomain(
request = webHost,
)
if (match) {
20f
30f
} else {
0f
}
Expand All @@ -427,5 +427,5 @@ private suspend fun GetSuggestionsImpl.AutofillTargetWeb.findByWebDomain(
tokens,
webUrlTokens,
)
scoreByHost * 2f + scoreByUri + scoreByRpId
scoreByHost * 1.8f + scoreByUri + scoreByRpId
}

0 comments on commit 0d2eb37

Please sign in to comment.