mirror of https://github.com/apache/lucene.git
Don't allow negatives in the positions file
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1371961 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
c97774fb5e
commit
d0dd5fadcc
|
@ -31,6 +31,11 @@ Bug Fixes
|
|||
had a custom Similarity where coord(1,1) != 1F, then the rewritten
|
||||
query would be scored differently. (Robert Muir)
|
||||
|
||||
* Don't allow negatives in the positions file. If you have an index
|
||||
from 2.4.0 or earlier with such negative positions, and you already
|
||||
upgraded to 3.x, then to Lucene 4.0-ALPHA or -BETA, you should run
|
||||
CheckIndex. If it fails, then you need to upgrade again to 4.0 (Robert Muir)
|
||||
|
||||
======================= Lucene 4.0.0-BETA =======================
|
||||
|
||||
New features
|
||||
|
|
|
@ -822,11 +822,8 @@ public class CheckIndex {
|
|||
if (hasPositions) {
|
||||
for(int j=0;j<freq;j++) {
|
||||
final int pos = postings.nextPosition();
|
||||
// NOTE: pos=-1 is allowed because of ancient bug
|
||||
// (LUCENE-1542) whereby IndexWriter could
|
||||
// write pos=-1 when first token's posInc is 0
|
||||
|
||||
if (pos < -1) {
|
||||
if (pos < 0) {
|
||||
throw new RuntimeException("term " + term + ": doc " + doc + ": pos " + pos + " is out of bounds");
|
||||
}
|
||||
if (pos < lastPos) {
|
||||
|
@ -919,14 +916,8 @@ public class CheckIndex {
|
|||
int lastOffset = 0;
|
||||
for(int posUpto=0;posUpto<freq;posUpto++) {
|
||||
final int pos = postings.nextPosition();
|
||||
// NOTE: pos=-1 is allowed because of ancient bug
|
||||
// (LUCENE-1542) whereby IndexWriter could
|
||||
// write pos=-1 when first token's posInc is 0
|
||||
// (separately: analyzers should not give
|
||||
// posInc=0 to first token); also, term
|
||||
// vectors are allowed to return pos=-1 if
|
||||
// they indexed offset but not positions:
|
||||
if (pos < -1) {
|
||||
|
||||
if (pos < 0) {
|
||||
throw new RuntimeException("position " + pos + " is out of bounds");
|
||||
}
|
||||
if (pos < lastPosition) {
|
||||
|
@ -1498,7 +1489,7 @@ public class CheckIndex {
|
|||
int pos = postings.nextPosition();
|
||||
if (postingsPostings != null) {
|
||||
int postingsPos = postingsPostings.nextPosition();
|
||||
if (pos != -1 && postingsPos != -1 && pos != postingsPos) {
|
||||
if (terms.hasPositions() && pos != postingsPos) {
|
||||
throw new RuntimeException("vector term=" + term + " field=" + field + " doc=" + j + ": pos=" + pos + " differs from postings pos=" + postingsPos);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue