I'm creating FullTextSqlQuery to find some phases in files content. I have some test files uploaded on one of SPSite with content that match my query conditions. When I search in web browser, I'm getting my test file on result list.
Somehow my FullTextSqlQuery doesn't return those files as a result. There are some results but should be more. This is my query string:

SELECT Title,Path FROM SCOPE() WHERE "scope" = 'MyScope' AND ( freetext(DefaultProperties,'"tax recovery"') OR freetext(DefaultProperties,'"service fee"') OR freetext(DefaultProperties,'"hotel tax"') OR ( freetext(DefaultProperties,'"hotel"') AND freetext(DefaultProperties,'"sales tax"') ) OR ( freetext(DefaultProperties,'"hotel"') AND freetext(DefaultProperties,'"excise tax"') ) )

What I'm doing wrong? Hot to force SP to find all files that match query conditions?

  • Can you add some tags to indicate what version of SharePoint you are using? 2007 or 2010, Foundation or Server etc. Also, can you explain why you are using a SQL Query instead of plain FQL. – Matthew McDermott Feb 7 '14 at 17:39
  • Hi. I'm using SP 2010 server. – Neon Feb 10 '14 at 11:58
  • And what about using FQL rather than SQL. SQL is deprecated in 2010 and removed in 2013. – Matthew McDermott Feb 10 '14 at 19:56
  • That is important information. Thank you. I will user FQL. – Neon Feb 10 '14 at 22:11

The FQL for this would be something like: "tax recovery" OR "service fee" OR "hotel tax" OR "hotel" AND "sales tax" OR "hotel" AND "excise tax"

If you are performing a GET you can add the "sourceid" parameter to specify the desired Result Source in 2013. In 2010 you can add the "s" parameter to indicate the scope.

  • Is that correct syntax?: OR (string("tax recovery", mode="phrase") , string("service fee", mode="phrase") , string("hotel tax", mode="phrase") , AND (string("hotel", mode="phrase"), string("sales tax", mode="phrase")) , AND (string("hotel", mode="phrase"), string("excise tax", mode="phrase")) ) – Neon Feb 11 '14 at 12:52
  • It's off the top of my head, what does "mode=phrase" gain you? I was just mimicking the initial query. – Matthew McDermott Feb 12 '14 at 13:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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