How can I receive managed properties by using the Query operation?

Sep 20, 2013 at 10:51 AM
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 also tried to use the GetSearchMetadata operation, but I do not know how to use it correctly.

http://msdn.microsoft.com/de-de/library/websvcsearch.queryservice.getsearchmetadata(v=office.14).aspx

Can anyone help me? That would be really great.

Best regards,

Björn
Coordinator
Oct 4, 2013 at 7:27 PM
Bjorn:

Did you figure this out or do you still need help?

M.
Oct 7, 2013 at 5:28 PM
Hi Sympmarc,
Sorry, I forgot to send an update.

My Request XML was not correct. I used http://fastforsharepoint.codeplex.com/ to generate a RequestXML which worked :-)

Best regards,
Björn
Marked as answer by bbodensieck on 10/7/2013 at 9:28 AM