3

When is set setting ContentSearch.Solr.SendPostRequests to true, for searching in solr by post request because query is very big and Get not working, the next exception is thrown. Sitecore version 9.1, solr 7.2.1.

enter image description here

Updating: It seems that with solr 6.6.2 this error is not thrown but we need to use solr 7.2.1.

2

It looks like your Sorl doesn`t return response in XML format, but SendAndParseHeader method expects XML.

I think that Solr returns JSON by default (or it can also returns HTML if an error occured on Solr side).

What to try:

1) Global solution: add xml param to "/select" requestHandler in solrconfig.xml (it is commented by default):

<requestHandler name="/select" class="solr.SearchHandler">
    <lst name="defaults">
      <str name="echoParams">explicit</str>
      <int name="rows">10</int>

      <!-- Change from JSON to XML format (the default prior to Solr 7.0)-->
         <str name="wt">xml</str> 

    </lst>
</requestHandler >

2) Local solution: add xml param to your sitecore requests:

var results = context.Query<SearchResultItem>(query.ToString() + "&wt=xml"));

or you can also create QueryOption and add it to ExtraParams (and use it in all of your request where it is needed, just to have only one entry point for refactoring):

var options = new QueryOptions{
     ExtraParams = new List<KeyValuePair<string, string>>
          { new KeyValuePair<string, string>("wt", "xml") }
}

...

var results = context.Query<SearchResultItem>(query, options);

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.