我正在更改我的代码以使用旧 Lucene 方式的 Sitecore.Search。为此,我使用了ADC 模块中的爬虫。我目前没有使用搜索器,只是模块中的爬虫(尽管我们希望在稍后阶段更改为它)。
我设法让索引和搜索功能在我的 CM 环境中完美运行,但是当我尝试重建时,CD 环境不断给出以下错误:
找不到配置节点:databases/database[@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 上运行此代码可以正常工作。
我对失败索引之一的配置:
<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 页面并查找“核心”时,我没有找到任何结果。AppSettings.config、ConnectionStrings.config 或我拥有的任何其他配置文件中也没有对 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()