Affects Version/s: None
Fix Version/s: 5.1
PhraseQuery behaves quite inconsistently when the position of the first term is greater than 0. Here is an example:
The reason is that when you add a term with position P on a PhraseQuery, ExactPhraseScorer ignores all positions for this term which are less than P.
But this is inconsistent:
- if you have a single term, it does not work anymore since we rewrite to a term query regardless of the position of the term (3rd query)
- if you increase the slop, we will use SloppyPhraseScorer which does not have this behaviour. (4th query)
So I think we have two options:
- either remove this behaviour and make the positions that are provided to PhraseQuery only relative (ie. fix ExactPhraseScorer)
- or make it work this way across the board (which means not rewriting to a term query when the position is not 0 and fixing SloppyPhraseScorer).