Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • DFBerry 53 posts 130 karma points
    Jul 27, 2015 @ 19:44
    DFBerry
    0

    ExamineManager.Instance.IndexProviderCollection exception in ReplaceNonAlphanumericChars

    Hi,

    I'm trying to add a test class library to Kevin's UmbracoBookshelf project.

    I get an ConfigurationErrorsException when I call ExamineManager.Instance.IndexProviderCollection["BookshelfIndexer"].RebuildIndex();

    I believe the exception is regarding the IndexPath value in the IndexSet node. I've changed it to anything I thought that would work including just "AppData/" and "/AppData/Bookshelf/."

    What am I doing wrong?

    You can see the current code at https://github.com/dfberry/UmbracoBookshelf

    I updated Umbraco and Examine to nuget latest.

    I can't get the Examine project to build but I can at least see the lines of code for ReplaceNonAlphanumericChars method and that it is regarding the IndexSet.

    My app.config for the test project is:

    <?xml version="1.0" encoding="utf-8"?> <configuration>

    <configSections> <section name="Examine" type="Examine.Config.ExamineSettings, Examine" requirePermission="false" /> <section name="ExamineLuceneIndexSets" type="Examine.LuceneEngine.Config.IndexSets, Examine" requirePermission="false" /> </configSections>

    <Examine> <ExamineIndexProviders> <providers> <add name="BookshelfIndexer" type="Examine.LuceneEngine.Providers.SimpleDataIndexer, Examine" dataService="UmbracoBookshelf.Examine.BookshelfExamineDataService,UmbracoBookshelf" runAsync="false" /> </providers> </ExamineIndexProviders> <ExamineSearchProviders defaultProvider="BookshelfSearcher"> <providers> <add name="BookshelfSearcher" type="Examine.LuceneEngine.Providers.LuceneSearcher, Examine" /> </providers> </ExamineSearchProviders> </Examine> <ExamineLuceneIndexSets> <IndexSet SetName="BookshelfIndexSet" IndexPath="App_Data\Bookshelf"> <IndexUserFields> <add Name="id" /> <add Name="book" /> <add Name="path" /> <add Name="title" /> <add Name="text" /> <add Name="url" /> </IndexUserFields> </IndexSet> </ExamineLuceneIndexSets>

    <runtime> <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> <dependentAssembly> <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" culture="neutral" /> <bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0" /> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35" culture="neutral" /> <bindingRedirect oldVersion="0.0.0.0-2.0.0.0" newVersion="2.0.0.0" /> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" /> <bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" /> </dependentAssembly> </assemblyBinding> </runtime> </configuration>

    The exception stack is: SetUp : System.Configuration.ConfigurationErrorsException : Object reference not set to an instance of an object. (C:\repositories\UmbracoBookshelf\tests\bin\Debug\UmbracoBookshelfTests.dll.config line 13) ----> System.NullReferenceException : Object reference not set to an instance of an object. at System.Web.Configuration.ProvidersHelper.InstantiateProvider(ProviderSettings providerSettings, Type providerType) at System.Web.Configuration.ProvidersHelper.InstantiateProviders(ProviderSettingsCollection configProviders, ProviderCollection providers, Type providerType) at Examine.ExamineManager.EnsureProviders() in x:\Projects\Examine\Examine\Projects\Examine\ExamineManager.cs:line 95 at Examine.ExamineManager.get_IndexProviderCollection() in x:\Projects\Examine\Examine\Projects\Examine\ExamineManager.cs:line 71 at UmbracoBookshelfTests.TestHelpers.ExamineTestBase.TestFixtureSetup() in c:\repositories\UmbracoBookshelf\tests\TestHelpers\ExamineTestBase.cs:line 26 --NullReferenceException at Examine.StringExtensions.ReplaceNonAlphanumericChars(String input, String replacement) in x:\Projects\Examine\Examine\Projects\Examine\StringExtensions.cs:line 25 at Examine.IndexSetExtensions.ReplaceTokensInIndexPath(IndexSet indexSet) in x:\Projects\Examine\Examine\Projects\Examine\IndexSetExtensions.cs:line 19 at Examine.LuceneEngine.Providers.LuceneIndexer.Initialize(String name, NameValueCollection config) in x:\Projects\Examine\Examine\Projects\Examine\LuceneEngine\Providers\LuceneIndexer.cs:line 208 at Examine.LuceneEngine.Providers.SimpleDataIndexer.Initialize(String name, NameValueCollection config) in x:\Projects\Examine\Examine\Projects\Examine\LuceneEngine\Providers\SimpleDataIndexer.cs:line 111 at System.Web.Configuration.ProvidersHelper.InstantiateProvider(ProviderSettings providerSettings, Type providerType)

    I tried building the Examine project from GitHub and debugging into it, but it doesn't build for me, even after updating dependencies. But I did look at the test's app.config and code associated with the exceptions.

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies