I am trying to call SearchListItems to progamatically get search resu开发者_开发知识库lts. My code is pretty simple:
SPSite site = new SPSite(siteUrl);
SPWeb web = site.OpenWeb();
SPSearchResultCollection resultListItems = null;
resultListItems = web.SearchListItems(keyword);
The resultListItems return 0 items in milliseconds even though the web has 18 lists and >100K items.
Does the account you're running the code as have access to the list items? Perhaps they're being removed by the security trimmer.
If that's not it, the other possibility is that you have not enabled FullText search in Central Administration.
-Oisin
The content database did not have an assigned index server. Once one was assigned and a full crawl was complete the code worked as expected. The interesting thing is that the search worked from SharePoint at all.
精彩评论