mirror of https://github.com/apache/lucene.git
LUCENE-1314: fix reopen bug wrt fields that don't have norms
git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@741838 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
dbe0898d63
commit
5388a5c7ac
|
@ -722,7 +722,8 @@ class SegmentReader extends DirectoryIndexReader {
|
||||||
if (doClone || !fieldNormsChanged[i]) {
|
if (doClone || !fieldNormsChanged[i]) {
|
||||||
final String curField = fieldInfos.fieldInfo(i).name;
|
final String curField = fieldInfos.fieldInfo(i).name;
|
||||||
Norm norm = (Norm) this.norms.get(curField);
|
Norm norm = (Norm) this.norms.get(curField);
|
||||||
clone.norms.put(curField, norm.clone());
|
if (norm != null)
|
||||||
|
clone.norms.put(curField, norm.clone());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -168,6 +168,8 @@ public class TestIndexReaderReopen extends LuceneTestCase {
|
||||||
for (int j=0; j<M; j++) {
|
for (int j=0; j<M; j++) {
|
||||||
Document doc = new Document();
|
Document doc = new Document();
|
||||||
doc.add(new Field("id", i+"_"+j, Store.YES, Index.NOT_ANALYZED));
|
doc.add(new Field("id", i+"_"+j, Store.YES, Index.NOT_ANALYZED));
|
||||||
|
doc.add(new Field("id2", i+"_"+j, Store.YES, Index.NOT_ANALYZED_NO_NORMS));
|
||||||
|
doc.add(new Field("id3", i+"_"+j, Store.YES, Index.NO));
|
||||||
iwriter.addDocument(doc);
|
iwriter.addDocument(doc);
|
||||||
if (i>0) {
|
if (i>0) {
|
||||||
int k = i-1;
|
int k = i-1;
|
||||||
|
@ -959,6 +961,8 @@ public class TestIndexReaderReopen extends LuceneTestCase {
|
||||||
sb.append("a");
|
sb.append("a");
|
||||||
sb.append(n);
|
sb.append(n);
|
||||||
doc.add(new Field("field1", sb.toString(), Store.YES, Index.ANALYZED));
|
doc.add(new Field("field1", sb.toString(), Store.YES, Index.ANALYZED));
|
||||||
|
doc.add(new Field("fielda", sb.toString(), Store.YES, Index.NOT_ANALYZED_NO_NORMS));
|
||||||
|
doc.add(new Field("fieldb", sb.toString(), Store.YES, Index.NO));
|
||||||
sb.append(" b");
|
sb.append(" b");
|
||||||
sb.append(n);
|
sb.append(n);
|
||||||
for (int i = 1; i < numFields; i++) {
|
for (int i = 1; i < numFields; i++) {
|
||||||
|
|
Loading…
Reference in New Issue