I searched using the endpoint:


But this returned an exception:

 "error": {
        "code": "",
        "message": "An error has occurred.",
        "innererror": {
            "message": "Object reference not set to an instance of an object.",
            "type": "System.NullReferenceException",
            "stacktrace": "   at Sitecore.ContentSearch.SitecoreItemCrawler.IsExcludedFromIndex(SitecoreIndexableItem indexable, Boolean checkLocation)\r\n   at Sitecore.ContentSearch.SitecoreItemCrawler.GetContextIndexRanking(IIndexable indexable)\r\n   at System.Linq.Enumerable.WhereSelectListIterator`2.MoveNext()\r\n   at System.Linq.Enumerable.Min(IEnumerable`1 source)\r\n   at Sitecore.ContentSearch.AbstractSearchIndex.Sitecore.ContentSearch.Pipelines.GetContextIndex.IContextIndexRankable.GetContextIndexRanking(IIndexable indexable)\r\n   at Sitecore.ContentSearch.Pipelines.GetContextIndex.FetchIndex.<>c__DisplayClass6_0.<RankContextIndexes>b__0(ISearchIndex i)\r\n   at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext()\r\n   at System.Linq.Buffer`1..ctor(IEnumerable`1 source)\r\n   at 

Anyone else experienced this?

  • Does your Sorl instance is running and available?
    – x3mxray
    Commented May 22, 2020 at 10:24
  • also, make sure no error in the rebuild index. Commented May 22, 2020 at 10:45

1 Answer 1


Exception is thrown in code:

public static IProviderSearchContext CreateSearchContext(IIndexable indexable)
  return GetIndex(indexable).CreateSearchContext(SearchSecurityOptions.EnableSecurityCheck);

Sitecore translates the IIndexable into a valid index for item. And then it creates a search context on that index.

The exception is thrown because the translation returns null (some item from your query doesn’t map to any index).

Make sure that itemservice search index is configured as “index all templates, except specific ones”, but NOT as “exclude all templates, except specific ones”.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.