古い Lucene の方法から Sitecore.Search を使用するようにコードを変更しています。これを行うには、ADC モジュールのクローラーを使用します。私は現在サーチャーを使用しておらず、モジュールのクローラーのみを使用しています (ただし、後の段階で変更する予定です)。
CM 環境でインデックス作成と検索機能を完全に動作させることができましたが、再構築しようとすると CD 環境で次のエラーが発生し続けます。
構成ノードが見つかりませんでした: データベース/データベース[@id='core']。
検索インデックスを再構築するために実行しているコードは CD にあります。
foreach (var options in from ListItem item in cblIndexes.Items
where item.Selected
select new JobOptions("RebuildSearchIndex", "index", global::Sitecore.Client.Site.Name, new Builder(item.Value), "Rebuild") { AfterLife = TimeSpan.FromMinutes(1.0) })
{
JobManager.Start(options);
}
このコードを CM で実行すると問題なく動作します。
失敗したインデックスの 1 つの構成:
<search>
<configuration>
<indexes>
<index id="PressReleaseIndex" type="Sitecore.Search.Index, Sitecore.Kernel">
<param desc="name">$(id)</param>
<param desc="folder">$(id)</param>
<Analyzer ref="search/analyzer" />
<locations hint="list:AddCrawler">
<web ref="search/crawlers/PressReleaseIndex" param1="web" />
</locations>
</index>
</indexes>
</configuration>
<crawlers>
<PressReleaseIndex type="scSearchContrib.Crawler.Crawlers.AdvancedDatabaseCrawler,scSearchContrib.Crawler">
<Database>$(1)</Database>
<Root>/sitecore/content/home/newsroom</Root>
<IndexAllFields>false</IndexAllFields>
<include hint="list:IncludeTemplate">
<pressrelease>{91DB1CBC-32F8-4344-A974-7F4FE5F07668}</pressrelease>
</include>
<include hint="list:IncludeField">
<title>{F8C6E41E-3C9F-45F6-8409-61F5C8F2BF19}</title>
<shortdescription>{D25294E9-03C1-4E62-968B-5410AAAD0863}</shortdescription>
<body>{A0AD83E2-1099-407C-B8D7-C123FDAAD5DD}</body>
<releasedate>{D0B594BC-2ED6-4A0E-A050-3243CD044040}</releasedate>
</include>
<fieldCrawlers hint="raw:AddFieldCrawlers">
<fieldCrawler type="scSearchContrib.Crawler.FieldCrawlers.LookupFieldCrawler,scSearchContrib.Crawler" fieldType="Droplink" />
<fieldCrawler type="scSearchContrib.Crawler.FieldCrawlers.LookupFieldCrawler,scSearchContrib.Crawler" fieldType="Droptree" />
<fieldCrawler type="scSearchContrib.Crawler.FieldCrawlers.DateFieldCrawler,scSearchContrib.Crawler" fieldType="Datetime" />
<fieldCrawler type="scSearchContrib.Crawler.FieldCrawlers.DateFieldCrawler,scSearchContrib.Crawler" fieldType="Date" />
<fieldCrawler type="scSearchContrib.Crawler.FieldCrawlers.NumberFieldCrawler,scSearchContrib.Crawler" fieldType="Number" />
<fieldCrawler type="scSearchContrib.Crawler.FieldCrawlers.MultilistFieldCrawler,scSearchContrib.Crawler" fieldType="Multilist" />
<fieldCrawler type="scSearchContrib.Crawler.FieldCrawlers.MultilistFieldCrawler,scSearchContrib.Crawler" fieldType="Treelist" />
<fieldCrawler type="scSearchContrib.Crawler.FieldCrawlers.MultilistFieldCrawler,scSearchContrib.Crawler" fieldType="TreelistEx" />
<fieldCrawler type="scSearchContrib.Crawler.FieldCrawlers.MultilistFieldCrawler,scSearchContrib.Crawler" fieldType="Checklist" />
</fieldCrawlers>
<dynamicFields hint="raw:AddDynamicFields">
<dynamicField type="Sapient.Practice.Ccmp.Common.SitecoreSearch.DynamicFields.ReleaseYearField,Sapient.Practice.Ccmp.Common" name="_releaseyear" storageType="YES" indexType="TOKENIZED" vectorType="NO" boost="1f" />
<dynamicField type="Sapient.Practice.Ccmp.Common.SitecoreSearch.DynamicFields.ReleaseMonthField,Sapient.Practice.Ccmp.Common" name="_releasemonth" storageType="YES" indexType="TOKENIZED" vectorType="NO" boost="1f" />
</dynamicFields>
<fieldTypes hint="raw:AddFieldTypes">
<!-- Text fields need to be tokenized -->
<fieldType name="single-line text" storageType="YES" indexType="TOKENIZED" vectorType="NO" boost="1f" />
<fieldType name="multi-line text" storageType="YES" indexType="TOKENIZED" vectorType="NO" boost="1f" />
<fieldType name="word document" storageType="NO" indexType="TOKENIZED" vectorType="NO" boost="1f" />
<fieldType name="html" storageType="NO" indexType="TOKENIZED" vectorType="NO" boost="1f" />
<fieldType name="rich text" storageType="NO" indexType="TOKENIZED" vectorType="NO" boost="1f" />
<fieldType name="memo" storageType="NO" indexType="TOKENIZED" vectorType="NO" boost="1f" />
<fieldType name="text" storageType="NO" indexType="TOKENIZED" vectorType="NO" boost="1f" />
<fieldType name="date" storageType="YES" indexType="TOKENIZED" vectorType="NO" boost="1f" />
</fieldTypes>
</PressReleaseIndex>
ソリューションがまだ Sitecore 6.3.1 にあったとき (Sitecore 6.5 update 5 にアップグレードしたとき) にステージング ガイドを確認し、データベースへのすべての参照を削除しましたCore
。
CD の ShowConfig ページに移動して「core」を探しても、結果が見つかりません。また、AppSettings.config、ConnectionStrings.config、または私が入手したその他の構成ファイルには、Core データベースへの参照はありません。私が見つけた限りでは、ハードコードされた Core データベースも参照していません (または、その前に問題があったはずです)。
Core データベースが参照される場所を特定できませんでした。
スタックトレースによる完全な例外:
Exception: System.Reflection.TargetInvocationException
Message: Exception has been thrown by the target of an invocation.
Source: mscorlib
at System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)
at System.RuntimeMethodHandle.InvokeMethodFast(Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at Sitecore.Reflection.ReflectionUtil.InvokeMethod(MethodInfo method, Object[] parameters, Object obj)
at Sitecore.Reflection.MethodInstance.Invoke()
at Sitecore.Jobs.JobRunner.RunMethod(JobArgs args)
at (Object , Object[] )
at Sitecore.Pipelines.PipelineMethod.Invoke(Object[] parameters)
at Sitecore.Pipelines.CorePipeline.Run(PipelineArgs args)
at Sitecore.Pipelines.CorePipeline.Run(String pipelineName, PipelineArgs args, String pipelineDomain, Boolean failIfNotExists)
at Sitecore.Pipelines.CorePipeline.Run(String pipelineName, PipelineArgs args, String pipelineDomain)
at Sitecore.Jobs.Job.ThreadEntry(Object state)
Nested Exception
Exception: System.InvalidOperationException
Message: Could not find configuration node: databases/database[@id='core']
Source: Sitecore.Kernel
at Sitecore.Diagnostics.Assert.IsTrue(Boolean condition, String format, Object[] args)
at Sitecore.Configuration.Factory.GetConfigNode(String xpath, Boolean assert)
at Sitecore.Configuration.Factory.CreateObject(String configPath, String[] parameters, Boolean assert)
at Sitecore.Configuration.Factory.CreateObject(String configPath, Boolean assert)
at Sitecore.Configuration.Factory.GetDatabase(String name, Boolean assert)
at Sitecore.Configuration.Factory.GetDatabase(String name)
at Sitecore.Web.UI.HtmlControls.Data.LookupSources.GetDatabase(String source)
at Sitecore.Data.Fields.CustomField.GetDatabase()
at Sitecore.Data.Fields.DelimitedField.ValidateLinks(LinksValidationResult result)
at Sitecore.Links.ItemLinks.AddLinks(Field field, List`1 links, ItemLinkState linkState)
at Sitecore.Links.ItemLinks.GetLinks(ItemLinkState linkState, Boolean allVersions, Boolean includeStandardValuesLinks)
at Sitecore.Search.Crawlers.DatabaseCrawler.GetItemLinks(Item item)
at Sitecore.Search.Crawlers.DatabaseCrawler.AddSpecialFields(Document document, Item item)
at Sitecore.Search.Crawlers.DatabaseCrawler.IndexVersion(Item item, Item latestVersion, IndexUpdateContext context)
at scSearchContrib.Crawler.Crawlers.AdvancedDatabaseCrawler.IndexVersion(Item item, Item latestVersion, IndexUpdateContext context)
at Sitecore.Search.Crawlers.DatabaseCrawler.AddItem(Item item, IndexUpdateContext context)
at Sitecore.Search.Crawlers.DatabaseCrawler.AddTree(Item root, IndexUpdateContext context)
at Sitecore.Search.Crawlers.DatabaseCrawler.AddTree(Item root, IndexUpdateContext context)
at Sitecore.Search.Crawlers.DatabaseCrawler.AddTree(Item root, IndexUpdateContext context)
at Sitecore.Search.Crawlers.DatabaseCrawler.AddTree(Item root, IndexUpdateContext context)
at Sitecore.Search.Crawlers.DatabaseCrawler.AddTree(Item root, IndexUpdateContext context)
at Sitecore.Search.Crawlers.DatabaseCrawler.AddTree(Item root, IndexUpdateContext context)
at Sitecore.Search.Crawlers.DatabaseCrawler.Add(IndexUpdateContext context)
at Sitecore.Search.Index.Rebuild()
at Saga.Sitecore.Web.Builder.Rebuild()