Problem
I have a java application which till now used SP2010 with SQL Syntax for Search queries. Everything worked fine with the Query Webservice until I upgraded to SP2013.
Now, I've come to know that only FQL and KQL and REST will be supported in SP2013.
SP2013 has removed support from SQL Syntax.
I also found that FQL has less features than KQL, so the obvious choice is to use KQL now.
Help needed
I would like to know how to migrate the following code to work for SP2013.
What worked till now
Code that works for SP2010 :-
- I generate QueryService Stub from the _vti_bin\search.asmx?wsdl.
Then I construct an XML,
public static String queryText(String keyword, String contextualScope, String customScope) { int startAt = 1; int count = 10; boolean trimDuplicates = false; String sortQuery = null; String query = "<QueryPacket xmlns='urn:Microsoft.Search.Query'>" + "<Query>" + "<SupportedFormats>" + "<Format>urn:Microsoft.Search.Response.Document.Document</Format>" + "</SupportedFormats>" + "<Context>" + "<QueryText language='en-US' type='MSSQLFT'>" + "select title, path, Author, sitename, isdocument from scope() where freetext('" + keyword + "') "; if(contextualScope!=null && !contextualScope.trim().equals("")) query += " and \"site\"='" + contextualScope + "'"; if(customScope!=null && !customScope.trim().equals("")) query += " and \"scope\"='" + customScope + "'"; query += "</QueryText>" + "</Context>" + "<Range>" + "<StartAt>" + startAt + "</StartAt>" + "<Count>" + count + "</Count>" + "</Range>"; if(sortQuery != null) query += sortQuery; query += "<TrimDuplicates>" + trimDuplicates + "</TrimDuplicates>" + "</Query>" + "</QueryPacket>"; return query; }
After that I run the following command to perform the search operation,
QueryServiceStub.Query q = new QueryServiceStub.Query(); q.setQueryXml(queryText(...)); return qsStub.Query(q);
For SP 2010 the above stuff works fine. But for SP 2013 it throws the following error,
w3wp.exe (0x26C8) 0x375C SharePoint Server Search Query dn6x High Exception caught in QueryService.Query method. Exception message: Specified method is not supported.. Stack: at Microsoft.Office.Server.Search.Query.FullTextSqlQuery.PreQueryExecute() at Microsoft.Office.Server.Search.Query.Query.ExecuteQuery() at Microsoft.Office.Server.Search.Query.Query.Execute() at Microsoft.Office.Server.Search.Query.QueryService.DoQuery(QueryMethod queryMethod, String queryXml, String& domain, String& queryId, Int32& startAt, Boolean& fStandardResults, QuerySuggestionResults& querySuggestions) at Microsoft.Office.Server.Search.Query.QueryService.Query(String queryXml). 30971d9c-a7e0-c04d-ba15-7bf4d49fb253
Please let me know if I'm not clear in my question. Even some pointers or example or guidance will be helpful.