I'm trying to get files from a Site... When i launch my query the crawler returns me data from all application on the SP installation..
The thing I'd like to do is to "restrict" this scope to a single site or site collection..
How could i do?
My code is something like this:
fullsite = URL;
myToken = UserToken;
Microsoft.SharePoint.SPSecurity.RunWithElevatedPrivileges(delegate()
{
using (SPSite scSite = new SPSite(fullsite, myToken))
{
if ((searchAllObj.tt_group_array == null) || (searchAllObj.tt_group_array.Length == 0))
{
using (SPWeb webRoot = scSite.OpenWeb())
{
webRoot.AllowUnsafeUpdates = true;
scSite.AllowUnsafeUpdates = true;
queryComposta = "keyword + Tag:Tag1 Network:NT"; //Tag and Network are working props
KeywordQuery keywordQuery = new KeywordQuery(scSite);
keywordQuery.ResultTypes = ResultType.RelevantResults;
keywordQuery.QueryText = queryComposta.ToString();
ResultTableCollection searchResultTables = keywordQuery.Execute();
}
}
});
EDIT: I'm on SP Foundation with search server 2010 express installed!