I have a client application that represents the complete SharePoint structure (sitecollections, sites & subsites, doclibs, folders), of any given 3rd pary SharePoint site, as a navigation tree.
Users can click on any level in that tree, and do a freetext search. They expect their search results to originate in either the selected location or below. For instance,
I’m trying to accomplish this using a restriction on the PATH property. However, whenever I include a LIKE predicate on the PATH the search results turn up empty. What am I doing wrong?
SharePoint Search SQL:
SELECT
URL,Path,FileName,Version,Size,LastModifiedTime,DocID
FROM
Scope()
WHERE
ContentClass='STS_ListItem_DocumentLibrary' AND
Path LIKE 'http://servername/doclib001/%' AND
FREETEXT(DEFAULTPROPERTIES, 'test' )
(SharePoint2010)
Querying the Path never seems to yield any results. However, querying the Site with the equals predicate operator does exactly what I want, i.e.
yields results from doclib001 als well as doclib001/folder001 and below. Which is rather unexpected, given that (a) Site suggests site/web, not arbitrary URL and (b) I’m using an exact equal operator, not a like/contains… but it works nicely, so I’m not complaining!
Non-recursive searches seem to be rather impossible thus far.