dsolovay / Sitecore-Instance-Manager

Dans's fork for hacking out a SOLR feature.
MIT License
0 stars 1 forks source link

Support Solr 5, Solr 6 #27

Closed dsolovay closed 7 years ago

dsolovay commented 8 years ago

Task checklist:

dsolovay commented 8 years ago

Works fine with 4.1 and 4.10

dsolovay commented 8 years ago

Moving this to Roadmap. 5.0 has a significantly different API (e.g cores are created from command line), and the distribution no longer ships with a "collection1". I'd like to see if there is a way to find out from the URL where the Solr file system is located, even if no core is loaded yet, Then I could implement a process similar to the one with 4.x, except that I will need to copy the conf file from server\solr\configsets\basic_configs\conf, and rename managed-schema as schema.xml. (Note: Solr 5.0.0 ships with schema.xml in the basic_configs\conf folder, but by 6.3.0 this has been renamed managed-schema.

dsolovay commented 7 years ago

Did some exploring of the Solr API, and you can access the version and path via http://localhost:8983/solr/admin/info/system.

With this in hand, we can query the Solr version, and if 5.0 or above, we can generate the instanceDir from the basic_configs directory.

dsolovay commented 7 years ago

As an interim step, throwing meaningful error if Solr 5:

image

dsolovay commented 7 years ago

Index creation appears to work with 5.0, but I am getting this error when I try to build the index:

ERROR: [doc=sitecore://master/{975ca216-d3ea-43a9-af69-964daab8bc11}?lang=da&ver=1&ndx=sitecore_master_index] unknown field 'name_t_da'

dsolovay commented 7 years ago

Receiving this error when rebuilding "sitecore_master_index" on Sitecore 8.2 with Solr 5.0.0:

Job started: Index_Update_IndexName=sitecore_master_index|#Exception: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> SolrNet.Exceptions.SolrConnectionException: <?xml version="1.0" encoding="UTF-8"?>
<response>
<lst name="responseHeader"><int name="status">400</int><int name="QTime">1</int></lst><lst name="error"><str name="msg">This IndexSchema is not mutable.</str><int name="code">400</int></lst>
</response>
 ---> System.Net.WebException: The remote server returned an error: (400) Bad Request.
   at System.Net.HttpWebRequest.GetResponse()
   at HttpWebAdapters.Adapters.HttpWebRequestAdapter.GetResponse()
   at SolrNet.Impl.SolrConnection.GetResponse(IHttpWebRequest request)
   at SolrNet.Impl.SolrConnection.PostStream(String relativeUrl, String contentType, Stream content, IEnumerable`1 parameters)
   --- End of inner exception stack trace ---
   at SolrNet.Impl.SolrConnection.PostStream(String relativeUrl, String contentType, Stream content, IEnumerable`1 parameters)
   at SolrNet.Impl.SolrConnection.Post(String relativeUrl, String s)
   at SolrNet.Impl.SolrBasicServer`1.SendAndParseHeader(ISolrCommand cmd)
   at Sitecore.ContentSearch.SolrProvider.SolrBatchUpdateContext.AddRange(IEnumerable`1 group, Int32 groupSize)
   at Sitecore.ContentSearch.SolrProvider.SolrBatchUpdateContext.Commit()
   at Sitecore.ContentSearch.SolrProvider.SolrSearchIndex.PerformRebuild(Boolean resetIndex, Boolean optimizeOnComplete, IndexingOptions indexingOptions, CancellationToken cancellationToken)
   at Sitecore.ContentSearch.SolrProvider.SolrSearchIndex.Rebuild(Boolean resetIndex, Boolean optimizeOnComplete)
   --- End of inner exception stack trace ---
   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)
   at Sitecore.Jobs.Job.ThreadEntry(Object state)
dsolovay commented 7 years ago

And with 6.3.0, I get this error when rebuilding sitecore_master_index:

Job started: Index_Update_IndexName=sitecore_master_index|#Exception: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> SolrNet.Exceptions.SolrConnectionException: <?xml version="1.0" encoding="UTF-8"?>
<response>
<lst name="responseHeader"><int name="status">400</int><int name="QTime">0</int></lst><lst name="error"><lst name="metadata"><str name="error-class">org.apache.solr.common.SolrException</str><str name="root-error-class">org.apache.solr.common.SolrException</str></lst><str name="msg">This IndexSchema is not mutable.</str><int name="code">400</int></lst>
</response>
 ---> System.Net.WebException: The remote server returned an error: (400) Bad Request.
   at System.Net.HttpWebRequest.GetResponse()
   at HttpWebAdapters.Adapters.HttpWebRequestAdapter.GetResponse()
   at SolrNet.Impl.SolrConnection.GetResponse(IHttpWebRequest request)
   at SolrNet.Impl.SolrConnection.PostStream(String relativeUrl, String contentType, Stream content, IEnumerable`1 parameters)
   --- End of inner exception stack trace ---
   at SolrNet.Impl.SolrConnection.PostStream(String relativeUrl, String contentType, Stream content, IEnumerable`1 parameters)
   at SolrNet.Impl.SolrConnection.Post(String relativeUrl, String s)
   at SolrNet.Impl.SolrBasicServer`1.SendAndParseHeader(ISolrCommand cmd)
   at Sitecore.ContentSearch.SolrProvider.SolrBatchUpdateContext.AddRange(IEnumerable`1 group, Int32 groupSize)
   at Sitecore.ContentSearch.SolrProvider.SolrBatchUpdateContext.Commit()
   at Sitecore.ContentSearch.SolrProvider.SolrSearchIndex.PerformRebuild(Boolean resetIndex, Boolean optimizeOnComplete, IndexingOptions indexingOptions, CancellationToken cancellationToken)
   at Sitecore.ContentSearch.SolrProvider.SolrSearchIndex.Rebuild(Boolean resetIndex, Boolean optimizeOnComplete)
   --- End of inner exception stack trace ---
   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)
   at Sitecore.Jobs.Job.ThreadEntry(Object state)
dsolovay commented 7 years ago

Looks like issue is this element:

<processor class="solr.AddSchemaFieldsUpdateProcessorFactory">

Thanks, Stack Overflow! http://stackoverflow.com/a/31721587/402949

dsolovay commented 7 years ago

Tested 8.1 against Solr 6.3, and 8.2 update 1 against Solr 4.10, Solr 5.0 and Solr 6.3. Testing consisted of rebuilding the sitecore_master_index and confirming that: (A) documents appeared in Solr, and (B) content editor search worked. I also rebuilt all indexes for the SC 8.2 + Solr 6.3 instance.

As noted in #41, Sitecore 8.0 is not working with Solr installation. This looks like a preexisting issue.