lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gdeconto <gerald.deco...@topproducer.com>
Subject Re: how is score computed with hsin functionquery?
Date Wed, 02 Dec 2009 16:54:09 GMT


Grant Ingersoll-6 wrote:
> 
> ...
> Yep.  Also note that I added deg() and rad() functions, but for the most
> part is probably better to do the conversion during indexing.
> ...
> 

as it is not possible for me to convert my data from deg to rad during
import (since queries are done using degrees), and manually putting in rad()
stmts into my hsin query seems awkward, I was looking at ways to have solr
do it for me.  

One idea I had was to leverage the existing hsin code (see below).  My
problem is that HavesineFunction expects ValueSource and I do not see a way
to convert my radian values back to ValueSource (pls excuse my ignorance on
this).  Any help/ideas appreciated

public class MyValueSourceParser extends ValueSourceParser {
    public ValueSource parse(FunctionQParser fp) throws ParseException {
		ValueSource source = fp.parseValueSource();

		ValueSource x1 = fp.parseValueSource();
        ValueSource y1 = fp.parseValueSource();
        ValueSource x2 = fp.parseValueSource();
        ValueSource y2 = fp.parseValueSource();
        double radius = fp.parseDouble();

		return HaversineFunction(Math.toRadians(x1), Math.toRadians(y1),
Math.toRadians(x2), Math.toRadians(y2), radius); // ** how do I convert the
rad param values to ValueSource **
	}
}
-- 
View this message in context: http://old.nabble.com/how-is-score-computed-with-hsin-functionquery--tp26504265p26612289.html
Sent from the Solr - User mailing list archive at Nabble.com.


Mime
View raw message