diff --git a/automation/iceraven/patch_android_components.sh b/automation/iceraven/patch_android_components.sh index 796c03e1874f..28038087dd00 100755 --- a/automation/iceraven/patch_android_components.sh +++ b/automation/iceraven/patch_android_components.sh @@ -10,3 +10,4 @@ do done git -C android-components apply < automation/iceraven/patches/top_sites_no_most_visted_sites.patch +git -C android-components apply < automation/iceraven/patches/suggestions_increase_number.patch \ No newline at end of file diff --git a/automation/iceraven/patches/suggestions_increase_number.patch b/automation/iceraven/patches/suggestions_increase_number.patch new file mode 100644 index 000000000000..68bcc12b4a14 --- /dev/null +++ b/automation/iceraven/patches/suggestions_increase_number.patch @@ -0,0 +1,61 @@ +diff --git a/components/feature/awesomebar/src/main/java/mozilla/components/feature/awesomebar/provider/BookmarksStorageSuggestionProvider.kt b/components/feature/awesomebar/src/main/java/mozilla/components/feature/awesomebar/provider/BookmarksStorageSuggestionProvider.kt +index 73252c1560..0544a51f59 100644 +--- a/components/feature/awesomebar/src/main/java/mozilla/components/feature/awesomebar/provider/BookmarksStorageSuggestionProvider.kt ++++ b/components/feature/awesomebar/src/main/java/mozilla/components/feature/awesomebar/provider/BookmarksStorageSuggestionProvider.kt +@@ -86,7 +86,7 @@ class BookmarksStorageSuggestionProvider( + * @param query String to filter bookmarks' title or URL by. + */ + private suspend fun getBookmarksSuggestions(query: String) = bookmarksStorage +- .searchBookmarks(query, BOOKMARKS_SUGGESTION_LIMIT) ++ .searchBookmarks(query, BOOKMARKS_SUGGESTION_LIMIT * BOOKMARKS_RESULTS_TO_FILTER_SCALE_FACTOR) + .filter { it.url != null } + .distinctBy { it.url } + .sortedBy { it.guid } +diff --git a/components/feature/awesomebar/src/main/java/mozilla/components/feature/awesomebar/provider/CombinedHistorySuggestionProvider.kt b/components/feature/awesomebar/src/main/java/mozilla/components/feature/awesomebar/provider/CombinedHistorySuggestionProvider.kt +index 5d79e8caed..293a5cee78 100644 +--- a/components/feature/awesomebar/src/main/java/mozilla/components/feature/awesomebar/provider/CombinedHistorySuggestionProvider.kt ++++ b/components/feature/awesomebar/src/main/java/mozilla/components/feature/awesomebar/provider/CombinedHistorySuggestionProvider.kt +@@ -145,7 +145,7 @@ class CombinedHistorySuggestionProvider( + * @param query String to filter bookmarks' title or URL by. + */ + private suspend fun getMetadataSuggestions(query: String) = historyMetadataStorage +- .queryHistoryMetadata(query, maxNumberOfSuggestions) ++ .queryHistoryMetadata(query, maxNumberOfSuggestions * COMBINED_HISTORY_RESULTS_TO_FILTER_SCALE_FACTOR) + .filter { it.totalViewTime > 0 } + .into(this@CombinedHistorySuggestionProvider, icons, loadUrlUseCase, showEditSuggestion) + +@@ -169,7 +169,7 @@ class CombinedHistorySuggestionProvider( + * @param query String to filter history entry's title or URL by. + */ + private suspend fun getHistorySuggestions(query: String) = historyStorage +- .getSuggestions(query, maxNumberOfSuggestions) ++ .getSuggestions(query, maxNumberOfSuggestions * COMBINED_HISTORY_RESULTS_TO_FILTER_SCALE_FACTOR) + .sortedByDescending { it.score } + .distinctBy { it.id } + .into(this@CombinedHistorySuggestionProvider, icons, loadUrlUseCase, showEditSuggestion) +diff --git a/components/feature/awesomebar/src/main/java/mozilla/components/feature/awesomebar/provider/HistoryMetadataSuggestionProvider.kt b/components/feature/awesomebar/src/main/java/mozilla/components/feature/awesomebar/provider/HistoryMetadataSuggestionProvider.kt +index ad1d7590b7..512262ee9a 100644 +--- a/components/feature/awesomebar/src/main/java/mozilla/components/feature/awesomebar/provider/HistoryMetadataSuggestionProvider.kt ++++ b/components/feature/awesomebar/src/main/java/mozilla/components/feature/awesomebar/provider/HistoryMetadataSuggestionProvider.kt +@@ -85,7 +85,7 @@ class HistoryMetadataSuggestionProvider( + * @param query String to filter history entry's title or URL by. + */ + private suspend fun getHistorySuggestions(query: String) = historyStorage +- .queryHistoryMetadata(query, maxNumberOfSuggestions) ++ .queryHistoryMetadata(query, maxNumberOfSuggestions * HISTORY_METADATA_RESULTS_TO_FILTER_SCALE_FACTOR) + .filter { it.totalViewTime > 0 } + + /** +diff --git a/components/feature/awesomebar/src/main/java/mozilla/components/feature/awesomebar/provider/HistoryStorageSuggestionProvider.kt b/components/feature/awesomebar/src/main/java/mozilla/components/feature/awesomebar/provider/HistoryStorageSuggestionProvider.kt +index e9d56bede3..c95da08651 100644 +--- a/components/feature/awesomebar/src/main/java/mozilla/components/feature/awesomebar/provider/HistoryStorageSuggestionProvider.kt ++++ b/components/feature/awesomebar/src/main/java/mozilla/components/feature/awesomebar/provider/HistoryStorageSuggestionProvider.kt +@@ -110,7 +110,7 @@ class HistoryStorageSuggestionProvider( + * @param query String to filter history entry's title or URL by. + */ + private fun getHistorySuggestions(query: String) = historyStorage +- .getSuggestions(query, maxNumberOfSuggestions) ++ .getSuggestions(query, maxNumberOfSuggestions * HISTORY_RESULTS_TO_FILTER_SCALE_FACTOR) + // In case of duplicates we want to pick the suggestion with the highest score. + // See: https://github.com/mozilla/application-services/issues/970 + .sortedByDescending { it.score }