QueryService.QueryEx Method (websvcSearch)
Returns an ADO.NET DataSet containing a DataTable for each search results set returned for the specified query.

Namespace: websvcSearch
Assembly: MOSSSOAP (in mosssoap.dll)

Syntax

Visual Basic (Declaration)
<SoapDocumentMethodAttribute("http://microsoft.com/webservices/OfficeServer/QueryService/QueryEx", RequestNamespace:="http://microsoft.com/webservices/OfficeServer/QueryService", ResponseNamespace:="http://microsoft.com/webservices/OfficeServer/QueryService", Use:=SoapBindingUse.Literal, ParameterStyle:=SoapParameterStyle.Wrapped)> _
Public Function QueryEx ( _
    queryXml As String _
) As DataSet
Visual Basic (Usage)
Dim instance As QueryService
Dim queryXml As String
Dim returnValue As DataSet

returnValue = instance.QueryEx(queryXml)
C#
[SoapDocumentMethodAttribute("http://microsoft.com/webservices/OfficeServer/QueryService/QueryEx", RequestNamespace="http://microsoft.com/webservices/OfficeServer/QueryService", ResponseNamespace="http://microsoft.com/webservices/OfficeServer/QueryService", Use=SoapBindingUse.Literal, ParameterStyle=SoapParameterStyle.Wrapped)] 
public DataSet QueryEx (
    string queryXml
)

Parameters

queryXml

A string specifying the search query XML. The XML format is defined by the Microsoft.Search.Query Schema for Enterprise Search.

Return Value

A System.Data.DataSet object containing a System.Data.DataTable object for each search result set.
Remarks

For queries containing a simple list of search terms, set the type attribute for the QueryText Element in Microsoft.Search.Query Schema for Enterprise Search element of the Microsoft.Search.Query schema to 'STRING'. For SQL syntax queries, set the type attribute to 'MSSQLFT'.

If anonymous access is disabled for the Query web service's Microsoft Office SharePoint Server 2007 web application you must specify the credentials for the web service request using the Credentials property. The search results are trimmed based on the credentials of the current context of the request.

The DataSet returned by the QueryEx method can contain multiple result sets. Each result set will be a DataTable within the DataSet. The DataTable name is based on the types of results included in the result set for that DataTable. These are:

  • Relevant results

  • Special-term results

  • High-confidence results

The default sort order is relevance rank.

Using elements from the Microsoft.Search.Query schema, you can specify the following for the result set returned by the Query web method:

Example

The following code example shows how to invoke the Query method. This example assumes the following:

  • You have referenced the web service proxy class, here called QueryWebServiceProxy, in your code.

  • You have instantiated a string variable, queryXMLString, and set the value of this variable to the XML string containing the search query.

C#
QueryWebServiceProxy.QueryService queryService = new QueryWebServiceProxy.QueryService();
queryService.Credentials = System.Net.CredentialCache.DefaultCredentials;
string queryResultsString = queryService.Query(queryXMLString);
NoteNote:

Setting the proxy class Credentials property to the DefaultCredentials property of the System.Net.CredentialCache class allows you to use the credentials for the identity that the client application is running under for the web service request.

.

See Also

Tags :


Community Content

screw it
Attention Developers : you cannot set the SQL timeout using this method

if you consider using this webmethod, note that unlike in the API you cannot set the timeout of the query object itself, the timeout is set in the webservice code which calls the API and is hard coded to 10000 ms (10 seconds) this means that every query that takes more than 10 seconds will timeout on you. usually this happens in an advanced search scenario and particulary when dates sorting or dates comparision is involved (e.g items from last 3 months)
MS recomendation is to create your own web service and call the API yourself. (!)
so good luck with that.. its better to start now than to figure it out in testing.
HTH
Roi.

reference :

http://groups.google.com/group/microsoft.public.sharepoint.portalserver.development/browse_thread/thread/97919ea0b80b9ed1?pli=1

Tags :

Page view tracker