HI,
I Want to get top searched queries programatically, i am using below code to to do that
SPSecurity.RunWithElevatedPrivileges(delegate() { using (SPSite spsite = new SPSite("http://spabc1/sites/test/")) { using (SPWeb currentWeb = spsite.OpenWeb()) { SPServiceContext context = SPServiceContext.GetContext(spsite); SearchServiceApplicationProxy searchProxy = context.GetDefaultProxy(typeof(SearchServiceApplicationProxy)) as SearchServiceApplicationProxy; IList<QueryReportData> topQueries = searchProxy.GetSearchReport(1, Guid.Empty, spsite.ID, DateTime.Today.AddDays(-1.0), false, 10); //topqueries will always be 0 foreach (var query in topQueries) { //process top search term } } }});
i wanted to why is GetSearchReport always returning null/0 queries.
I need to fetch top searched items programmatically,Please do let me know if any way i can do this.