Gravatar for juanpablo.albuja@verndale.com

Question by jpalbuja, Jan 13, 2016 11:43 AM

Coveo Search REST Endpoint () Error

Hi everyone, I have Coveo Coveo Enterprise Search 7.0 x64 (7914) for Sitecore.exe installed in my local machine and all the coveo services are working like indexing etc. Also the service in http://localhost:8080/rest/search is up. The problem is that the Sitecore Diagnostics page shows the following:

The remote server returned an error: (500) Internal Server Error. (Hide details)
System.Net.WebException: The remote server returned an error: (500) Internal Server Error.
   at System.Net.HttpWebRequest.GetResponse()
   at Coveo.SearchProvider.Applications.StateVerifier.<>c__DisplayClassd.<GetRestEndpointState>b__c()
   at Coveo.SearchProvider.Applications.BaseVerifier.VerifyComponent(Func`1 p_VerifyMethod, String p_ComponentName)

The tokens are the same but not sure what is going wrong this was working before.

What could be?

1 Reply
Gravatar for jflheureux@coveo.com

Answer by Jean-François L'Heureux, Jan 13, 2016 11:54 AM

Is http://YourSitecoreInstance/coveo/rest working? The REST endpoint checks is for that endpoint. This endpoint transfers the requests to the http://CoveoSearchApiHostName:8080/rest/search endpoint.

Also, are you accessing the diagnostic page with http://TheSitecoreInstanceName/ on the Sitecore server itself or you are accessing it from another computer by the Sitecore hostname like http://YourSitecoreSite.com/ ?

There are a few checks who produce false-negative failures when the diagnostics page is accessed remotely. I don't remember if the REST endpoint check is one of those.

Try accessing it locally from a browser on the Sitecore server with the local URL of the Sitecore website.

Gravatar for juanpablo.albuja@verndale.com

Comment by jpalbuja, Jan 13, 2016 12:06 PM

Hi @jflheureux, also I created a an MVC search page from Sitecore and I see the following error:

"An index should be configured for database"

Yes I am working everything local.

Do you think that this could be related with a patch file that I created to change the names of the coveo indexes?

I create a fil and I named it as "z_Coveo.SearchProviderCustom.config" with the following content.

<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
   <sitecore>
     <contentSearch>
       <configuration type="Coveo.SearchProvider.Configuration.CoveoSearchConfiguration, Coveo.SearchProvider">
         <indexes hint="list:AddIndex">
           <index patch:instead="*[@id='Coveo_master_index']" id="xyz_master_index" type="Coveo.SearchProvider.ProviderIndex, Coveo.SearchProvider">
             <param desc="p_Name">$(id)</param>
             <locations hint="list:AddCrawler">
               <crawler type="Coveo.SearchProvider.CoveoItemCrawler, Coveo.SearchProviderBase">
                 <Database>master</Database>
                 <Root>/sitecore/content</Root>
                 <StopOnError>true</StopOnError>
               </crawler>
             </locations>
             <strategies hint="list:AddStrategy">
               <strategy type="Sitecore.ContentSearch.Maintenance.Strategies.SynchronousStrategy, Sitecore.ContentSearch">
                 <param desc="database">master</param>
               </strategy>
             </strategies>
             <propertyStore type="Sitecore.ContentSearch.Maintenance.IndexDatabasePropertyStore, Sitecore.ContentSearch">
               <Key>$(id)</Key>
               <Database>core</Database>
             </propertyStore>
           </index>
           <index patch:instead="*[@id='Coveo_web_index']" id="xyz_web_index" type="Coveo.SearchProvider.ProviderIndex, Coveo.SearchProvider">
             <param desc="p_Name">$(id)</param>
             <locations hint="list:AddCrawler">
               <crawler type="Coveo.SearchProvider.CoveoItemCrawler, Coveo.SearchProviderBase">
                 <Database>web</Database>
                 <Root>/sitecore/content</Root>
                 <StopOnError>true</StopOnError>
               </crawler>
             </locations>
             <strategies hint="list:AddStrategy">
               <strategy type="Sitecore.ContentSearch.Maintenance.Strategies.OnPublishEndAsynchronousStrategy, Sitecore.ContentSearch">
                 <param desc="database">web</param>
                 <CheckForThreshold>true</CheckForThreshold>
               </strategy>
             </strategies>
             <propertyStore type="Sitecore.ContentSearch.Maintenance.IndexDatabasePropertyStore, Sitecore.ContentSearch">
               <Key>$(id)</Key>
               <Database>core</Database>
             </propertyStore>
           </index>
         </indexes>
       </configuration>
     </contentSearch>
   </sitecore>
 </configuration>
 

Also in the Coveo MVC page I see the message "An index should be configured for database "web". But there it is. So not sure what it means

Gravatar for jflheureux@coveo.com

Comment by Jean-François L'Heureux, Jan 13, 2016 12:20 PM

Coveo for Sitecore UI controls need the root of the indexes to be /sitecore for various reasons. Not following this requirement lead to various exceptions in the search pages and REST endpoint. You should change them to:

<Root>/sitecore</Root>
Gravatar for juanpablo.albuja@verndale.com

Comment by jpalbuja, Jan 13, 2016 1:06 PM

Hi @jflheureux thanks a lot for this explanation and yes that fixed the issue. The problem is that I want that the published site uses the XYZ_web_index and the sitecore preview mode uses the XYZ_master_index (Coveo indexes). And I want to have optimized indexes, so I want to index only the /sitecore/content data for those indexes. So for that reason I patch my indexes like above. but If I do that the MVC Coveo search page and the search API connection between Sitecore and the app breaks.

So what should be the recommendation if I want to achieve the above?

Gravatar for jflheureux@coveo.com

Comment by Jean-François L'Heureux, Jan 13, 2016 3:42 PM

> The problem is that I want that the published site uses the XYZ_web_index and the sitecore preview mode uses the XYZ_master_index (Coveo indexes)

This is automatic with Coveo for Sitecore. In Edit/Preview/Explore modes, the UI is using the first Coveo index found indexing the master database. In Published mode, the UI is using the first Coveo index found indexing the web database.

> I want to index only the /sitecore/content data for those indexes.

You should create a processor for the `` pipeline to exclude anything not in /sitecore/content. This inbound filter pipeline is run only for Coveo indexes. Since you are on Sitecore 8, it means that the Lucene indexes used by the Content Editor search won't be affected by your filtering.

Gravatar for juanpablo.albuja@verndale.com

Comment by jpalbuja, Jan 14, 2016 2:42 PM

Hi @jflheureux, actually I tried to create a patch in order to do not modify the original Coveo Search Provider file like

<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
  <sitecore>
      <pipelines>
        <coveoInboundFilterPipeline>
          <processor type="Project.Website.Configuration.CustomInboundIndexFilter, Project.Website"/>
        </coveoInboundFilterPipeline>
      </pipelines>

And I can see in the /sitecore/admin/showconfig.aspx the following:

<coveoInboundFilterPipeline patch:source="Coveo.SearchProvider.config">
  <processor type="Coveo.SearchProvider.InboundFilters.ApplySitecoreInboundFilterProcessor, Coveo.SearchProviderBase"/>
  <processor type="Project.Website.Configuration.CustomInboundIndexFilter, Project.Website" patch:source="z_Coveo.SearchProviderCustom.config"/>
</coveoInboundFilterPipeline>

When I reindex the site and I debug the code I see that the method public override void Process(InboundIndexFilterArgs args) of my class is never called. Do I am doing something wrong?

Thanks

Gravatar for jflheureux@coveo.com

Comment by Jean-François L'Heureux, Jan 14, 2016 4:32 PM

Is there any error in the logs during the rebuild of the indexes? Have you attached to the w3wp.exe process in Managed .Net 4.5 mode or native mode? You need Managed for debugging to work.

Gravatar for juanpablo.albuja@verndale.com

Comment by jpalbuja, Jan 15, 2016 12:35 PM

Hi @jflheureux, , I find the fix here. Thanks so much.

Gravatar for jflheureux@coveo.com

Comment by Jean-François L'Heureux, Jan 15, 2016 1:16 PM

Can you describe the fix for the benefit of the community please?

Ask a question