SearchPane.SetLocalContentSuggestionSettings | setLocalContentSuggestionSettings method
Specifies whether suggestions based on local files are automatically displayed in the search pane, and defines the criteria that Windows uses to locate and filter these suggestions.
The new settings for local content suggestions.
When local content suggestions are enabled, Windows will provide search suggestions from the user's local files as the user enters query text. For example, a picture application can configure local content suggestions so that search suggestions come only from a particular kind of image file that is stored in the user's picture library.
The Search contract sample demonstrates how to customize local suggestions by restricting the locations and kinds of files that the suggestions are based on.
Tip You should add this code to your app's global scope and run it as soon as your app is launched.
var settings = new Windows.ApplicationModel.Search.LocalContentSuggestionSettings(); settings.enabled = true; settings.locations.append(Windows.Storage.KnownFolders.musicLibrary); settings.aqsFilter = "kind:=music"; Windows.ApplicationModel.Search.SearchPane.getForCurrentView().setLocalContentSuggestionSettings(settings);
In the example, suggestions are restricted to one kind of file, music files, using an AQS string. Two of the most common AQS filters restrict based on file kind, like "kind:=.music" in the example; and based on file name extension, like "ext:=.mp3". You can learn more about AQS in Advanced Query Syntax (AQS).
Minimum supported client
Minimum supported server
|Windows Server 2012|
Minimum supported phone
- Advanced Query Syntax (AQS)
- Quickstart: Adding search
- Search contract sample
- LocalContentSuggestionSettings class
- SearchPane class