私は現在 Sitecore と連携しており、Create New Content パーツを作成しました。これにより、最も使用されている 8 つのテンプレートと使用回数を示すポップアップが開きます。
問題は、テンプレートの数が多すぎると時間がかかりすぎることです (現在、最も多いテンプレートは 11k を超えています)。
最も使用されている 8 つのテンプレートを取得するために使用しているコードは次のとおりです。
データベースからすべてのアイテムを取得します。
var allItems = db.GetItem("/sitecore/content").Axes.GetDescendants();
そして、最も使用頻度の高い 8 つを取得します。
var mostUsedTemplates = allItems.GroupBy(x => x.TemplateID)
.Select(x => new { TemplateID = x.Key, Count = x.Count() })
.OrderByDescending(x => x.Count).Take(8);
Lucene を実装しましたが、使い方がまったくわかりません。
すべてのテンプレートを取得し、それらを数え、最も使用されている 8 つのテンプレートを取得する方法を検索しようとしましたが、何も見つかりませんでした。
つまり、コンテンツ内のアイテムの作成に使用されたすべてのテンプレートを数え、最も多い 8 つのテンプレートを復元する必要があります。
どんな助けでも大歓迎です。ありがとう。
これの拡張: これは私が現在作成している構成です。すべてのテンプレートを含めて、それらを数えられるようにしようとしています。
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
<sitecore>
<search>
<configuration>
<indexes>
<index id="usage_template_count" type="Sitecore.Search.Index, Sitecore.Kernel">
<param desc="name">$(id)</param>
<param desc="folder">usage_template_count</param>
<Analyzer ref="search/analyzer" />
<locations hint="list:AddCrawler">
For what I understand, here is what I specify what to index.
From what I read, I know how to include some templates, or excludes others, but no idea how to include ALL.
Also don´t know if I have to set up something in the config to be able to count the results.
</locations>
</index>
</indexes>
</configuration>
</search>
</sitecore>
</configuration>
再度、感謝します!