LocalContentSuggestionSettings class

Applies to Windows only

Stores settings that determine whether the app provides suggestions based on local files, and that define the criteria used to locate and filter these suggestions.

Syntax


var localContentSuggestionSettings = new Windows.ApplicationModel.Search.LocalContentSuggestionSettings();

Attributes

[MarshalingBehavior(Standard)]
[Version(0x06020000)]

Members

The LocalContentSuggestionSettings class has these types of members:

Constructors

The LocalContentSuggestionSettings class has these constructors.

ConstructorDescription
LocalContentSuggestionSettings Creates a new instance of the localContentSuggestionSettings class.

 

Properties

The LocalContentSuggestionSettings class has these properties.

PropertyAccess typeDescription

AqsFilter

Read/writeAn Advanced Query Syntax (AQS) string that limits the types and kinds of files that are used to provide suggestions.

Enabled

Read/writeIndicates whether suggestions based on local files are displayed in the search pane.

Locations

Read-onlyA list of the storageFolder objects that contain files that are used to provide suggestions.

PropertiesToMatch

Read-onlyA list of the file properties whose values are used to provide suggestions from local files.

 

Remarks

The suggestions that the app provides are based on metadata fields and properties on the user's local, indexed files.

If enabled, local suggestions are displayed in the search pane when the user enters a query in the search box.

Disable these suggestions by setting the enabled property to false.

Note  : This class is not agile, which means that you need to consider its threading model and marshaling behavior. For more info, see Threading and Marshaling (C++/CX) and Using Windows Runtime objects in a multithreaded environment (.NET).

Examples

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).

Requirements

Minimum supported client

Windows 8 [Windows Store apps only]

Minimum supported server

Windows Server 2012 [Windows Store apps only]

Minimum supported phone

None supported

Namespace

Windows.ApplicationModel.Search
Windows::ApplicationModel::Search [C++]

Metadata

Windows.winmd

See also

Search contract sample
Quickstart: Adding search
Advanced Query Syntax (AQS)
Reference
SearchPane class
SearchPane.setLocalContentSuggestionSettings method

 

 

Show:
© 2014 Microsoft. All rights reserved.