Copied to clipboard

Flag this post as spam?

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


  • Thobias 14 posts 104 karma points
    Mar 02, 2016 @ 08:11
    Thobias
    0

    Examine Search Provider in Test Environment

    Hey @all,

    i am trying to set up a test project for my site, especially for my search request on examine index. The index in working well in the umbraco site but not in my test project.

    This is my code which is causing the exception:

    var index = ExamineManager.Instance.SearchProviderCollection["ApartmentCatalogIndexer"];
    

    This is the following exception/stacktrace:

    System.Configuration.ConfigurationErrorsException : Exception has been thrown by the target of an invocation. (C:\Users\Thobi\AppData\Local\Temp\c23yba53.cr1\config\ExamineSettings.config line 12) ----> System.Reflection.TargetInvocationException : Exception has been thrown by the target of an invocation. ----> 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 98 at Examine.ExamineManager.getSearchProviderCollection() in x:\Projects\Examine\Examine\Projects\Examine\ExamineManager.cs:line 60 at UmbracoProject.WebsiteTest.UnitTests.Website.Index.IndexSearchTest.IndexSearchTestSearchRegionWithSpecialCharacters() in c:\Users\Thobi\Repository\UmbracoProject\UmbracoProject.WebsiteTest\UnitTests\Website\Index\IndexSearchTest.cs:line 26 --TargetInvocationException 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.Activator.CreateInstance(Type type, Boolean nonPublic) at System.Activator.CreateInstance(Type type) at System.Web.HttpRuntime.CreatePublicInstance(Type type) at System.Web.Configuration.ProvidersHelper.InstantiateProvider(ProviderSettings providerSettings, Type providerType) --NullReferenceException at UmbracoExamine.UmbracoContentIndexer..ctor()

    The config files seems to be okay for me and i also copied the existing index to the debug output folder.

    Has anyone an idea, whats wrong?

  • Kasper Holm 47 posts 180 karma points
    Mar 04, 2016 @ 14:35
    Kasper Holm
    0

    Hello Thobias

    Can i see your Examine configs i believe that the culparete :)

  • Thobias 14 posts 104 karma points
    Mar 14, 2016 @ 10:21
    Thobias
    0

    ExamineSettings.config

     <?xml version="1.0"?>
     <Examine>
       <ExamineIndexProviders>
         <providers>
            <add name="InternalIndexer" type="UmbracoExamine.UmbracoContentIndexer, UmbracoExamine"
               interval="1"
               supportUnpublished="true"
               supportProtected="true"
               analyzer="Lucene.Net.Analysis.WhitespaceAnalyzer, Lucene.Net"/>
    
          <add name="InternalMemberIndexer" type="UmbracoExamine.UmbracoMemberIndexer, UmbracoExamine"
               supportUnpublished="true"
               supportProtected="true"
               analyzer="Lucene.Net.Analysis.Standard.StandardAnalyzer, Lucene.Net"/>
    
            <!-- default external indexer, which excludes protected and unpublished pages-->
            <add name="ExternalIndexer" type="UmbracoExamine.UmbracoContentIndexer, UmbracoExamine"/>
    
          <add name="ApartmentCatalogIndexer" type="UmbracoExamine.UmbracoContentIndexer, UmbracoExamine"
           supportUnpublished="false"
           supportProtected="false"
           interval="10"
           analyzer="Lucene.Net.Analysis.Standard.StandardAnalyzer, Lucene.Net"
           indexSet="ApartmentCatalog"/>
        </providers>
      </ExamineIndexProviders>
    
      <ExamineSearchProviders defaultProvider="ExternalSearcher">
        <providers>
          <add name="InternalSearcher" type="UmbracoExamine.UmbracoExamineSearcher, UmbracoExamine"
               analyzer="Lucene.Net.Analysis.WhitespaceAnalyzer, Lucene.Net"/>
    
          <add name="ExternalSearcher" type="UmbracoExamine.UmbracoExamineSearcher, UmbracoExamine" />
    
          <add name="InternalMemberSearcher" type="UmbracoExamine.UmbracoExamineSearcher, UmbracoExamine"
               analyzer="Lucene.Net.Analysis.Standard.StandardAnalyzer, Lucene.Net" enableLeadingWildcard="true"/>
    
          <add name="ApartmentCatalogSearcher" type="UmbracoExamine.UmbracoExamineSearcher, UmbracoExamine"
           analyzer="Lucene.Net.Analysis.Standard.StandardAnalyzer, Lucene.Net" indexSet="ApartmentCatalog" enableLeadingWildcards="true"/>
        </providers>
      </ExamineSearchProviders>
    
    </Examine>
    

    ExamineIndex.config

    <?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
    -->
    <ExamineLuceneIndexSets>
      <!-- The internal index set used by Umbraco back-office - DO NOT REMOVE -->
      <IndexSet SetName="InternalIndexSet" IndexPath="~/App_Data/TEMP/ExamineIndexes/Internal/"/>
    
      <!-- 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>
      </IndexSet>
    
      <!-- Default Indexset for external searches, this indexes all fields on all types of nodes-->
      <IndexSet SetName="ExternalIndexSet" IndexPath="~/App_Data/TEMP/ExamineIndexes/External/" />
    
      <IndexSet SetName="ApartmentCatalog" IndexPath="~/App_Data/TEMP/ExamineIndexes/ApartmentCatalog/">
        <IndexAttributeFields>
          <add Name="id" />
          <add Name="updateDate" />
          <add Name="writerName" />
          <add Name="path" />
          <add Name="nodeTypeAlias" />
          <add Name="parentID" />
        </IndexAttributeFields>
        <IndexUserFields>
          <add Name="providerId"/>
          <add Name="title"/>
        </IndexUserFields>
        <IncludeNodeTypes>
          <add Name="Apartment"/>
        </IncludeNodeTypes>
        <ExcludeNodeTypes>
        </ExcludeNodeTypes>
      </IndexSet>
    </ExamineLuceneIndexSets>
    

    For me its looking fine, do you see something wrong?

    The config files are located at the /debug/config folder in the test procect. Maybe the location is the problem? But while running the config files are copied to the temp folder.

    Thanks for your help.

  • Thobias 14 posts 104 karma points
    Mar 14, 2016 @ 14:53
    Thobias
    100

    Update:

    This is a Examine issue. The AppDomainAppId is not null checked. In case that its a class library for unit testing, the AppDomainAppId is null.

    We can close this ticket.

  • Inoshika Fernando 4 posts 74 karma points
    Oct 06, 2019 @ 21:23
    Inoshika Fernando
    0

    Hi there, Can you please explain further about how you fixed this issue? I have the same error and struggling to fix that yet. My error message is as follows

    Message: System.Configuration.ConfigurationErrorsException : Exception has been thrown by the target of an invocation. (C:\Users\inoshika.fernando\source\trn-umbraco\NZME.Tests\bin\Debug\config\ExamineSettings.config line 12) ----> System.Reflection.TargetInvocationException : Exception has been thrown by the target of an invocation. ----> System.NullReferenceException : Object reference not set to an instance of an object. Stack Trace: at ProvidersHelper.InstantiateProvider(ProviderSettings providerSettings, Type providerType) at ProvidersHelper.InstantiateProviders(ProviderSettingsCollection configProviders, ProviderCollection providers, Type providerType) at ExamineManager.EnsureProviders() in ExamineManager.cs line: 111 at ExamineManager.getSearchProviderCollection() in ExamineManager.cs line: 75 at ExamineSingleBackgroundWingsStrategyTest.ExamineShouldreturnSameBackgroundWings_Model(String image) in ExamineSingleBackgroundWingsStrategyTest.cs line: 43 at --TargetInvocationException at RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck) at RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark) at RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark) at Activator.CreateInstance(Type type, Boolean nonPublic) at Activator.CreateInstance(Type type) at HttpRuntime.CreatePublicInstanceByWebObjectActivator(Type type) at ProvidersHelper.InstantiateProvider(ProviderSettings providerSettings, Type providerType) at --NullReferenceException at UmbracoContentIndexer.ctor()

    Many thanks...

Please Sign in or register to post replies

Write your reply to:

Draft