mirror of https://github.com/apache/lucene.git
LUCENE-7083: default points merge logic should not ask a reader to merge points on a field that doesn't exist in that segment
This commit is contained in:
parent
9393a3190c
commit
2cac33a5ce
|
@ -54,6 +54,12 @@ public abstract class PointsWriter implements Closeable {
|
|||
// This segment has no points
|
||||
continue;
|
||||
}
|
||||
FieldInfo readerFieldInfo = mergeState.fieldInfos[i].fieldInfo(fieldName);
|
||||
if (readerFieldInfo == null) {
|
||||
// This segment never saw this field
|
||||
continue;
|
||||
}
|
||||
|
||||
MergeState.DocMap docMap = mergeState.docMaps[i];
|
||||
int docBase = mergeState.docBase[i];
|
||||
pointsReader.intersect(fieldInfo.name,
|
||||
|
|
|
@ -4116,6 +4116,7 @@ public class IndexWriter implements Closeable, TwoPhaseCommit, Accountable {
|
|||
(mergeState.mergeFieldInfos.hasDocValues() ? "docValues" : "no docValues") + "; " +
|
||||
(mergeState.mergeFieldInfos.hasProx() ? "prox" : "no prox") + "; " +
|
||||
(mergeState.mergeFieldInfos.hasProx() ? "freqs" : "no freqs") + "; " +
|
||||
(mergeState.mergeFieldInfos.hasPointValues() ? "points" : "no points") + "; " +
|
||||
String.format(Locale.ROOT,
|
||||
"%.1f sec (%.1f sec stopped, %.1f sec paused) to merge segment [%.2f MB, %.2f MB/sec]",
|
||||
sec,
|
||||
|
|
|
@ -39,6 +39,7 @@ import org.apache.lucene.index.PointValues.IntersectVisitor;
|
|||
import org.apache.lucene.index.PointValues.Relation;
|
||||
import org.apache.lucene.index.PointValues;
|
||||
import org.apache.lucene.store.Directory;
|
||||
import org.apache.lucene.store.FSDirectory;
|
||||
import org.apache.lucene.util.IOUtils;
|
||||
import org.apache.lucene.util.LuceneTestCase;
|
||||
import org.apache.lucene.util.TestUtil;
|
||||
|
@ -562,4 +563,23 @@ public class TestPointValues extends LuceneTestCase {
|
|||
r.close();
|
||||
dir.close();
|
||||
}
|
||||
|
||||
public void testPointsFieldMissingFromOneSegment() throws Exception {
|
||||
Directory dir = FSDirectory.open(createTempDir());
|
||||
IndexWriterConfig iwc = new IndexWriterConfig(null);
|
||||
IndexWriter w = new IndexWriter(dir, iwc);
|
||||
Document doc = new Document();
|
||||
doc.add(new StringField("id", "0", Field.Store.NO));
|
||||
doc.add(new IntPoint("int0", 0));
|
||||
w.addDocument(doc);
|
||||
w.commit();
|
||||
|
||||
doc = new Document();
|
||||
doc.add(new IntPoint("int1", 17));
|
||||
w.addDocument(doc);
|
||||
w.forceMerge(1);
|
||||
|
||||
w.close();
|
||||
dir.close();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue