Can we include the expression string in the stack frame for problems evaluating Lucene expressions? [LUCENE-7953]
- Dominant language
- Java
- Stars
- 3.6k
- Forks
- 1.4k
- Avg merge
- 2d 11h
- Merged PRs (30d)
- 88
Description
I'm working with rather complex expressions to compute relevance, and when there is a problem, I see a stack trace like this:
```
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.(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.(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.(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
```
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.
---
Migrated from [LUCENE-7953](https://issues.apache.org/jira/browse/LUCENE-7953) by Michael McCandless (@mikemccand), updated Sep 06 2017
Contributor guide
Research direction
Start by tracing the failure through the mentioned Expression, ExpressionValueSource, and Searcher binding methods, focusing on where nested expression evaluation loses context. Check existing expression error-handling tests or failure cases, then define completion as stack traces identifying the relevant expression text or a bounded prefix for each evaluation level.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- search
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100