Данный ключ отсутствует в словаре. - Исключение Sol rnet и CommonServicelocator - PullRequest
0 голосов
/ 13 января 2020

Мы используем Sol rNet в Sitecore CMS, которая также имеет оболочку над Solr. Но чтобы использовать возможности Sol rNet, мы предпочли использовать Sol rnet.

. Я обновил это приложение sitecore, и, похоже, оно также инициализирует ServiceLocator для Solr. это конфликтует с Sol rnet ServiceLocator. Ниже приведен код и трассировка стека ошибок, которые мы используем для инициализации Sol rnet. Я не уверен, как отладить или устранить эту ошибку, попросить кого-нибудь предоставить несколько указателей для этого или видел эту ошибку раньше.

Startup.Init (loggingSolrConnection);

Sol rnet версия - 1.0.13, также пробовал с последней версией 1.0.19. Папка Bin содержит - Commonservicelocator.dll и CommonServicelocator.sol rnet .dll

The given key was not present in the dictionary.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Collections.Generic.KeyNotFoundException: The given key was not present in the dictionary.

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.

Stack Trace:
[KeyNotFoundException: The given key was not present in the dictionary.]
   System.ThrowHelper.ThrowKeyNotFoundException() +36
   System.Collections.Generic.Dictionary`2.get_Item(TKey key) +52
   SolrNet.Utils.Container.DoGetInstance(Type serviceType, String key) +25
   CommonServiceLocator.ServiceLocatorImplBase.GetInstance(Type serviceType, String key) +54

[ActivationException: Activation error occurred while trying to get instance of type ISolrMoreLikeThisHandlerQueryResultsParser`1, key ""]
   CommonServiceLocator.ServiceLocatorImplBase.GetInstance(Type serviceType, String key) +155
   CommonServiceLocator.ServiceLocatorImplBase.GetInstance() +54

1 Ответ

0 голосов
/ 17 января 2020

Sitecore разработан для абстрагирования реализации поисковой системы от разработчика, так что Solr / Azure Search / Elasti c Search / Coveo / (любой другой движок) можно использовать под капотом.

Хотя эта ошибка указывает на отсутствие регистрации ISolrMoreLikeThisHandlerQueryResultsParser, которая должна быть добавлена ​​в OOB Sitecore через Sitecore.ContentSearch.SolrProvider.SolrNetIntegration.DefaultSolrLocator.Initialize или в SOLR native через SolrNet.Startup.InitContainer API, я рекомендую вам избегать прямого обращения с SOLR и использовать вместо этого API Sitecore .

В противном случае вы можете столкнуться с другим поведением, вызванным обходом Sitecore logi c.

Не могли бы вы кратко изложить причины / случаи использования, когда OOB Sitecore API недостаточно?

...