2017-10-04 63 views
0

我目前正在使用Sitecore索引 - solr和lucene。Sitecore Solr索引FieldNameTranslator爲null

我已經做了我自己的自定義索引,它對於lucene工作正常,但我無法讓它與Solr一起工作。

我的問題是,每當我使用Solr配置時,FieldNameTranslator對於我的索引都爲null。

我使用Sitecore的ContentSearch DLL來獲得指標按以下方式:

this.IndexName = indexName; 
this.index = ContentSearchManager.GetIndex(indexName);   
var i = ContentSearchManager.GetIndex("sitecore_master_index"); 

作爲一個測試,我也試着取了sitecore_master_index這似乎工作。我得到如下:

enter image description here

我得到一個指標,但每當我通過調用GetQueryable查詢它,那麼它失敗,出現以下錯誤:

Exception: System.ArgumentNullException Message: Value cannot be null. Parameter name: fieldNameTranslator Source: Sitecore.ContentSearch.Linq.Solr at Sitecore.ContentSearch.Linq.Solr.SolrIndexParameters..ctor(IIndexValueFormatter valueFormatter, IFieldQueryTranslatorMap 1 fieldQueryTranslators, FieldNameTranslator fieldNameTranslator, IExecutionContext[] executionContexts, IFieldMapReaders fieldMap, Boolean convertQueryDatesToUtc) at Sitecore.ContentSearch.SolrProvider.LinqToSolrIndex 1..ctor(SolrSearchContext context, IExecutionContext[] executionContexts) at Sitecore.ContentSearch.SolrProvider.SolrSearchContext.GetQueryable[TItem](IExecutionContext[] executionContexts)

我使用SolrNet作爲IOC其,從我可以在文檔中看到的,應該從8.2開始工作。如果我使用其他國際石油公司之一,那麼它工作得很好。

所以我的問題是真的會出現什麼問題呢?有人可以向我解釋FieldNameTranslator是什麼以及它是如何在配置中啓動的? (這裏我想它設置)

回答

0

我收到了同樣的問題,只是使用溫莎城堡的Ioc和改變你的Global.asax是這樣的:

<%@Application Language='C#' Inherits="Sitecore.ContentSearch.SolrProvider.CastleWindsorIntegration.WindsorApplication" %> 
0

我也有同樣的問題。確保您的Solr在您有sitecore訪問Solr之前運行。我剛剛得到了同樣的錯誤,切換到CasteWindsor並沒有幫助你。殺死Sitecore WP或執行IISRESET - 然後運行。