I am trying to get a custom solr index to work in sitecore 10.2 running in containers.


        <?xml version="1.0" encoding="utf-8" ?>
    <configuration xmlns:patch="http://www.sitecore.net/xmlconfig/" 
        <sitecore role:require="Standalone or ContentDelivery or 
         ContentManagement" search:require="solr">
                <indexes hint="list:AddIndex">
                    <index id="sitecore_passportal_web_index" 
                        <param desc="name">$(id)</param>
                        <param desc="core">$(id)</param>
                        <param desc="propertyStore" 
param1="$(id)" />
                    <configuration ref="contentSearch/indexConfigurations/passPortalSolrIndexConfiguration" />
                    <strategies hint="list:AddStrategy">
                        <strategy ref="contentSearch/indexConfigurations/indexUpdateStrategies/manual" role:require="(ContentManagement and !Indexing) or (ContentDelivery and !Indexing)"/>
                        <strategy ref="contentSearch/indexConfigurations/indexUpdateStrategies/onPublishEndAsyncSingleInstance" role:require="Standalone or (ContentManagement and Indexing) or (ContentDelivery and Indexing)" />
                    <locations hint="list:AddCrawler">
                        <crawler type="Sitecore.ContentSearch.SitecoreItemCrawler, Sitecore.ContentSearch">

I am able to index and see items in solr.

running this code I do not get any results

            using (var searchContext = _passPortalSearchContextProvider.CreateContext())

                IQueryable<BenefitSearchResultItem> results =
                        //.Where(x => x.Path.StartsWith(siteRootPath))
                        .Where(x => x.TemplateId == Benefit.TEMPLATE_ID)
                        //.Where(x => x.RenewalCodes.Contains(renewalCode))

                return results;

So I tried changing the config to using a switch on rebuild solr index

                <index id="sitecore_passportal_web_index" type="Sitecore.ContentSearch.SolrProvider.SwitchOnRebuildSolrSearchIndex, Sitecore.ContentSearch.SolrProvider">
                    <param desc="name">$(id)</param>
                    <param desc="core">$(id)</param>
                    <param desc="rebuildcore">$(id)_rebuild</param>

I get the following error when trying to rebuild the index in the sitecore control panel

ManagedPoolThread #4 05:57:11 INFO  Job started: Index_Update_IndexName=sitecore_passportal_web_index
ManagedPoolThread #4 05:57:11 ERROR Exception
Exception: System.Reflection.TargetInvocationException
Message: Exception has been thrown by the target of an invocation.
Source: mscorlib
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
   at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
   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.Jobs.JobRunner.RunMethod(JobArgs args)
   at (Object , Object )
   at Sitecore.Pipelines.CorePipeline.Run(PipelineArgs args)
   at Sitecore.Pipelines.DefaultCorePipelineManager.Run(String pipelineName, PipelineArgs args, String pipelineDomain, Boolean failIfNotExists)
   at Sitecore.Pipelines.DefaultCorePipelineManager.Run(String pipelineName, PipelineArgs args, String pipelineDomain)
   at Sitecore.Jobs.DefaultJob.DoExecute()
   at Sitecore.Abstractions.BaseJob.ThreadEntry(Object state)

Nested Exception

Exception: SolrNet.Exceptions.SolrConnectionException
Message: <html>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
<title>Error 404 Not Found</title>
<body><h2>HTTP ERROR 404 Not Found</h2>
<tr><th>MESSAGE:</th><td>Not Found</td></tr>
  • 2
    Does this answer your question? Creating a custom Solr core using solr-init container in docker Aug 4, 2023 at 15:12
  • The custom core is created. The gap is in that he is unable to query what is in Solr. Its 10.2 so wondering if something changed in how Solr queries should be written.
    – Kode
    Aug 4, 2023 at 15:31
  • Please add _passPortalSearchContextProvider to your question? Or confirm it is calling ContentSearchProvider.getindex("your-index-name"). Also when you run the code shown above, there should be a corresponding log entry generated in search logs. Do you see this? If so, try navigating to SOLR dashboard => query and pasting in the query (after the ?q=) in the url. Alter to find correct query. Finally, the switch on rebuild error you are seeing is because you have not created the rebuild core. To do this, copy the original core, delete data, then rename the core in core.properties file. Aug 4, 2023 at 19:39
  • Ken - When you switched to index on rebuild, did you create an alternate index for the rebuild? So, in total, you should have 2 indexes - 1 for the main and 1 for rebuild. From your exception, it looks like you haven't created the index for rebuild. Please create a rebuild index and try to index it from Sitecore. Aug 7, 2023 at 14:53
  • Got it to work. Wound up being how I created the new solr indexes. The instructions provided by @MichaelWest worked
    – Ken Tucker
    Aug 14, 2023 at 15:23


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.