1

I am trying to convert the base Sitecore indexes from Lucene to Solr. I am using Sitecore 8.1 Update 3. I have 2 custom indexes that are still going to use Lucene for the time being so I still need the Lucene Default Index configuration enabled. Sitecore support confirmed this is allowed.

I have configured Solr, generated the schemas for these indexes, have all the cores setup in the admin for Solr. I am able to Rebuild all of the indexes using the Index Manager. My issue is that when I try to go in the content editor for example I get the following exception:

Exception: System.Xml.XmlException
Message: Data at the root level is invalid. Line 1, position 1.
Source: System.Xml
   at System.Xml.XmlTextReaderImpl.Throw(Exception e)
   at System.Xml.XmlTextReaderImpl.ParseRootLevelWhitespace()
   at System.Xml.XmlTextReaderImpl.ParseDocumentContent()
   at System.Xml.Linq.XDocument.Load(XmlReader reader, LoadOptions options)
   at System.Xml.Linq.XDocument.Parse(String text, LoadOptions options)
   at SolrNet.Impl.SolrQueryExecuter`1.Execute(ISolrQuery q, QueryOptions options)
   at Sitecore.ContentSearch.SolrProvider.LinqToSolrIndex`1.Execute(SolrCompositeQuery compositeQuery, Type resultType)
   at Sitecore.ContentSearch.SolrProvider.LinqToSolrIndex`1.FindElements[TElement](SolrCompositeQuery compositeQuery)
   at Sitecore.ContentSearch.Linq.Parsing.GenericQueryable`2.GetEnumerator()
   at System.Linq.Buffer`1..ctor(IEnumerable`1 source)
   at System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source)
   at Sitecore.ContentTesting.ContentSearch.TestingSearch.GetAllTests()
   at Sitecore.ContentTesting.Pipelines.GetContentEditorWarnings.GetContentTestingWarnings.AddSuspendedTestWarning(GetContentEditorWarningsArgs args)
   at Sitecore.ContentTesting.Pipelines.GetContentEditorWarnings.GetContentTestingWarnings.Process(GetContentEditorWarningsArgs args)
   at (Object , Object[] )
   at Sitecore.Pipelines.CorePipeline.Run(PipelineArgs args)
   at Sitecore.Shell.Applications.ContentManager.Editor.GetWarnings(Boolean hasSections)
   at Sitecore.Shell.Applications.ContentManager.Editor.Render(RenderContentEditorArgs args, Control parent)
   at Sitecore.Shell.Applications.ContentManager.ContentEditorForm.RenderEditor(Item item, Item root, Control parent, Boolean showEditor)
   at Sitecore.Shell.Applications.ContentManager.ContentEditorForm.UpdateEditor(Item folder, Item root, Boolean showEditor)
   at Sitecore.Shell.Applications.ContentManager.ContentEditorForm.Update()
   at Sitecore.Shell.Applications.ContentManager.ContentEditorForm.OnPreRendered(EventArgs e)

I am trying to pull this apart in the code, but am not having much luck at the moment. It seems strange that I can rebuild the index, but they various pieces in the Shell can't seem to use it.

  • I'd suggest checking this link here and ensuring you've not missed any of the steps: doc.sitecore.net/sitecore_experience_platform/… I've put further info on another question here which discusses all the steps for setting up solr, it may high-light a missed step for you: sitecore.stackexchange.com/questions/3532/… – Adam Seabridge Jan 17 '17 at 15:26
  • @Dport Do you use multiple index crawler for same index? – Mrunal Daftari Jan 17 '17 at 16:23
  • Make sure that the XML is well formed and also check the SOLR Logging to see if there is any error. – Hishaam Namooya Jan 17 '17 at 19:19
  • @AdamSeabridge the documentation doesn't match the existing configuration in Sitecore 8 Update 3. I don't see any initialize pipeline anywhere that I can replace the assembly reference when registering the IOC as described in the documentation. I updated the global.asax and even with this configuration, I get the issue above. – Derek Port Jan 18 '17 at 15:42
1

I found the issue for my Solr problems. In my case the issue was in the Solrconfig, not Sitecore. The issue is that the default settings for the /select request somehow were changed to return JSON.

Our team has a templated set of Solr settings. Somehow those settings got edited incorrectly thus cause JSON to be returned when XML was the expected default.

Here's the configuration that caused the problem:

<requestHandler name="/select" class="solr.SearchHandler">
  <!-- default values for query parameters can be specified, these
     will be overridden by parameters in the request
  -->
   <bool name="terms">true</bool> REMOVED
   <lst name="defaults">
     <str name="echoParams">explicit</str>
     <str name="wt">json</str> REMOVED
     <str name="indent">true</str> REMOVED
     <str name="df">text</str>
     <int name="rows">10</int>
     <bool name="terms">true</bool> REMOVED
   </lst>
   <arr name="last-components">  REMOVED ELEMENT
     <str>terms</str>
   </arr>
</requestHandler>

Where the final configuration should have looked like this:

<requestHandler name="/select" class="solr.SearchHandler">
  <!-- default values for query parameters can be specified, these
  will be overridden by parameters in the request
  -->
  <lst name="defaults">
    <str name="echoParams">explicit</str>
    <int name="rows">10</int>
  </lst>
</requestHandler>

Thank you to Sitecore support for suggesting some good troubleshooting steps. We used Fiddler to figure out that our requests were returning JSON.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.