Monday, September 28, 2009

Wildcards in the CONTAINS Predicate in Windows SharePoint Services Search SQL Syntax - no results

If you get no results with CONTAINS and wildcard search in MOSS make sure you don't forget the " in the query. The MSDN documentation does not include them.

wrong: select title, author, rank from scope() where CONTAINS (defaultproperties, 'sharep*') order by rank desc

correct: select title, author, rank from scope() where CONTAINS (defaultproperties, '"sharep*"') order by rank desc

I recommend http://www.codeplex.com/SPSearchBench for testing.

No comments: