mirror of https://github.com/apache/lucene.git
also fix SimpleTextDimValues to skip writing if merged segment had deleted all docs with the dimensional field
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1721583 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
132986048f
commit
3430150819
|
@ -24,6 +24,7 @@ import java.util.Map;
|
|||
|
||||
import org.apache.lucene.codecs.DimensionalReader;
|
||||
import org.apache.lucene.index.CorruptIndexException;
|
||||
import org.apache.lucene.index.FieldInfo;
|
||||
import org.apache.lucene.index.IndexFileNames;
|
||||
import org.apache.lucene.index.SegmentReadState;
|
||||
import org.apache.lucene.store.BufferedChecksumIndexInput;
|
||||
|
@ -135,9 +136,18 @@ class SimpleTextDimensionalReader extends DimensionalReader {
|
|||
/** Finds all documents and points matching the provided visitor */
|
||||
@Override
|
||||
public void intersect(String field, IntersectVisitor visitor) throws IOException {
|
||||
FieldInfo fieldInfo = readState.fieldInfos.fieldInfo(field);
|
||||
if (fieldInfo == null) {
|
||||
throw new IllegalArgumentException("field=\"" + field + "\" is unrecognized");
|
||||
}
|
||||
if (fieldInfo.getDimensionCount() == 0) {
|
||||
throw new IllegalArgumentException("field=\"" + field + "\" did not index dimensional values");
|
||||
}
|
||||
BKDReader bkdReader = readers.get(field);
|
||||
if (bkdReader == null) {
|
||||
throw new IllegalArgumentException("field=\"" + field + "\" was not indexed with dimensional values");
|
||||
// Schema ghost corner case! This field did index dimensional values in the past, but
|
||||
// now all docs having this dimensional field were deleted in this segment:
|
||||
return;
|
||||
}
|
||||
bkdReader.intersect(visitor);
|
||||
}
|
||||
|
|
|
@ -157,7 +157,11 @@ class SimpleTextDimensionalWriter extends DimensionalWriter {
|
|||
return Relation.CELL_CROSSES_QUERY;
|
||||
}
|
||||
});
|
||||
indexFPs.put(fieldInfo.name, writer.finish(dataOut));
|
||||
|
||||
// We could have 0 points on merge since all docs with dimensional fields may be deleted:
|
||||
if (writer.getPointCount() > 0) {
|
||||
indexFPs.put(fieldInfo.name, writer.finish(dataOut));
|
||||
}
|
||||
}
|
||||
|
||||
private void write(IndexOutput out, String s) throws IOException {
|
||||
|
|
|
@ -105,7 +105,7 @@ public class Lucene60DimensionalWriter extends DimensionalWriter implements Clos
|
|||
}
|
||||
});
|
||||
|
||||
// We could have 0 points since all docs with dimensional fields may be deleted:
|
||||
// We could have 0 points on merge since all docs with dimensional fields may be deleted:
|
||||
if (writer.getPointCount() > 0) {
|
||||
indexFPs.put(fieldInfo.name, writer.finish(dataOut));
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue