I have a fairly straight forward Umbraco site (v4.9.1) which contains a number of Razor Macros. I've attempted to add an Examine Index to create a simple site search and am hitting the following problems:
The Examine index is not created
Razor scripts that were working are now failing
I've tried to provide full details below. What am I missing or getting wrong?
My ExamineSettings.config is as follows:
<?xml version="1.0"?>
<!--
Umbraco examine is an extensible indexer and search engine.
This configuration file can be extended to add your own search/index providers.
Index sets can be defined in the ExamineIndex.config if you're using the standard provider model.
<?xml version="1.0"?> <!-- Umbraco examine is an extensible indexer and search engine. This configuration file can be extended to create your own index sets. Index/Search providers can be defined in the UmbracoSettings.config More information and documentation can be found on CodePlex: http://umbracoexamine.codeplex.com --> <configuration> <configSections> <section name="ExamineLuceneIndexSets" type="Examine.LuceneEngine.Config.IndexSets, Examine"/> </configSections> <ExamineLuceneIndexSets> <!-- The internal index set used by Umbraco back-office - DO NOT REMOVE --> <IndexSet SetName="InternalIndexSet" IndexPath="~/App_Data/TEMP/ExamineIndexes/Internal/"> <IndexAttributeFields> <add Name="id" /> <add Name="nodeName" /> <add Name="updateDate" /> <add Name="writerName" /> <add Name="path" /> <add Name="nodeTypeAlias" /> <add Name="parentID" /> </IndexAttributeFields> <IndexUserFields /> <IncludeNodeTypes/> <ExcludeNodeTypes /> </IndexSet> <IndexSet SetName="FrontEndIndexSet" IndexPath="~/App_Data/ExamineIndexes/FrontEnd/"> <IndexAttributeFields> <add Name="nodeName" /> <add Name="path" /> </IndexAttributeFields> <add Name="pageTitle" /> <add Name="pageDisplayTitle" /> <add Name="pageSummary" /> <add Name="mainContent" /> <add Name="column1" /> <add Name="column2" /> <add Name="column3" /> <add Name="column4" /> <add Name="listTitle" /> <add Name="listEntries" /> <IndexUserFields /> <IncludeNodeTypes> <add Name="HomePage" /> <add Name="Page" /> </IncludeNodeTypes> <ExcludeNodeTypes /> </IndexSet> <!-- The internal index set used by Umbraco back-office for indexing members - DO NOT REMOVE --> <IndexSet SetName="InternalMemberIndexSet" IndexPath="~/App_Data/TEMP/ExamineIndexes/InternalMember/"> <IndexAttributeFields> <add Name="id" /> <add Name="nodeName"/> <add Name="updateDate" /> <add Name="writerName" /> <add Name="loginName" /> <add Name="email" /> <add Name="nodeTypeAlias" /> </IndexAttributeFields> <IndexUserFields/> <IncludeNodeTypes/> <ExcludeNodeTypes /> </IndexSet> <!-- Default Indexset for external searches, this indexes all fields on all types of nodes--> <IndexSet SetName="ExternalIndexSet" IndexPath="~/App_Data/TEMP/ExamineIndexes/External/" /> </ExamineLuceneIndexSets> </configuration>
And a previosly working now failing Razor Macro (HomeGallerImages.cshtml):
@using umbraco.MacroEngines @inherits DynamicNodeContext @if (Model.HasValue("galleryImages")) { string[] ids = Model.GalleryImages.Split(','); <ul class="rslides"> @foreach (string id in ids) { var node = Library.NodeById(id); if (node.Id != 0) { // If node exists: <li><img src="@node.Url" /><span>@Html.Raw(node.AltText.Replace("\n","<br />"))</span></li> } } </ul> }
this fails on the line:
var node = Library.NodeById(id);
Generating the following error:
Error Loading Razor Script (file: Home Gallery Images) The type initializer for 'Examine.ExamineManager' threw an exception. at umbraco.MacroEngines.ExamineBackedMedia.GetUmbracoMedia(Int32 id) at umbraco.MacroEngines.DynamicBackingItem..ctor(Int32 Id) at umbraco.MacroEngines.DynamicNode..ctor(String NodeId) at umbraco.MacroEngines.Library.RazorLibraryCore.NodeById(String Id) at ASP._Page_macroScripts_HomeGalleryImages_cshtml.Execute() in c:\Users\ ... \macroScripts\HomeGalleryImages.cshtml:line 10 at System.Web.WebPages.WebPageBase.ExecutePageHierarchy() at System.Web.WebPages.WebPage.ExecutePageHierarchy() at System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage) at umbraco.MacroEngines.RazorMacroEngine.ExecuteRazor(MacroModel macro, INode currentPage) at umbraco.MacroEngines.RazorMacroEngine.Execute(MacroModel macro, INode currentPage)
Looking at the umbracoLog table in the DB I see the following error after 'Application started' and 'Loading content from disk cache...' when the app pool is restarted:
Error loading application startup handler: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.TypeInitializationException: The type initializer for 'Examine.ExamineManager' threw an exception. ---> System.TypeInitializationException: The type initializer for 'Examine.Config.ExamineSettings' threw an exception. ---> System.Configuration.ConfigurationErrorsException: The format of a configSource file must be an element containing the name of the section. (C:\Users\...\config\ExamineSettings.config line 9) at System.Configuration.BaseConfigurationRecord.EvaluateOne(String[] keys, SectionInput input, Boolean isTrusted, FactoryRecord factoryRecord, SectionRecord sectionRecord, Object parentResult) at System.Configuration.BaseConfigurationRecord.Evaluate(FactoryRecord factoryRecord, SectionRecord sectionRecord, Object parentResult, Boolean getLkg, Boolean getRuntimeObject, Object& result, Object& resultRuntimeObject) at System.Configuration.BaseConfigurationRecord.GetSectionRecursive(String configKey, Boolean getLkg, Boolean checkPermission, Boolean getRuntimeObject, Boolean requestIsHere, Object& result, Object& resultRuntimeObject) at System.Configuration.BaseConfigurationRecord.GetSection(String configKey) at System.Configuration.ConfigurationManager.GetSection(String sectionName) at Examine.Config.ExamineSettings..cctor() --- End of inner exception stack trace --- at Examine.ExamineManager.LoadProviders() at Examine.ExamineManager..cctor() --- End of inner exception stack trace --- at umbraco.presentation.umbraco.Search.ExamineEvents..ctor() --- End of inner exception stack trace --- at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck) at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark) at System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark) at System.Activator.CreateInstance(Type type, Boolean nonPublic) at System.Activator.CreateInstance(Type type) at umbraco.businesslogic.ApplicationStartupHandler..cctor()
followed by
Error loading application startup handler: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.TypeInitializationException: The type initializer for 'Examine.ExamineManager' threw an exception. ---> System.TypeInitializationException: The type initializer for 'Examine.Config.ExamineSettings' threw an exception. ---> System.Configuration.ConfigurationErrorsException: The format of a configSource file must be an element containing the name of the section. (C:\Users\...\config\ExamineSettings.config line 9) at System.Configuration.BaseConfigurationRecord.EvaluateOne(String[] keys, SectionInput input, Boolean isTrusted, FactoryRecord factoryRecord, SectionRecord sectionRecord, Object parentResult) at System.Configuration.BaseConfigurationRecord.Evaluate(FactoryRecord factoryRecord, SectionRecord sectionRecord, Object parentResult, Boolean getLkg, Boolean getRuntimeObject, Object& result, Object& resultRuntimeObject) at System.Configuration.BaseConfigurationRecord.GetSectionRecursive(String configKey, Boolean getLkg, Boolean checkPermission, Boolean getRuntimeObject, Boolean requestIsHere, Object& result, Object& resultRuntimeObject) at System.Configuration.BaseConfigurationRecord.GetSection(String configKey) at System.Configuration.ConfigurationManager.GetSection(String sectionName) at Examine.Config.ExamineSettings..cctor() --- End of inner exception stack trace --- at Examine.ExamineManager.LoadProviders() at Examine.ExamineManager..cctor() --- End of inner exception stack trace --- at UmbracoExamine.UmbracoEventManager..ctor() --- End of inner exception stack trace --- at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck) at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark) at System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark) at System.Activator.CreateInstance(Type type, Boolean nonPublic) at System.Activator.CreateInstance(Type type) at umbraco.businesslogic.ApplicationStartupHandler..cctor()
Finally I don't know if this is relevent but after a publish I get the following error in the umbracoLog table immediately before the 'Xml saved in 00:00:00.00xxxxx':
Error adding to SiteMapProvider in loadNodes(): System.InvalidOperationException: Multiple nodes with the same URL '/' were found. XmlSiteMapProvider requires that sitemap nodes have unique URLs. at System.Web.StaticSiteMapProvider.AddNode(SiteMapNode node, SiteMapNode parentNode) at umbraco.presentation.nodeFactory.UmbracoSiteMapProvider.loadNodes(String parentId, SiteMapNode parentNode)
The last error you are getting this is due to sitemap providor remove the sitemap config from your web.config if you are not using. Also for YOUR indexers only change the analysers from whitespace to Standard in the ExamineSettings.config. Also how are you rebuilding indexes? Do you have Darrens admin tool installed?
To try and creat my index I'm refeshing the app pool and then publishing the root node and then looking to see if there are any files in the App_Data\ExamineIndexes folder (is that correct?)
No I've not got Darren's admin tool, I'll go looking for it now.
So far the chnage of the Indexer to Standard has made no difference
Fantastic, Installing the Examine Dashboard (http://our.umbraco.org/projects/developer-tools/examine-dashboard) helped fix it!
Once installed it processes the config files and gives standard .net errors in the 'Developer' section on the backend showing mistakes in my config files.
I had a silly mistake in my XML where a set of 'Add' lines were before the 'IndexUserFields' tag they should have been contained in.
Examine Problem
I have a fairly straight forward Umbraco site (v4.9.1) which contains a number of Razor Macros. I've attempted to add an Examine Index to create a simple site search and am hitting the following problems:
My ExamineIndex.config is as follows:
And a previosly working now failing Razor Macro (HomeGallerImages.cshtml):
this fails on the line:
Generating the following error:
Looking at the umbracoLog table in the DB I see the following error after 'Application started' and 'Loading content from disk cache...' when the app pool is restarted:
followed by
Finally I don't know if this is relevent but after a publish I get the following error in the umbracoLog table immediately before the 'Xml saved in 00:00:00.00xxxxx':
Mathew,
The last error you are getting this is due to sitemap providor remove the sitemap config from your web.config if you are not using. Also for YOUR indexers only change the analysers from whitespace to Standard in the ExamineSettings.config. Also how are you rebuilding indexes? Do you have Darrens admin tool installed?
Regards
Ismail
Hi Ismail,
Thanks for the quick response.
Fantastic, Installing the Examine Dashboard (http://our.umbraco.org/projects/developer-tools/examine-dashboard) helped fix it!
Once installed it processes the config files and gives standard .net errors in the 'Developer' section on the backend showing mistakes in my config files.
I had a silly mistake in my XML where a set of 'Add' lines were before the 'IndexUserFields' tag they should have been contained in.
Many thanks
is working on a reply...