Hi again, digging this one up. This is the code I've used in my handler.
ReciprocalFloatFunction tb_valuesource; tb_valuesource = new ReciprocalFloatFunction(new ReverseOrdFieldSource(TIMEBIAS_FIELD), m, a, b); FunctionQuery timebias = new FunctionQuery(tb_valuesource); // adding to main query BooleanQuery main = new BooleanQuery(); other_queries.setBoost(BOOST_OTHER_QUERIES); main.add(other_queries); timebias.setBoost(BOOST_TIMEBIAS); main.add(timebias); It worked, but the problem is that I fail to get a decent ration between my "other_queries" and "timebias". I would like to keep timebias at ~15% max (for totally fresh docs), kind of dropping to nothing at ~one week olds. Adding to BooleanQuery sums the subquery scores, so I guess there's no way of controlling the ratio, right? What I tried to do is to use multiplication: // this part stays the same ReciprocalFloatFunction tb_valuesource; tb_valuesource = new ReciprocalFloatFunction(new ReverseOrdFieldSource(TIMEBIAS_FIELD), m, a, b); FunctionQuery timebias = new FunctionQuery(tb_valuesource); ConstValueSource tb_const = new ConstValueSource(1.0f); ValueSource[] tb_summa_arr = {tb_const, tb_valuesource}; SumFloatFunction tb_summa = new SumFloatFunction(tb_summa_arr); QueryValueSource query_vs = new QueryValueSource(query, DEF_VAL); ValueSource[] vs_arr = {query_vs, tb_summa}; ProductFloatFunction pff = new ProductFloatFunction(vs_arr); FunctionQuery THE_QUERY = new FunctionQuery(pff); docs.docList = searcher.getDocList(THE_QUERY, filters, null, start, rows, flags); (All of the float tweakish values are ofcourse foo.) The problem is this crashes at the last line with Mar 20, 2008 6:59:57 PM org.apache.solr.common.SolrException log SEVERE: java.lang.NullPointerException at si.david.MyRequestHandler.handleRequestBody(Unknown Source) at org.apache.solr.handler.RequestHandlerBase.handleRequest(RequestHandlerBase.java:117) at org.apache.solr.core.SolrCore.execute(SolrCore.java:815) at org.apache.solr.servlet.SolrDispatchFilter.execute(SolrDispatchFilter.java:206) at org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:174) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:174) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:151) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:874) at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665) at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528) at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81) at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:689) at java.lang.Thread.run(Thread.java:619) I'm using a nightly build from late November. Any ideas? Does what I am doing make any sense? Is there any other way to accomplish what I'm trying to do? I'm kind of lost here, thanks for the info. D. hossman wrote: > > > : How do I access the ValueSource for my DateField? I'd like to use a > : ReciprocalFloatFunction from inside the code, adding it aside others in > the > : main BooleanQuery. > > The FieldType API provides a getValueSource method (so every FieldType > picks it's own best ValueSource implementaion). > > > -Hoss > > > -- View this message in context: http://www.nabble.com/FunctionQuery-in-a-custom-request-handler-tp14838957p16186230.html Sent from the Solr - User mailing list archive at Nabble.com.