Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

Let's say I have a library, mylibrary, that I want to search in using the search web service. How would I do that? So far I have tried this MSSQLFT query:

SELECT Title, Description, Path, Rank
FROM SCOPE()
WHERE FREETEXT(defaultproperties, 'test')
  AND "PATH" LIKE '%mylibrary%'
  AND "SCOPE" = 'All Sites'
ORDER BY Rank DESC

If I run this query, I get no results. If I remove the PATH condition I get a result with a path like:

http://sharepoint/mylibrary/test.docx

This makes no sense to me. Is there something I'm doing wrong, or is it just not supposed to work this way? How should I do this?

share|improve this question

1 Answer 1

up vote 2 down vote accepted

If you're using SharePoint 2010 then you shouldn't use the SQL syntax the keyword syntax is simple just use

site:mylibrary test

share|improve this answer
    
So you're saying I should just use <QueryText type="STRING">? That doesn't seem to work, I don't get any results. I have tried both on the SharePoint site and through the API. –  Felix Mar 28 '12 at 9:11
    
First test your query string on the search page. Then just user type="STRING" –  Per Jakobsen Mar 28 '12 at 9:20
    
Well, I tried your suggestion, site:mylibrary test, and I got not results. –  Felix Mar 28 '12 at 9:52
    
Are you using just mylibrary or the full URL to mylibrary? It should be the latter, so in your case the query should be "site:sharepoint/mylibrary test" –  Per Jakobsen Mar 28 '12 at 9:58
    
That worked. Thanks! –  Felix Mar 28 '12 at 10:53

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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