Search code examples
android-contentprovidersearchableandroid-searchmanager

Android - What does question mark signify in searchable.xml?


I'm debugging SearchableDictionary sample on android 4.0. In searchable.xml, what does question mark signify in this attribute, android:searchSuggestSelection=" ?"?

Here is the snippet :

<searchable xmlns:android="http://schemas.android.com/apk/res/android"
    android:label="@string/search_label"
    android:hint="@string/search_hint"
    android:searchSettingsDescription="@string/settings_description"
    android:searchSuggestAuthority="com.example.android.searchabledict.DictionaryProvider"
    android:searchSuggestIntentAction="android.intent.action.VIEW"
    android:searchSuggestIntentData="content://com.example.android.searchabledict.DictionaryProvider/dictionary"
    android:searchSuggestSelection=" ?"   
    android:searchSuggestThreshold="1"
    android:includeInGlobalSearch="true"
    >

Thanks.


Solution

  • It stands for the query typed by the user. See the docs

    android:searchSuggestSelection [String]

    This value is passed into your query function as the selection parameter. Typically this is a WHERE clause for your database, and should contain a single question mark, which is a placeholder for the actual query string that has been typed by the user (for example, "query=?").

    Alternate

    android:searchSuggestSelection="word MATCH ?"