mirror of https://github.com/apache/lucene.git
LUCENE-6271: fix MultiPhraseQuery's positions check
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/branches/lucene6271@1670368 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
05cf3fde0d
commit
198ec5516b
|
@ -190,6 +190,11 @@ public class MultiPhraseQuery extends Query {
|
|||
return null;
|
||||
}
|
||||
|
||||
// TODO: move this check to createWeight to happen earlier to the user?
|
||||
if (!fieldTerms.hasPositions()) {
|
||||
throw new IllegalStateException("field \"" + field + "\" was indexed without position data; cannot run PhraseQuery (phrase=" + getQuery() + ")");
|
||||
}
|
||||
|
||||
// Reuse single TermsEnum below:
|
||||
final TermsEnum termsEnum = fieldTerms.iterator(null);
|
||||
|
||||
|
@ -230,13 +235,6 @@ public class MultiPhraseQuery extends Query {
|
|||
termsEnum.seekExact(term.bytes(), termState);
|
||||
postingsEnum = termsEnum.postings(liveDocs, null, PostingsEnum.POSITIONS);
|
||||
|
||||
// nocommit: check
|
||||
if (postingsEnum == null) {
|
||||
// term does exist, but has no positions
|
||||
assert termsEnum.postings(liveDocs, null, PostingsEnum.NONE) != null: "termstate found but no term exists in reader";
|
||||
throw new IllegalStateException("field \"" + term.field() + "\" was indexed without position data; cannot run PhraseQuery (term=" + term.text() + ")");
|
||||
}
|
||||
|
||||
docFreq = termsEnum.docFreq();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue