[
https://issues.apache.org/jira/browse/LUCENE-7953?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16154463#comment-16154463
]
Robert Muir commented on LUCENE-7953:
-------------------------------------
Mike, can't you do some magic in your bindings impl where it recurses into a
subexpression? E.g. try/catch and insert your fake frame, log some stuff, wrap
with another exception, whatever?
So e.g. right before here in SimpleBindings for example
https://github.com/apache/lucene-solr/blob/master/lucene/expressions/src/java/org/apache/lucene/expressions/SimpleBindings.java#L82
and i think the "name" is enough, you dont need the actual sub-expression text
there.
If you have expressions:
{code}
e = f + g
f = x + y
g = x + z
{code}
When there is some problem with "x", you just want to know if it happened in f
or g right?
If you can solve it in the bindings class i think thats best (rather than doing
wonky stuff in ExpressionValueSource or whatever), because it allows for
customization, e.g. if its too complicated for SimpleBindings maybe we don't do
it there, but you could still do it yourself.
> Can we include the expression string in the stack frame for problems
> evaluating Lucene expressions?
> ---------------------------------------------------------------------------------------------------
>
> Key: LUCENE-7953
> URL: https://issues.apache.org/jira/browse/LUCENE-7953
> Project: Lucene - Core
> Issue Type: Improvement
> Components: modules/expressions
> Reporter: Michael McCandless
> Priority: Minor
>
> I'm working with rather complex expressions to compute relevance, and when
> there is a problem, I see a stack trace like this:
> {noformat}
> Server error:
> java.lang.IllegalArgumentException: field "is_prime" has type bin, which
> cannot be used in an expression
> at
> com.amazon.lucene.Searcher$IndexBindings.getDoubleValuesSource(Searcher.java:373)
> at
> com.amazon.lucene.Searcher$QueryBindings.getDoubleValuesSource(Searcher.java:302)
> at
> org.apache.lucene.expressions.ExpressionValueSource.<init>(ExpressionValueSource.java:45)
> at
> org.apache.lucene.expressions.Expression.getDoubleValuesSource(Expression.java:97)
> at
> com.amazon.lucene.Searcher$IndexBindings.getDoubleValuesSource(Searcher.java:378)
> at
> com.amazon.lucene.Searcher$QueryBindings.getDoubleValuesSource(Searcher.java:302)
> at
> org.apache.lucene.expressions.ExpressionValueSource.<init>(ExpressionValueSource.java:45)
> at
> org.apache.lucene.expressions.Expression.getDoubleValuesSource(Expression.java:97)
> at
> com.amazon.lucene.Searcher$IndexBindings.getDoubleValuesSource(Searcher.java:378)
> at
> com.amazon.lucene.Searcher$QueryBindings.getDoubleValuesSource(Searcher.java:302)
> at
> org.apache.lucene.expressions.ExpressionValueSource.<init>(ExpressionValueSource.java:45)
> at
> org.apache.lucene.expressions.Expression.getDoubleValuesSource(Expression.java:97)
> at
> com.amazon.lucene.Searcher$IndexBindings.getDoubleValuesSource(Searcher.java:378)
> at
> com.amazon.lucene.Searcher$QueryBindings.getDoubleValuesSource(Searcher.java:302)
> at
> com.amazon.lucene.http.SearchA9Handler.handleInner(SearchA9Handler.java:459)
> at
> com.amazon.lucene.http.SearchA9Handler.handle(SearchA9Handler.java:99)
> at <server>
> {noformat}
> It's my code that's throwing the exception, but it would sure be nice if all
> the intermediate stack frames in the exception would include the expression
> text (or maybe some smallish prefix of it, in case it's gigantic), because I
> think here I have 3 levels of expression, and it'd be nice to know which
> sub-expressions, sub-sub-expressions, etc., led to the offensive {{is_prime}}
> field.
> I don't know how to do this, but e.g. I know our randomizedtesting lib is
> able to modify stack to insert test seeds, so it seems to be possible.
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]