I'm using Sitecore 8.2 Update 1 as PaaS on Azure. I've added some new code that is giving me a strange error.
Edit: Added more complete code
using (var context = ContentSearchManager.CreateSearchContext(new SitecoreIndexableItem(Sitecore.Context.Item)))
{
var query = context.GetQueryable<SearchResultItem>()
.Where(item => item.TemplateId == SitecoreItemIds.ISSUE_TEMPLATE &&
item.Path.StartsWith("/sitecore/content/Home/" + issueTypePath))
.OrderByDescending(item => item["Date"])
.FirstOrDefault();
if (query != null)
return query.GetItem();
return null;
}
And I'm getting this YSOD error:
Index (EMPTY) was not found
Description: An unhandled exception occurred.
Exception Details: Sitecore.ContentSearch.Exceptions.IndexNotFoundException: Index (EMPTY) was not found
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
I'm using Azure Search as the search provider. This code works on my local machine, but it's not hitting Azure Search.
I have not made any changes to files on Azure that would affect the search.
context
var?