EmptyTermSpans.toString() not overridden - throws NPE [LUCENE-2752]
- Dominant language
- Java
- Stars
- 3.6k
- Forks
- 1.4k
- Avg merge
- 2d 11h
- Merged PRs (30d)
- 88
Description
While trying to use lucene SpanQuery (e.g. SpanTermQuery) in a solr QueryComponent.process(), I got a NPE on the EmptySpanTerms.toString() method.
I assume this should be overridden, with something, but not sure what. I just override and return "empty spans", but would assume something better should go there (empty string, null,...).
Interestingly, the error did not bubble up, so I spent a while thinking I had bad queries or test content. Queries just came back blank. After digging a bit, I noticed the 'embedded' error, and tracked down the source. With an overridden EST.toString() my span queries worked again. I have no idea what else depends on EST, or if overriding the toString() will cascade problems. 'ant test' in the lucene branch seemed to pass all tests (Build Successful).
---
Migrated from [LUCENE-2752](https://issues.apache.org/jira/browse/LUCENE-2752) by Sean O'Connor (@seanoc5)
Environment:
```
Ubuntu 10.10, solr/lucene revision 1033666.
```
Contributor guide
Research direction
Start by locating EmptySpanTerms and its toString() implementation, then trace how SpanQuery reaches Solr's QueryComponent.process(). Reproduce the reported NPE with a SpanTermQuery and run the relevant Lucene/Solr tests or ant test. Done means the span query no longer fails because of EmptySpanTerms.toString(), with coverage for the expected empty-span representation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- search
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100