I was hitting a brick wall recently when implementing Episerver search. I could see that items were being queued up to be indexed:
<p> CODE: https://gist.github.com/thec2group-blog/945fa7f921412b1677a79faf3f5985a9.js</p>
However, the queue wasn’t being processed. The number of items should be zero once everything has been indexed.
First, I tried browsing to the /indexingService/indexingService.svc and got the expected “Endpoint not found” message in my browser:
So far, so good. Next, I tried to hit one of the endpoints: /indexingService/indexingService.svc/search/?q=videos&namedindexes=default&format=xml&offset=0&limit=50&accesskey=local
I expected to get a big xml dump of the search results, but instead I got a 404 response:
The first clue came from the Episerver log file:
<p> CODE: https://gist.github.com/thec2group-blog/885796b05432ee6fc436628cbc7dd12a.js</p>
Notice that last message? The site is thinking that the search endpoint is an MVC route. I checked the site’s global.asax, and sure enough, standard MVC routes are being used in addition to the Episerver routes.
<p> CODE: https://gist.github.com/thec2group-blog/8e9ea4678288855e0a53be36e426ab39.js</p>
When I take out the call to MapRoute, the endpoints start working:
I couldn’t just take that out, however, because other developers on my team were counting on that so that their custom AJAX web services would work. In the end, this problem was solved with a call to IgnoreRoute. Take note of where this call is made, because it absolutely must come before the call to MapRoute; otherwise it just won’t work.
<p> CODE: https://gist.github.com/thec2group-blog/553165e792a6909112a2701a01c60ede.js</p>