If you're using Solr 6.4 then the expression you're running won't work,
because on numeric comparisons are supported.

Solr 6.5 will have the expanded Evaluator functionality, which has string
comparisons.

In the expression you're working with it would be much more performant
though to filter the query on the storeid.

Joel Bernstein
http://joelsolr.blogspot.com/

On Mon, Mar 13, 2017 at 1:06 PM, Pratik Patel <pra...@semandex.net> wrote:

> Hi,
>
> I am trying to write a streaming expression with 'having' function in it.
> Following is my simple query.
>
>
> having(
> >    search(collection1,q="*:*",fl="storeid",sort="storeid
> > asc",fq=tags:"Company"),
> >    eq(storeid,524efcfd505637004b1f6f24)
> > )
>
>
> Here, storeid is a field of type "string" in schema. But when I execute
> this query in admin UI, I am getting a  NumberFormatException.
>
> Here is the response in admin UI.
>
>
> { "result-set": { "docs": [ { "EXCEPTION": "For input string:
> \"524efcfd505637004b1f6f24\"", "EOF": true } ] } }
>
> If I change storeid value to 123 in the boolean evaluator then it works
> fine. I tried to quote the original value so that we have
> eq(storeid,"524efcfd505637004b1f6f24") but still it fails with same
> exception.
>
> Here is the detailed stack trace from log file.
>
>
> ERROR - 2017-03-13 16:56:39.516; [c:collection1 s:shard1 r:core_node1
> > x:collection1_shard1_replica1] org.apache.solr.common.SolrException;
> > java.io.IOException: Unable to construct instance of
> > org.apache.solr.client.solrj.io.stream.HavingStream
> > at
> > org.apache.solr.client.solrj.io.stream.expr.StreamFactory.
> createInstance(StreamFactory.java:358)
> > at
> > org.apache.solr.client.solrj.io.stream.expr.StreamFactory.
> constructStream(StreamFactory.java:222)
> > at
> > org.apache.solr.client.solrj.io.stream.expr.StreamFactory.
> constructStream(StreamFactory.java:215)
> > at
> > org.apache.solr.handler.StreamHandler.handleRequestBody(
> StreamHandler.java:212)
> > at
> > org.apache.solr.handler.RequestHandlerBase.handleRequest(
> RequestHandlerBase.java:166)
> > at org.apache.solr.core.SolrCore.execute(SolrCore.java:2306)
> > at org.apache.solr.servlet.HttpSolrCall.execute(HttpSolrCall.java:658)
> > at org.apache.solr.servlet.HttpSolrCall.call(HttpSolrCall.java:464)
> > at
> > org.apache.solr.servlet.SolrDispatchFilter.doFilter(
> SolrDispatchFilter.java:345)
> > at
> > org.apache.solr.servlet.SolrDispatchFilter.doFilter(
> SolrDispatchFilter.java:296)
> > 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.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.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)
> > Caused by: java.lang.reflect.InvocationTargetException
> > at sun.reflect.GeneratedConstructorAccessor26.newInstance(Unknown
> Source)
> > at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown
> > Source)
> > at java.lang.reflect.Constructor.newInstance(Unknown Source)
> > at
> > org.apache.solr.client.solrj.io.stream.expr.StreamFactory.
> createInstance(StreamFactory.java:351)
> > ... 34 more
> > Caused by: java.io.IOException: Unable to construct instance of
> > org.apache.solr.client.solrj.io.ops.EqualsOperation
> > at
> > org.apache.solr.client.solrj.io.stream.expr.StreamFactory.
> createInstance(StreamFactory.java:358)
> > at
> > org.apache.solr.client.solrj.io.stream.expr.StreamFactory.
> constructOperation(StreamFactory.java:339)
> > at
> > org.apache.solr.client.solrj.io.stream.HavingStream.<init>(
> HavingStream.java:72)
> > ... 38 more
> > Caused by: java.lang.reflect.InvocationTargetException
> > at sun.reflect.GeneratedConstructorAccessor27.newInstance(Unknown
> Source)
> > at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown
> > Source)
> > at java.lang.reflect.Constructor.newInstance(Unknown Source)
> > at
> > org.apache.solr.client.solrj.io.stream.expr.StreamFactory.
> createInstance(StreamFactory.java:351)
> > ... 40 more
> > Caused by: java.lang.NumberFormatException: For input string:
> > "524efcfd505637004b1f6f24"
> > at sun.misc.FloatingDecimal.readJavaFormatString(Unknown Source)
> > at sun.misc.FloatingDecimal.parseDouble(Unknown Source)
> > at java.lang.Double.parseDouble(Unknown Source)
> > at
> > org.apache.solr.client.solrj.io.ops.LeafOperation.<init>(
> LeafOperation.java:48)
> > at
> > org.apache.solr.client.solrj.io.ops.EqualsOperation.<init>(
> EqualsOperation.java:42)
> > ... 44 more
>
>
> I can see that solr is trying to parse storeid as double and hence the
> NumberFormatException, even though this field is of type String in schema.
> How can I fix this?
>
>
> Thanks,
> Pratik
>

Reply via email to