2
0
mirror of https://github.com/fork-maintainers/iceraven-browser synced 2024-11-15 18:12:54 +00:00

increase number of various suggestions

This commit is contained in:
akliuxingyuan 2024-01-20 22:51:07 +08:00
parent 799063d826
commit 4b024889db
2 changed files with 62 additions and 0 deletions

View File

@ -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

View File

@ -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 }