Re: FunctionQuery in a custom request handler

2008-03-25 Thread Chris Hostetter

: 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?

not as precisely as it sounds like you want ... you can fudge the boost 
values to make cluses roughly worth X times other clauses, but you can't 
max out the contribution of one clause if another clause scores really 
poorly (because of low tf or high idf or whatever)


: 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)

there's really no way of knowing which line caused the NPE because you've 
compiled without debuging info (hence the Unknown Source) ... it might 
be a line in that method that you didn't include in your email, if it is 
one of the lines you included, then i'm guessing it's that you haven't 
actaully initialized searher at the point where you try to use it 
(nothing else jumps out at me that would cause an NPE without adding 
another method call to the stack trace)




-Hoss



Re: FunctionQuery in a custom request handler

2008-03-20 Thread evol__

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.



Re: FunctionQuery in a custom request handler

2008-01-16 Thread Chris Hostetter

: 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



FunctionQuery in a custom request handler

2008-01-15 Thread evol__

I'm trying to pull off a time bias, article freshness thing - boosting
recent documents based on a published_date field. The reasonable way to do
this seems using a FunctionQuery.
But all the examples I find are for expressing this through the query
parser; I'd need to do this inside my custom, plugged request handler.

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.


Thanks for the replies.
David

-- 
View this message in context: 
http://www.nabble.com/FunctionQuery-in-a-custom-request-handler-tp14838957p14838957.html
Sent from the Solr - User mailing list archive at Nabble.com.