Gravatar for

Question by Ryan, Sep 21, 2016 7:01 PM

Query ranking functions and ExprTK syntax

I'm trying to add a query ranking function that boosts the items closest to a set of locations.

It looks like this:

$qrf(expression:'min(dist(@lat1, @long1, 30, -100),dist(@lat2, @long2 ,30,-100)', normalizeWeight: true)

The problem is that lat1, long1, lat2, long2 aren't always set. ExprTK has an if construct, but it doesn't seem to work.

I tried $qf(function:'if((3 == 3),7,9)', fieldName: 'tester') but that doesn't return anything in the results.

ExprTK has lot of other functions, but none of the ideas I had seem to work. Taking the absolute value of the empty field doesn't coerce into a number, for instance.

How can I handle empty fields in a query ranking function?

1 Reply
Gravatar for

Answer by Daniel Lavoie, Sep 21, 2016 11:32 PM

Hi, Control statements, like the if statement, have been disabled for security reasons.

I don't think that there is a way to handle your specific problem with the way we expose the ExprTK library…

Gravatar for

Comment by Ryan, Sep 22, 2016 4:55 PM

Well, thanks for letting me know anyway.

Ask a question