4.5 GetSuggestedQueries
To obtain a list of suggested queries which contains the word "example", the protocol client sends a request message as follows:
-
<?xml version="1.0" encoding="utf-8"?> <soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope"> <soap12:Body> <GetQuerySuggestions xmlns="http://microsoft.com/webservices/OfficeServer/QueryService"> <queryXml><?xml version="1.0" encoding="utf-8" ?><QueryPacket xmlns="urn:Microsoft.Search.Query" Revision="1"> <Query domain="QDomain"> <Context> <QueryText language="en-us" type="STRING">example</QueryText> </Context> <Range> <StartAt>1</StartAt> <Count>8</Count> </Range> <PreQuerySuggestions>true</PreQuerySuggestions> <HighlightQuerySuggestions>false</HighlightQuerySuggestions> </Query></QueryPacket></queryXml> </GetQuerySuggestions> </soap12:Body> </soap12:Envelope>
The request information in the preceding message is doubly encoded XML. The following shows the decoded value of the queryXml string:
-
<?xml version="1.0" encoding="utf-8" ?> <QueryPacket xmlns="urn:Microsoft.Search.Query" Revision="1"> <Query domain="QDomain"> <Context> <QueryText language="en-us" type="STRING">example</QueryText> </Context> <Range> <StartAt>1</StartAt> <Count>8</Count> </Range> <PreQuerySuggestions>true</PreQuerySuggestions> <HighlightQuerySuggestions>false</HighlightQuerySuggestions> </Query> </QueryPacket>
The protocol server responds with a message such as this one:
-
<?xml version="1.0" encoding="utf-8"?> <soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <soap:Body> <GetQuerySuggestionsResponse xmlns="http://microsoft.com/webservices/OfficeServer/QueryService"> <GetQuerySuggestionsResult> <string>example site</string> <string>client example</string> <string>server example</string> <string>example documents</string> <string>code example</string> </GetQuerySuggestionsResult> </GetQuerySuggestionsResponse> </soap:Body> </soap:Envelope>
-