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

Your search cannot be completed because no search service is available- SP2013

$
0
0

Hi,

We have an application page, in which we need to retrieve the search results in SP2013. However, the query always returns the error "your search cannot be completed because no search service is available". Please find the code below.

 using (SPSite site = new SPSite("http://server"))
                {
                    using (SPWeb web = site.OpenWeb())
                    {
                        Microsoft.SharePoint.Search.Query.FullTextSqlQuery kq = new FullTextSqlQuery(site);
                       // KeywordQuery kq = new KeywordQuery(site);

                        //KeywordQuery kq = new KeywordQuery(site);
                        kq.SourceId = new Guid(SourceID_Value);
                        kq.QueryText = keyword;
                        kq.RowLimit = 100;
                        kq.AuthenticationType = QueryAuthenticationType.NtAuthenticatedQuery;

                        ResultTableCollection resultTables = new SearchExecutor().ExecuteQuery(kq);
                        ResultTable resultTableFinal = new ResultTable();

                        resultTableFinal = resultTables[ResultType.RelevantResults];
                    }
                }

However, the same code works in a console application executed on the same server. Please let know if you have faced this issue and the solution.


Sreeharsha Alagani | MCTS Sharepoint 2010 | Linkedin | Blog



Viewing all articles
Browse latest Browse all 7589

Latest Images

Trending Articles



Latest Images