Hey developers,
I try to get search results via javascript by using the "Query" method of the /_vti_bin/search.asmx webservice (I am using spservices). The default fields are in the result, but I have a problem with managed properties. If I modify the Request XML by adding a properties tag with property tags in it the service answers "BAD REQUEST".
When I am using a coreresultswebpart, I get the managed properties I want (So the fields are correctly crawled).
Here is my code example (if I comment the properties tags it works!):
function MySearch(request) {
var queryText = "<QueryPacket xmlns='urn:Microsoft.Search.Query' Revision='1000'>";
queryText += "<RowLimit>20</RowLimit>";
queryText += "<Query>";
queryText += "<Context>";
queryText += "<QueryText language='de-DE' type='STRING'>";
queryText += "ContentType:'SomeContentType' " + request.term;
queryText += "</QueryText>";
queryText += "</Context>";
queryText += "<Range><Count>3</Count></Range>";
queryText += "<Properties>";
queryText += "<Property name='mymanagedprop'></Property>";
queryText += "</Properties>";
queryText += "</Query>";
queryText += "</QueryPacket>";
$().SPServices({
operation: "Query",
queryXml: queryText,
completefunc: function(xData, Status) {
// work with result...
}
});
}How can I receive managed properties by using the serach.asmx?
I tried to use also the GetSearchMetadata operation, but I do not know how to use it correctly.
Can anyone help me? That would be really great.
Best regards,
Björn