SearchListItems returns 0 results, but SharePoint search returns 5 pages of results

I am trying to call SearchListItems to programmatically retrieve search results. My code is pretty simple:

SPSite site = new SPSite(siteUrl);
SPWeb web = site.OpenWeb();
SPSearchResultCollection resultListItems = null;
resultListItems = web.SearchListItems(keyword);

      

The result of ListItems returns 0 items in milliseconds, although there are 18 lists and> 100k items on the net.

+2


source to share


2 answers


The content database did not have an index server assigned. After one of them was assigned and the full traversal was completed, the code worked as expected. Interestingly, search worked from SharePoint at all.



0


source


Does the account running the code have access to the list items? They may have been removed with a safety trimmer.

If this is not the case, another possibility is that you have not enabled full-text search in the admin center.



-Oisin

+2


source







All Articles