lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kay Wrobel <>
Subject Re: How to debug empty ParsedQuery from Edismax Query Parser
Date Fri, 04 Jan 2019 17:33:07 GMT
I'd like to follow up on this post here because it has become relevant to me now.

I have set up a debugging environment and took a deep-dive into the SOLR 7.6.0 source code
with Eclipse as my IDE of choice for this task. I have isolated the exact line as to where
things fall apart for my two sample queries that I have been testing with, which are "q=a3f*"
and "q=aa3f*. As you can see here, the only visible difference between the two search terms
are that the second search term has two characters in succession before switching to a numerical

First things first, the Extended Dismax Query Parser hands over portions of the parsing to
the Standard Query Parser early on the the parsing process. Following down the rabbit hole,
I ended up in SolrQueryParserBase.getPrefixQuery() method. On line 1173 of this method, we
have the following statement:

	termStr = analyzeIfMultitermTermText(field, termStr, schema.getFieldType(field));

This statement, when executing with the "a3f" search term, returns "a3f" as a result. However,
when using "aa3f", it throws a SolrException with excatly the same multi-term error as shown
below, only like this:
> analyzer returned too many terms for multiTerm term: aa3f

At this point, I would like to reiterate the purpose of our search: we are a part number house.
We deal with millions of part numbers in our system and on our web site. A customer of ours
typically searches our site with a given part number (or SKU if you will). Some part numbers
are intelligent, and so customers might reduce the part number string to a portion at the
beginning. Either way, it is *not* a typical "word" based search. Yet, the system (Drupal)
does treat those two query fields like standard "Text" search fields. Those who know Drupal
Commerce will recognize the Title field of a node and also possible the Product Variation
or (SKU) field.

With that in mind, multi-term was introduced with SOLR 5, and I think this error (or limitation)
has probably been in SOLR 5 since then. Can anyone closer to the matter or having struggled
with this same issue chime in on the subject?

Kind regards,


> On Dec 28, 2018, at 9:57 AM, Kay Wrobel <> wrote:
> Here are my log entries:
> SOLR 7.x (non-working)
> 2018-12-28 15:36:32.786 INFO  (qtp1769193365-20) [   x:collection1] o.a.s.c.S.Request
[collection1]  webapp=/solr path=/select params={q=ac6023*&qf=tm_field_product^21.0&qf=tm_title_field^8.0&EchoParams=all&rows=10&wt=xml&debugQuery=true}
hits=0 status=0 QTime=2
> SOLR 4.x (working)
> INFO  - 2018-12-28 15:43:41.938; org.apache.solr.core.SolrCore; [collection1] webapp=/solr
path=/select params={q=ac6023*&qf=tm_field_product^21.0&qf=tm_title_field^8.0&EchoParams=all&rows=10&wt=xml&debugQuery=true}
hits=32 status=0 QTime=8 
> EchoParams=all did not show anything different in the resulting XML from SOLR 7.x.
> I found out something curious yesterday. When I try to force the Standard query parser
on SOLR 7.x using the same query, but adding "defType=lucene" at the beginning, SOLR 7 raises
a SolrException with this message: "analyzer returned too many terms for multiTerm term: ac6023"
(full response:
> Log entry for that request:
> 2018-12-28 15:50:58.804 ERROR (qtp1769193365-15) [   x:collection1] o.a.s.h.RequestHandlerBase
org.apache.solr.common.SolrException: analyzer returned too many terms for multiTerm term:
>        at org.apache.solr.schema.TextField.analyzeMultiTerm(
>        at org.apache.solr.parser.SolrQueryParserBase.analyzeIfMultitermTermText(
>        at org.apache.solr.parser.SolrQueryParserBase.getPrefixQuery(
>        at org.apache.solr.parser.SolrQueryParserBase.handleBareTokenQuery(
>        at org.apache.solr.parser.QueryParser.Term(
>        at org.apache.solr.parser.QueryParser.Clause(
>        at org.apache.solr.parser.QueryParser.Query(
>        at org.apache.solr.parser.QueryParser.TopLevelQuery(
>        at org.apache.solr.parser.SolrQueryParserBase.parse(
>        at
>        at
>        at org.apache.solr.handler.component.QueryComponent.prepare(
>        at org.apache.solr.handler.component.SearchHandler.handleRequestBody(
>        at org.apache.solr.handler.RequestHandlerBase.handleRequest(
>        at org.apache.solr.core.SolrCore.execute(
>        at org.apache.solr.servlet.HttpSolrCall.execute(
>        at
>        at org.apache.solr.servlet.SolrDispatchFilter.doFilter(
>        at org.apache.solr.servlet.SolrDispatchFilter.doFilter(
>        at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(
>        at org.eclipse.jetty.servlet.ServletHandler.doHandle(
>        at org.eclipse.jetty.server.handler.ScopedHandler.handle(
>        at
>        at org.eclipse.jetty.server.handler.HandlerWrapper.handle(
>        at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(
>        at org.eclipse.jetty.server.session.SessionHandler.doHandle(
>        at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(
>        at org.eclipse.jetty.server.handler.ContextHandler.doHandle(
>        at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(
>        at org.eclipse.jetty.servlet.ServletHandler.doScope(
>        at org.eclipse.jetty.server.session.SessionHandler.doScope(
>        at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(
>        at org.eclipse.jetty.server.handler.ContextHandler.doScope(
>        at org.eclipse.jetty.server.handler.ScopedHandler.handle(
>        at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(
>        at org.eclipse.jetty.server.handler.HandlerCollection.handle(
>        at org.eclipse.jetty.server.handler.HandlerWrapper.handle(
>        at org.eclipse.jetty.rewrite.handler.RewriteHandler.handle(
>        at org.eclipse.jetty.server.handler.HandlerWrapper.handle(
>        at org.eclipse.jetty.server.Server.handle(
>        at org.eclipse.jetty.server.HttpChannel.handle(
>        at org.eclipse.jetty.server.HttpConnection.onFillable(
>        at$ReadCallback.succeeded(
>        at
>        at$
>        at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.runTask(
>        at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(
>        at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.tryProduce(
>        at
>        at org.eclipse.jetty.util.thread.ReservedThreadExecutor$
>        at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(
>        at org.eclipse.jetty.util.thread.QueuedThreadPool$
>        at
> 2018-12-28 15:50:58.809 INFO  (qtp1769193365-15) [   x:collection1] o.a.s.c.S.Request
[collection1]  webapp=/solr path=/select params={q=ac6023*&defType=lucene&qf=tm_field_product^21.0&qf=tm_title_field^8.0&rows=10&wt=xml&debugQuery=true}
status=400 QTime=5
> Could this be a multi-term issue, but EDisMax does not actually raise an exception???
>> On Dec 27, 2018, at 9:32 PM, Alexandre Rafalovitch <> wrote:
>> EchoParams=all
>> May also be helpful to pinpoint differences in params from all sources,
>> including request handler defaults.
>> Regards,
>>   Alex
>> On Thu, Dec 27, 2018, 8:25 PM Shawn Heisey < wrote:
>>> On 12/27/2018 10:47 AM, Kay Wrobel wrote:
>>>> Now starting from SOLR version 5+, I receive zero (0) results back, but
>>> more importantly, the Query Parser produces an empty parsedQuery.
>>>> Here is the same query issued to SOLR 7.6.0 (current version):
>>>> <>
>>>> Notice how "parsedQuery" now shows "+()"; an empty query string.
>>> I can duplicate this result on a 7.5.0 example config by sending an
>>> edismax query with undefined parameters for df and qf. The other
>>> field-related parameters for edismax are also undefined.  The following
>>> URL parameters with the default example config will produce that parsed
>>> query:
>>> q=ac6023*&defType=edismax&df=&qf=&debugQuery=on
>>> When a query is made and Solr's logging configuration is at its default
>>> setting, Solr will log a line into its logfile containing all of the
>>> parameters in the query, both those provided on the URL and those set by
>>> Solr's configuration (solrconfig.xml).  Can you share this log line from
>>> both the version that works and the version that doesn't?
>>> This is the log line created when I ran the query mentioned above:
>>> 2018-12-27 23:03:23.199 INFO  (qtp315932542-23) [   x:baz]
>>> o.a.s.c.S.Request [baz]  webapp=/solr path=/select
>>> params={q=ac6023*&defType=edismax&df=&qf=&debugQuery=on} hits=0
>>> QTime=0
>>> What I'm thinking is that there is a difference in the configuration of
>>> the two servers or the actual query being sent is different.  Either
>>> way, there's something different.  The two log lines that I have asked
>>> for are likely to be different from each other in some way that will
>>> explain what you're seeing.
>>> Thanks,
>>> Shawn


The information in this e-mail is confidential and is intended solely for 
the addressee(s). Access to this email by anyone else is unauthorized. If 
you are not an intended recipient, you may not print, save or otherwise 
store the e-mail or any of the contents thereof in electronic or physical 
form, nor copy, use or disseminate the information contained in the email.  
If you are not an intended recipient,  please notify the sender of this 
email immediately.

View raw message