Updating the search ranking API and some improvements:

- Ranking API is modified to run the ranking asynchronous to the main thread.
Therefore, it can now run in parallel to loading the results from DB
which decreases the overall latency.
- Ranking API now supports reporting failure from the ranker
implementation side.
- Settings that are not ranked by the ranker algorithm are now ranked at
the end of the list. This is added for dynamic settings (e.g., apps).
- Failure handling mechanism is added for cases that ranker catches an
exception or it takes a long time to respond.

Bug: 37312700
Fixes: 36866337
Fixes: 36867476
Fixes: 36866736
Fixes: 36866838

Test: RunSettingsRoboTests

Change-Id: I3a2a97e3a07a8d4afbb090061d92172a27588ee7
This commit is contained in:
Soroosh Mariooryad
2017-04-20 14:20:05 -07:00
parent 0f7e904dbe
commit 733bbf7c34
9 changed files with 747 additions and 144 deletions

View File

@@ -22,6 +22,7 @@ import android.view.Menu;
import android.view.View;
import com.android.settings.dashboard.SiteMapManager;
import com.android.settings.search.ranking.SearchResultsRankerCallback;
import java.util.List;
@@ -98,21 +99,30 @@ public interface SearchFeatureProvider {
}
/**
* Ranks search results based on the input query.
* Query search results based on the input query.
*
* @param context application context
* @param query input user query
* @param searchResults list of search results to be ranked
* @param searchResultsRankerCallback {@link SearchResultsRankerCallback}
*/
default void rankSearchResults(String query, List<SearchResult> searchResults) {
default void querySearchResults(Context context, String query,
SearchResultsRankerCallback searchResultsRankerCallback) {
}
/**
* Cancel pending search query
*/
default void cancelPendingSearchQuery(Context context) {
}
/**
* Notify that a search result is clicked.
*
* @param context application context
* @param query input user query
* @param searchResult clicked result
*/
default void searchResultClicked(String query, SearchResult searchResult) {
default void searchResultClicked(Context context, String query, SearchResult searchResult) {
}
/**