OSDN Git Service

Return the url of a browser history item in the intent query column of the
authorMike LeBeau <mlebeau@android.com>
Wed, 24 Jun 2009 00:36:59 +0000 (17:36 -0700)
committerMike LeBeau <mlebeau@android.com>
Wed, 24 Jun 2009 00:36:59 +0000 (17:36 -0700)
suggestion. This is so that global search can rewrite a query in the search
dialog (i.e., fill in the search box with the url of the suggestion when the
user rolls over to select the suggestion). Browser uses
android:searchMode="rewriteQueryFromData" to accomplish this but global search
does the default thing of using the intent query column, if present, as a rewrite
for the current query.

src/com/android/browser/BrowserProvider.java

index 9b72364..4747190 100644 (file)
@@ -489,7 +489,11 @@ public class BrowserProvider extends ContentProvider {
 
                     case SUGGEST_COLUMN_QUERY_ID:
                         if (mHistoryCount > mPos) {
-                            return null;
+                            // Return the url in the intent query column. This is ignored
+                            // within the browser because our searchable is set to
+                            // android:searchMode="queryRewriteFromData", but it is used by
+                            // global search for query rewriting.
+                            return mHistoryCursor.getString(1);
                         } else if (!mBeyondCursor) {
                             if (mSuggestQueryId == -1) return null;
                             return mSuggestCursor.getString(mSuggestQueryId);