0

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. How can I do this?

Thanks

1 Answer 1

1

Piecing together 2 articles (MSDN and 2), it looks as if your QueryText section should be like this:

<QueryText language=xml:lang type='MSSQLFT'>
SELECT Title,shortdescription,description,Rank, FROM portal..scope() WHERE
CONTAINS ('"test*"')   AND  ( ("SCOPE" = 'TestScope') )  ORDER BY "Rank" DESC
</QueryText>

I had looked into this before, but we ripped the functionality out of the site. Anita has some useful posts on the search web service and SPServices.

1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.