SearchPaneQueryLinguisticDetails class
Provides information about query text that the user enters through an Input Method Editor (IME).
Syntax
var searchPaneQueryLinguisticDetails = searchPaneQueryChangedEventArgs.linguisticDetails; var searchPaneQueryLinguisticDetails = searchPaneSuggestionsRequestedEventArgs.linguisticDetails;
Attributes
- MarshalingBehaviorAttribute(Agile)
- VersionAttribute(NTDDI_WIN8)
Members
The SearchPaneQueryLinguisticDetails class has these types of members:
Methods
The SearchPaneQueryLinguisticDetails class inherits methods from the Object class (C#/VB/C++).
Properties
The SearchPaneQueryLinguisticDetails class has these properties.
| Property | Access type | Description |
|---|---|---|
| Read-only | A list of the text alternatives for the current query text. These alternatives account for uncomposed text the user is entering in an IME. | |
| Read-only | The length of the portion of the query text that the user is composing with an Input Method Editor (IME). | |
| Read-only | The starting location of the text that the user is composing with an Input Method Editor (IME). |
Remarks
An app retrieves this object through the searchPaneQueryChangedEventArgs.linguisticDetails property while handling a querychanged event or through the searchPaneSuggestionsRequestedEventArgs.linguisticDetails property while handling a suggestionsrequested event.
Examples
The Search contract sample demonstrates how to respond to a suggestionsrequested event, including how to access the event's linguistic details.
// Register the onsuggestionsrequested event in your apps global scope, for example default.js, so that it is registered as soon as your app is launched. Windows.ApplicationModel.Search.SearchPane.getForCurrentView().onsuggestionsrequested = function (eventObject) { var queryText = eventObject.queryText, suggestionRequest = eventObject.request, linguisticDetails = eventObject.linguisticDetails; var queryAlternatives = linguisticDetails.queryTextAlternatives; var maxNumberOfSuggestions = 5; for (var i = 0, len = queryAlternatives.length, done = false; i < len && !done; i++) { // toLowerCase not necessary for East Asian languages. Preserves compatibility when non East Asian suggestions are mixed in with East Asian suggestions. var alternative = queryAlternatives[i].toLowerCase(); for (var j = 0, suggestionLength = suggestionList.length; j < suggestionLength; j++) { if (suggestionList[j].substr(0, alternative.length).toLowerCase() === alternative) { suggestionRequest.searchSuggestionCollection.appendQuerySuggestion(suggestionList[j]); if (suggestionRequest.searchSuggestionCollection.size === maxNumberOfSuggestions) { done = true; break; } } } } // Construct list of alternatives so we can output them. var alternatives = ""; for (var k = 0, alternativeCount = queryAlternatives.length; k < alternativeCount; k++) { alternatives += queryAlternatives[k]; } if (suggestionRequest.searchSuggestionCollection.size > 0) { WinJS.log && WinJS.log("Suggestions provided for query: " + queryText + "\nUsing alternatives: " + alternatives, "sample", "status"); } else { WinJS.log && WinJS.log("No suggestions provided for query: " + queryText + "\nUsing alternatives: " + alternatives, "sample", "status"); } };
Requirements
|
Minimum supported client | Windows 8 [Windows Store apps only] |
|---|---|
|
Minimum supported server | Windows Server 2012 [Windows Store apps only] |
|
Namespace |
|
|
Metadata |
|
See also
- Search contract sample
- SearchPane.QueryChanged event
- SearchPaneQueryChangedEventArgs class
- SearchPaneQueryChangedEventArgs.LinguisticDetails property
- SearchPane.SuggestionsRequested event
- SearchPaneSuggestionsRequestedEventArgs class
- SearchPaneSuggestionsRequestedEventArgs.LinguisticDetails property
Build date: 12/4/2012
