3

I'm trying to setup SOLR Cloud to work with my Sitecore 9.0 (Update-1) instance. I'm using 3 different VMs with [1-Zookeeper + 1-SOLR 6.6.2] configured on all machines. I have added the following collection to the SOLR.

enter image description here

The following code snippet, I used in a sublayout to print all items with templatename “Person”.

var index = Sitecore.ContentSearch.ContentSearchManager.GetIndex("sitecore_web_index");
using (var context = index.CreateSearchContext())
{
    var results = context.GetQueryable<Sitecore.ContentSearch.SearchTypes.SearchResultItem>()
        .Where(i => i.TemplateName == "Person");
            Response.Write("<h3>Search Results</h3><br />");
    Response.Write("<b>Total Item Count :: </b>" + results.Count());
    foreach (SearchResultItem searchResultItem in results)
    {

        Response.Write(searchResultItem.Path + "<br />");
    }
}

When I'm trying to print search result for the above code snippet, getting the following error :-

5108 04:52:14 ERROR <?xml version="1.0" encoding="UTF-8"?>
<response>
<lst name="responseHeader"><bool name="zkConnected">true</bool><int name="status">500</int><int name="QTime">24</int><lst name="params"><str name="q">_templatename:(Person)</str><str name="fq">_indexname:(sitecore_web_index)</str><str name="rows">2147483647</str><str name="wt">xml</str><str name="version">2.2</str></lst></lst><lst name="error"><str name="trace">java.lang.NegativeArraySizeException
    at org.apache.lucene.util.PriorityQueue.&lt;init&gt;(PriorityQueue.java:63)
    at org.apache.lucene.util.PriorityQueue.&lt;init&gt;(PriorityQueue.java:44)
    at org.apache.solr.handler.component.ShardFieldSortedHitQueue.&lt;init&gt;(ShardFieldSortedHitQueue.java:45)
    at org.apache.solr.handler.component.QueryComponent.mergeIds(QueryComponent.java:991)
    at org.apache.solr.handler.component.QueryComponent.handleRegularResponses(QueryComponent.java:775)
    at org.apache.solr.handler.component.QueryComponent.handleResponses(QueryComponent.java:754)
    at org.apache.solr.handler.component.SearchHandler.handleRequestBody(SearchHandler.java:429)
    at org.apache.solr.handler.RequestHandlerBase.handleRequest(RequestHandlerBase.java:173)
    at org.apache.solr.core.SolrCore.execute(SolrCore.java:2477)
    at org.apache.solr.servlet.HttpSolrCall.execute(HttpSolrCall.java:723)
    at org.apache.solr.servlet.HttpSolrCall.call(HttpSolrCall.java:529)
    at org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:361)
    at org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:305)
    at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1691)
    at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:582)
    at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)
    at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:548)
    at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:226)
    at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1180)
    at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:512)
    at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185)
    at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1112)
    at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
    at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:213)
    at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:119)
    at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:134)
    at org.eclipse.jetty.rewrite.handler.RewriteHandler.handle(RewriteHandler.java:335)
    at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:134)
    at org.eclipse.jetty.server.Server.handle(Server.java:534)
    at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:320)
    at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:251)
    at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:273)
    at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:95)
    at org.eclipse.jetty.io.ssl.SslConnection.onFillable(SslConnection.java:202)
    at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:273)
    at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:95)
    at org.eclipse.jetty.io.SelectChannelEndPoint$2.run(SelectChannelEndPoint.java:93)
    at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.executeProduceConsume(ExecuteProduceConsume.java:303)
    at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.produceConsume(ExecuteProduceConsume.java:148)
    at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.run(ExecuteProduceConsume.java:136)
    at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:671)
    at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:589)
    at java.lang.Thread.run(Unknown Source)
</str><int name="code">500</int></lst>
</response>

Exception: SolrNet.Exceptions.SolrConnectionException
Message: <?xml version="1.0" encoding="UTF-8"?>
<response>
<lst name="responseHeader"><bool name="zkConnected">true</bool><int name="status">500</int><int name="QTime">24</int><lst name="params"><str name="q">_templatename:(Person)</str><str name="fq">_indexname:(sitecore_web_index)</str><str name="rows">2147483647</str><str name="wt">xml</str><str name="version">2.2</str></lst></lst><lst name="error"><str name="trace">java.lang.NegativeArraySizeException
    at org.apache.lucene.util.PriorityQueue.&lt;init&gt;(PriorityQueue.java:63)
    at org.apache.lucene.util.PriorityQueue.&lt;init&gt;(PriorityQueue.java:44)
    at org.apache.solr.handler.component.ShardFieldSortedHitQueue.&lt;init&gt;(ShardFieldSortedHitQueue.java:45)
    at org.apache.solr.handler.component.QueryComponent.mergeIds(QueryComponent.java:991)
    at org.apache.solr.handler.component.QueryComponent.handleRegularResponses(QueryComponent.java:775)
    at org.apache.solr.handler.component.QueryComponent.handleResponses(QueryComponent.java:754)
    at org.apache.solr.handler.component.SearchHandler.handleRequestBody(SearchHandler.java:429)
    at org.apache.solr.handler.RequestHandlerBase.handleRequest(RequestHandlerBase.java:173)
    at org.apache.solr.core.SolrCore.execute(SolrCore.java:2477)
    at org.apache.solr.servlet.HttpSolrCall.execute(HttpSolrCall.java:723)
    at org.apache.solr.servlet.HttpSolrCall.call(HttpSolrCall.java:529)
    at org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:361)
    at org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:305)
    at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1691)
    at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:582)
    at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)
    at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:548)
    at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:226)
    at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1180)
    at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:512)
    at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185)
    at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1112)
    at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
    at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:213)
    at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:119)
    at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:134)
    at org.eclipse.jetty.rewrite.handler.RewriteHandler.handle(RewriteHandler.java:335)
    at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:134)
    at org.eclipse.jetty.server.Server.handle(Server.java:534)
    at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:320)
    at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:251)
    at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:273)
    at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:95)
    at org.eclipse.jetty.io.ssl.SslConnection.onFillable(SslConnection.java:202)
    at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:273)
    at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:95)
    at org.eclipse.jetty.io.SelectChannelEndPoint$2.run(SelectChannelEndPoint.java:93)
    at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.executeProduceConsume(ExecuteProduceConsume.java:303)
    at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.produceConsume(ExecuteProduceConsume.java:148)
    at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.run(ExecuteProduceConsume.java:136)
    at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:671)
    at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:589)
    at java.lang.Thread.run(Unknown Source)
</str><int name="code">500</int></lst>
</response>

Source: SolrNet
   at SolrNet.Impl.SolrConnection.Get(String relativeUrl, IEnumerable`1 parameters)
   at SolrNet.Impl.SolrQueryExecuter`1.Execute(ISolrQuery q, QueryOptions options)
   at Sitecore.ContentSearch.SolrProvider.LinqToSolrIndex`1.GetResult(SolrCompositeQuery compositeQuery, QueryOptions queryOptions)

Nested Exception

Exception: System.Net.WebException
Message: The remote server returned an error: (500) Internal Server Error.
Source: System
   at System.Net.HttpWebRequest.GetResponse()
   at HttpWebAdapters.Adapters.HttpWebRequestAdapter.GetResponse()
   at SolrNet.Impl.SolrConnection.GetResponse(IHttpWebRequest request)
   at SolrNet.Impl.SolrConnection.Get(String relativeUrl, IEnumerable`1 parameters)

I am using Azure loadbalancer to connect to SOLR CLOUD. I'm able to successfully query on SOLR dashboard. But when I do a search query from my CD or CM envirnment,

Response.Write("<b>Total Item Count :: </b>" + results.Count());

It prints the total result count. But when the control enters the foreach loop, it throws the error.

foreach (SearchResultItem searchResultItem in results)

I believe the issue might be with SOLR Cloud configuration on distributed environment. How do I figure out what is wrong here? Thanks !

3
  • 1
    Where is ContentSearch.Solr.ServiceBaseAddress pointing to? Is it pointing to loadbalancer? If yes, can you browse to loadbalancer url and query the same way as in Solr dashboard?
    – grg
    May 24, 2018 at 9:26
  • Do you have a value for the setting ContentSearch.SearchMaxResults in your Sitecore config? I've had a problem very similar to this and it turned out that SearchMaxResults is int.Max unless defined in your config. Sending the int.Max (2^31-1) value in queries to Solr gives all kinds of strange errors. If not set, set SearchMaxResults to something like 1000 or so.
    – mikaelnet
    Sep 20, 2018 at 12:35
  • the issue was with my loadbalancer configuration. It's resolved. Thank you all for the support. Oct 12, 2018 at 6:34

0

Your Answer

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

Browse other questions tagged or ask your own question.