Friday, December 2, 2011

SharePoint 2010 Document Path Search with Contains

In short I do not believe it works or at least it doesn't work in how I think it should. Look at the following query:

SELECT WorkId, Title, FileName, Path
FROM Scope()
WHERE IsDocument = 1 AND "scope"='Test-Scope' AND (CONTAINS(path, '"file://testpath/test/%"'))
ORDER BY Rank Desc

I thought the above query would return all documents within the path that started with: file://testpath/test/

It does not. I stored all the document path information in SQL Server 2008 for the files that SharePoint indexed so that I could quickly run queries to determine the accuracy of SharePoint Path query counts. The SharePoint path queries produce too few or too many results every time. In the case I was testing with I had 1417 files (all of which SharePoint successfully indexed). The SharePoint Path query only returned a little over 1200. I am investigating the issue currently and when I have put together my thoughts on what I think is happening I will report back

0 comments: