2017-05-30 6 views
0

Sitecoreの各項目に異なる言語バージョンのコンテンツが保存されており、言語ごとに異なるインデックスを作成する必要があります。イタリア語とフランス語のバージョンのホームページがバージョンとして保存されている場合は、 ホーム・ページの異なる言語バージョンのインデックスは、私はインデックスの設定がSolder Indexing for Sitecore

乾杯 GAに

+0

あなたはアイテムの異なる言語バージョンを意味していますか?なぜそれらのインデックスを別々に作成したいのですか?コンテキスト言語をクエリに追加するだけで、選択した言語で検索ヒットが表示されます。 –

+0

私たちのコンテンツは各言語や他の理由で巨大であるため、異なる言語バージョンのアイテムがあります。 – user2332873

答えて

0

を提出、これを行うための唯一の方法は、カスタム・クローラを作成することにより、次のように英語を設定するサンプルコードでされている任意の設定があります言葉の言語としての言語、私はそこから始めることができると思う:

すべての情報はここで見つけることができます: https://ggullentops.blogspot.be/2016/10/custom-sitecore-index-crawler.html

private string indexLanguage; 

public string Language 
{ 
    get { return !string.IsNullOrEmpty(indexLanguage) ? indexLanguage : null; } 
    set { indexLanguage = value; } 
} 

protected override void DoAdd(IProviderUpdateContext context, SitecoreIndexableItem indexable) 
{ 
    Assert.ArgumentNotNull(context, "context"); 
    Assert.ArgumentNotNull(indexable, "indexable"); 
    using (new LanguageFallbackItemSwitcher(context.Index.EnableItemLanguageFallback)) 
    { 
    Index.Locator.GetInstance<IEvent>().RaiseEvent("indexing:adding", context.Index.Name, indexable.UniqueId, indexable.AbsolutePath); 
    if (!IsExcludedFromIndex(indexable, false)) 
    { 
     foreach (var language in indexable.Item.Languages) 
     { 
     // only include English 
     if (!language.Name.Equals(indexLanguage, StringComparison.OrdinalIgnoreCase)) 
     { 
      continue; 
     } 

     Item item; 
     using (new WriteCachesDisabler()) 
     { 
      item = indexable.Item.Database.GetItem(indexable.Item.ID, language, Version.Latest); 
     } 

     if (item == null) 
     { 
      CrawlingLog.Log.Warn(string.Format(CultureInfo.InvariantCulture, "SitecoreItemCrawler : AddItem : Could not build document data {0} - Latest version could not be found. Skipping.", indexable.Item.Uri)); 
     } 
     else 
     { 
      SitecoreIndexableItem sitecoreIndexableItem; 
      using (new WriteCachesDisabler()) 
      { 
      // only latest version 
      sitecoreIndexableItem = item.Versions.GetLatestVersion(); 
      } 

      if (sitecoreIndexableItem != null) 
      { 
      IIndexableBuiltinFields indexableBuiltinFields = sitecoreIndexableItem; 
      indexableBuiltinFields.IsLatestVersion = indexableBuiltinFields.Version == item.Version.Number; 
      sitecoreIndexableItem.IndexFieldStorageValueFormatter = context.Index.Configuration.IndexFieldStorageValueFormatter; 
      Operations.Add(sitecoreIndexableItem, context, index.Configuration); 
      } 
     } 
     } 
    } 

    Index.Locator.GetInstance<IEvent>().RaiseEvent("indexing:added", context.Index.Name, indexable.UniqueId, indexable.AbsolutePath); 
    } 
} 
+0

ありがとうございます。私はこれを試していますが、このcustomCrawlerはインデックス作成の更新と削除も行います。 – user2332873

+0

ブログの記事でも更新コードを見つけることができます。 –

+0

カスタムSitecrawalerを作成し、これをIndex設定で指定しましたが、言語固有のインデックスを取得できませんでした。たとえば、言語固有のインデックスを取得できませんでした。任意のポインタ – user2332873