Quantcast
Channel: SharePoint 2013 - Development and Programming forum
Viewing all articles
Browse latest Browse all 25064

SearchServiceApplicationProxy.GetSearchReport returning null or 0

$
0
0

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.


Viewing all articles
Browse latest Browse all 25064

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>