I store date as Long:

<field name="submit_date" type="tlong"  indexed="true" stored="true"/>
<fieldType name="tlong" class="solr.TrieLongField" precisionStep="8"
positionIncrementGap="0"/>

Eric, at first glance it seems that your given advice to separate nested
parsers worked.
I can see the query in the logs and it returns the expected data.

Thanks!

Using the same opportunity:
How do I set $term to match everything in qq={!dismax qf=‘….’ v=$term},
e.g. like field:*?

Gin

On Tue, Nov 1, 2016 at 1:15 PM, Erik Hatcher <erik.hatc...@gmail.com> wrote:

> What’s the field and type definition of submit_date?   Could that be the
> issue?
>
> Also, one thing you could do is separate the nested parsers like this:
>
>     q={!boost b=… v=$qq}
>     qq={!dismax qf=‘….’ v=$term}
>
> Relying on `v` to be the string after the closing curly bracket is
> sometimes error-prone, and I tend to explicitly define `v` like this to
> avoid escaping and parsing hassles.
>
> (whether you set these in the request handler or as explicit params is up
> to you, and keeping everything (but `term`) in the request handler
> definition would be the cleanest client request way to go, as you’re doing.
>
>         Erik
>
>
> > On Oct 31, 2016, at 4:19 PM, Gintautas Sulskus <
> gintautas.suls...@gmail.com> wrote:
> >
> > 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
> >
> > Best Wishes,
> > Gintautas Sulskus
> >
> > On Mon, Oct 31, 2016 at 6:15 PM, Erik Hatcher <erik.hatc...@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.suls...@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)
> >>
> >>
>
>

Reply via email to