SPServices - How to set a search scope and filtering settings

Jun 11, 2013 at 5:40 PM
Edited Jun 11, 2013 at 5:52 PM
Hi,

I am doing a search using this code:
    var queryText;
    queryText = "<QueryPacket xmlns='urn:Microsoft.Search.Query' Revision='1000'>";
    queryText += "<Query>";
    queryText += "<SupportedFormats>";
    queryText += "<Format>urn:Microsoft.Search.Response.Document.Document</Format>";
    queryText += "</SupportedFormats>";
    queryText += "<Context>";
    queryText += "<QueryText language='en-US' type='STRING'>";
    queryText += text;
    queryText += "</QueryText>";
    queryText += "</Context>";
    queryText += "<Range><Count>1000</Count></Range>";
    queryText += "<Properties>";
    queryText += "<Property name='Title'></Property>";
    queryText += "<Property name='Path'></Property>";
    queryText += "<Property name='Description'></Property>";
    queryText += "<Property name='Write'></Property>";
    queryText += "<Property name='Rank'></Property>";
    queryText += "<Property name='Size'></Property>";
    queryText += "</Properties>";
    //queryText += "<SortByProperties>";
    //queryText += "<SortProperty name='Title' direction='ascending' order="1"></SortProperty>";
    //queryText += "</SortByProperties>";
    queryText += "<EnableSpellCheck>false</EnableSpellCheck>";
    queryText += "<TrimDuplicates>false</TrimDuplicates>";
    queryText += "<IncludeRelevantResults>false</IncludeRelevantResults>";
    queryText += "</Query>";
    queryText += "</QueryPacket>";
    

    $().SPServices({
        operation: "Query",
        queryXml: queryText,
        completefunc: searchComplete
    });
However, I want to set the search scope to a specific library and want to filter it only by pdf documents. How can I do this?

EDIT: i figured out how to do the filtering, you just need to add " filetype:pdf"; to your search text. But I still don't know how to do the search scope.

Thanks
Coordinator
Jun 12, 2013 at 9:20 PM
Take a look at this thread. I'm not much of a search jock, so I'm not sure of the exact answer. Let us know if you get it!

M.