You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Gintautas Sulskus <gi...@gmail.com> on 2016/11/01 10:59:23 UTC

Re: Getting NullPointerException in an attempt to boost query result by date

Hi Markus,

I have been fiddling with the query for a while and it seems that the
"boost" line is the culprit. Unless I comment it out, I always get the
NullPointerExcpetion:
{!boost b=recip(ms(NOW/HOUR, submit_date),3.16e-11,1,1)}

Gin

On Mon, Oct 31, 2016 at 8:57 PM, Markus Jelsma <ma...@openindex.io>
wrote:

> Does it work if you comment out any of the two local param queries? I'd
> doubt passing two sets of local params ever worked at all without wrapping
> one in the other.
>
> -----Original message-----
> > From:Gintautas Sulskus <gi...@gmail.com>
> > Sent: Monday 31st October 2016 21:19
> > To: solr-user@lucene.apache.org
> > Subject: Re: Getting NullPointerException in an attempt to boost query
> result by date
> >
> > Hi Erik,
> >
> > I have defined the query as SearchHandler:
> >
> > <requestHandler name="/testSearch" class="solr.SearchHandler">
> >   <lst name="defaults">
> >     <str name="q">
> >       {!boost b=recip(ms(NOW/HOUR, submit_date),3.16e-11,1,1)}
> >       {!type=dismax qf='title^10 body^5 body^1' v=$term}
> >     </str>
> >   </lst>
> > </requestHandler>
> >
> > The handler is then invoked with the following url:
> >
> > /solr/core/testSearch?term=apple
> >
> > The handler works if I comment out the date-boost line:
> > "{!boost b=recip(ms(NOW/HOUR, submit_date),3.16e-11,1,1)}"
> >
> > Gin
> >
> >
> > On Mon, Oct 31, 2016 at 6:15 PM, Erik Hatcher <er...@gmail.com>
> > wrote:
> >
> > > how’d you set “$term” - the correct way would be &term=apple on the
> Solr
> > > request.
> > >
> > >
> > > > On Oct 31, 2016, at 2:07 PM, Gintautas Sulskus <
> > > gintautas.sulskus@gmail.com> wrote:
> > > >
> > > > Hi,
> > > >
> > > > I am trying to construct a timestamp-boosted query comprising two
> > > weighted
> > > > fields: "title" and "body":
> > > >
> > > > {!boost b=recip(ms(NOW/HOUR,submit_date),3.16e-11,1,1)}
> > > > {!type=dismax qf='title^10 body^1' v=$term}
> > > >
> > > > $term=apple
> > > >
> > > > I expect the given example query provided above to search fields
> "title"
> > > > and "body" using keyword "apple" and adjust the order of the results
> by
> > > the
> > > > submission date "submit_date".
> > > >
> > > > However, the query just throws the NullPointerException exception:
> [1].
> > > > Could you please help me out with this issue?
> > > >
> > > > I am using Solr 4.10.3+cdh5.8.2+434 - part of Cloudera 5.8.2 package.
> > > >
> > > > Best,
> > > > Gin
> > > >
> > > > [1] the exception:
> > > > java.lang.NullPointerException at
> > > > org.apache.lucene.queries.function.BoostedQuery.
> > > hashCode(BoostedQuery.java:215)
> > > > at org.apache.lucene.search.BooleanClause.hashCode(
> > > BooleanClause.java:99)
> > > > at java.util.AbstractList.hashCode(AbstractList.java:541) at
> > > > org.apache.lucene.search.BooleanQuery.hashCode(BooleanQuery.java:656)
> at
> > > > org.apache.solr.search.QueryResultKey.<init>(QueryResultKey.java:47)
> at
> > > > org.apache.solr.search.SolrIndexSearcher.getDocListC(
> > > SolrIndexSearcher.java:1347)
> > > > at
> > > > org.apache.solr.search.SolrIndexSearcher.search(
> > > SolrIndexSearcher.java:518)
> > > > at
> > > > org.apache.solr.handler.component.QueryComponent.
> > > process(QueryComponent.java:485)
> > > > at
> > > > org.apache.solr.handler.component.SearchHandler.handleRequestBody(
> > > SearchHandler.java:218)
> > > > at
> > > > org.apache.solr.handler.RequestHandlerBase.handleRequest(
> > > RequestHandlerBase.java:135)
> > > > at org.apache.solr.core.SolrCore.execute(SolrCore.java:2025) at
> > > > org.apache.solr.servlet.SolrDispatchFilter.execute(
> > > SolrDispatchFilter.java:918)
> > > > at
> > > > org.apache.solr.servlet.SolrDispatchFilter.httpSolrCall(
> > > SolrDispatchFilter.java:481)
> > > > at
> > > > org.apache.solr.servlet.SolrDispatchFilter.doFilter(
> > > SolrDispatchFilter.java:260)
> > > > at
> > > > org.apache.solr.servlet.SolrDispatchFilter.doFilter(
> > > SolrDispatchFilter.java:255)
> > > > at
> > > > org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(
> > > ApplicationFilterChain.java:235)
> > > > at
> > > > org.apache.catalina.core.ApplicationFilterChain.doFilter(
> > > ApplicationFilterChain.java:206)
> > > > at
> > > > org.apache.solr.servlet.SolrHadoopAuthenticationFilter$2.doFilter(
> > > SolrHadoopAuthenticationFilter.java:408)
> > > > at
> > > > org.apache.hadoop.security.authentication.server.
> > > AuthenticationFilter.doFilter(AuthenticationFilter.java:622)
> > > > at
> > > > org.apache.hadoop.security.token.delegation.web.
> > > DelegationTokenAuthenticationFilter.doFilter(
> > > DelegationTokenAuthenticationFilter.java:291)
> > > > at
> > > > org.apache.hadoop.security.authentication.server.
> > > AuthenticationFilter.doFilter(AuthenticationFilter.java:574)
> > > > at
> > > > org.apache.solr.servlet.SolrHadoopAuthenticationFilter.doFilter(
> > > SolrHadoopAuthenticationFilter.java:413)
> > > > at
> > > > org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(
> > > ApplicationFilterChain.java:235)
> > > > at
> > > > org.apache.catalina.core.ApplicationFilterChain.doFilter(
> > > ApplicationFilterChain.java:206)
> > > > at org.apache.solr.servlet.HostnameFilter.doFilter(
> > > HostnameFilter.java:86)
> > > > at
> > > > org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(
> > > ApplicationFilterChain.java:235)
> > > > at
> > > > org.apache.catalina.core.ApplicationFilterChain.doFilter(
> > > ApplicationFilterChain.java:206)
> > > > at
> > > > org.apache.catalina.core.StandardWrapperValve.invoke(
> > > StandardWrapperValve.java:233)
> > > > at
> > > > org.apache.catalina.core.StandardContextValve.invoke(
> > > StandardContextValve.java:191)
> > > > at
> > > > org.apache.catalina.core.StandardHostValve.invoke(
> > > StandardHostValve.java:127)
> > > > at
> > > > org.apache.catalina.valves.ErrorReportValve.invoke(
> > > ErrorReportValve.java:103)
> > > > at
> > > > org.apache.catalina.core.StandardEngineValve.invoke(
> > > StandardEngineValve.java:109)
> > > > at
> > > > org.apache.catalina.connector.CoyoteAdapter.service(
> > > CoyoteAdapter.java:293)
> > > > at
> > > > org.apache.coyote.http11.Http11Processor.process(
> > > Http11Processor.java:861)
> > > > at
> > > > org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.
> > > process(Http11Protocol.java:620)
> > > > at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(
> > > JIoEndpoint.java:489)
> > > > at java.lang.Thread.run(Thread.java:745)
> > >
> > >
> >
>