Grant Ingersoll wrote:
What's the line number that is giving the NPE? Can you paste in a stack trace?

Here it is:

java.lang.NullPointerException: value cannot be null

java.lang.RuntimeException: java.lang.NullPointerException: value cannot be null
        at org.apache.solr.search.QueryParsing.toString(QueryParsing.java:469)
        at 
org.apache.solr.handler.component.DebugComponent.process(DebugComponent.java:75)
        at 
org.apache.solr.handler.component.SearchHandler.handleRequestBody(SearchHandler.java:203)
        at 
org.apache.solr.handler.RequestHandlerBase.handleRequest(RequestHandlerBase.java:131)
        at org.apache.solr.core.SolrCore.execute(SolrCore.java:1290)
        at 
org.apache.solr.servlet.SolrDispatchFilter.execute(SolrDispatchFilter.java:338)
        at 
org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:241)
        at 
org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1115)
        at 
org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:361)
        at 
org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
        at 
org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)
        at 
org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:766)
        at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:417)
        at 
org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:230)
        at 
org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114)
        at 
org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
        at org.mortbay.jetty.Server.handle(Server.java:324)
        at 
org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:534)
        at 
org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:864)
        at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:533)
        at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:207)
        at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:403)
        at 
org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:409)
        at 
org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:522)
Caused by: java.lang.NullPointerException: value cannot be null
        at org.apache.lucene.document.Field.<init>(Field.java:323)
        at org.apache.lucene.document.Field.<init>(Field.java:298)
        at org.apache.lucene.document.Field.<init>(Field.java:277)
        at 
org.apache.solr.search.QueryParsing.writeFieldVal(QueryParsing.java:306)
        at org.apache.solr.search.QueryParsing.toString(QueryParsing.java:360)
        at org.apache.solr.search.QueryParsing.toString(QueryParsing.java:401)
        at org.apache.solr.search.QueryParsing.toString(QueryParsing.java:466)
        ... 23 more



-Grant

On Jul 27, 2009, at 10:59 AM, gwk wrote:

gwk wrote:
Hi,

I'm playing around with sorting via functionqueries, and I've set _val_ to the following:

sum(product(always_on_top,5),recip(rord(publication_date),1,1000,1000))

Where the field always_on_top is a simple boolean field, where documents with always_on_top:true should always be on top. I ran into a problem where one of the documents with always_on_top = true was all the way on the bottom instead of on top. So I extracted the query out of my system en copied it to my browser and added &debugQuery=true which gave a NullPointerException. After some searching I found out the document in question had no publication_date field set (which is totally my fault) however it took quite a while to discover this since I couldn't turn on debugQuery. Is this a bug or expected behviour?

Regards,

gwk

Oops, it seems it's due to a fq in the same query, not because of the, there's a range query on price:

fq=price:({0 TO *} OR 0)

Removing this filter makes debugQuery work however strange thing happen, I took my original query and took the first result and the last result and performing the query (on unique id) without the fq and debugQuery=true yields:

<result name="response" numFound="2" start="0" maxScore="10.288208">
<doc>
 <float name="score">10.288208</float>
 <double name="price">195500.0</double>
 <date name="publication_date">2009-06-12T12:07:11Z</date>
 <bool name="always_on_top">true</bool>
 <str name="id">695658</str>
</doc>
<doc>
 <float name="score">5.1031165</float>
 <double name="publication_date">680000.0</double>
 <bool name="always_on_top">true</bool>
 <str name="id">147563</str>
</doc>
</result>

while debug part of the response contains:

<lst name="explain">
<str name="695658">
10.287015 = (MATCH) sum of:
0.09950372 = (MATCH) MatchAllDocsQuery, product of:
 0.09950372 = queryNorm
10.187511 = (MATCH) FunctionQuery(sum(product(ord(homepage_teaser),const(5.0)),1000.0/(1.0*float(top(rord(first_publication_date)))+1000.0))), product of: 10.238322 = sum(product(ord(homepage_teaser)=2,const(5.0)),1000.0/(1.0*float(rord(first_publication_date)=3196)+1000.0))
 10.0 = boost
 0.09950372 = queryNorm
</str>
<str name="147563">
10.078215 = (MATCH) sum of:
0.09950372 = (MATCH) MatchAllDocsQuery, product of:
 0.09950372 = queryNorm
9.978711 = (MATCH) FunctionQuery(sum(product(ord(homepage_teaser),const(5.0)),1000.0/(1.0*float(top(rord(first_publication_date)))+1000.0))), product of: 10.028481 = sum(product(ord(homepage_teaser)=2,const(5.0)),1000.0/(1.0*float(rord(first_publication_date)=34112)+1000.0))
 10.0 = boost
 0.09950372 = queryNorm
</str>
</lst>

So the score in the response doesn't match the score in debugQuery's output. Does this have something to do with SOLR-947?

I'm currently using Solr 1.4 trunk (revision 787997, which is about a month old iirc)

Regards,

gwk

--------------------------
Grant Ingersoll
http://www.lucidimagination.com/

Search the Lucene ecosystem (Lucene/Solr/Nutch/Mahout/Tika/Droids) using Solr/Lucene:
http://www.lucidimagination.com/search


Reply via email to