Upgrade to lucene-8.7.0-snapshot-830bd186a8d. (#62596)

This commit is contained in:
Adrien Grand 2020-09-18 09:51:34 +02:00 committed by GitHub
parent 0a3f2c453f
commit 4de8579455
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
53 changed files with 107 additions and 69 deletions

View File

@ -1,5 +1,5 @@
elasticsearch = 7.10.0
lucene = 8.7.0-snapshot-9cd3af50f80
lucene = 8.7.0-snapshot-830bd186a8d
bundled_jdk_vendor = adoptopenjdk
bundled_jdk = 15+36

View File

@ -0,0 +1 @@
e91724fb3ca6b4a88bca6c06f33cf3ece2570d2a

View File

@ -1 +0,0 @@
46311836aeec9daa80e4fb4625f3a942d0e9326c

View File

@ -0,0 +1 @@
570181517723658fb81e417d3e1034d21602f3af

View File

@ -1 +0,0 @@
db78b0fe0e6c9ecbddde90351c6bf6dd36b7e274

View File

@ -0,0 +1 @@
d5c9c026382e5eacbbc917b08b51e140c30c2186

View File

@ -1 +0,0 @@
f02da079d8a318e0fb2d046a42e7e90c6d419624

View File

@ -0,0 +1 @@
7fad372e469d55db8eca00188e65b837a6b4ec2b

View File

@ -1 +0,0 @@
02a4aa023646071a59edc27dd46bca766dd9602c

View File

@ -0,0 +1 @@
899683551059ac5ab4fb88d4a96d0ec75743bfdd

View File

@ -1 +0,0 @@
fa83f2fd07becc6de2cea6f85ea6bb23b04f5b77

View File

@ -0,0 +1 @@
8d6cd0bd8b28de9d09560b1597791cc533258df5

View File

@ -1 +0,0 @@
370cbcf95db94209c79c72840c91053997928982

View File

@ -0,0 +1 @@
87d11fe1b430f124d79f514a5e74eda43bd941a8

View File

@ -1 +0,0 @@
307ea97f7f403cc2f60a5b0e992dd78fa36d39af

View File

@ -0,0 +1 @@
42eea3dc402968fda468fd0c4cd785192d8103c9

View File

@ -1 +0,0 @@
b4ebfc1a42e774b075803bcb4320424a340122c2

View File

@ -0,0 +1 @@
f7911b977b8f38b9f24bd5b0af77f14d3f5b51a2

View File

@ -1 +0,0 @@
4f39f38a58ba8f1192c147aec896fdb3372d01e8

View File

@ -0,0 +1 @@
d0269710e4c54ae429b7004fbe2d72d7e7b6e6c3

View File

@ -1 +0,0 @@
03af3f9cffd07c56a91126fb23972efeb7637b43

View File

@ -0,0 +1 @@
a634da70c00c91a3f71568fd888711312b0deaf7

View File

@ -1 +0,0 @@
25d62b2f5a4f796ae0e525a982b31d2c51341be3

View File

@ -0,0 +1 @@
19666d433d1f00db94120224b1e44127a3322201

View File

@ -1 +0,0 @@
2f1a9fca2e3bd918cf017060a85a0bb1c808409d

View File

@ -0,0 +1 @@
b3ec82ee53c13a22991c0d418ba7814a698f0841

View File

@ -1 +0,0 @@
8ee51f51d8fc5b58e2c9edb055760b22dbae2346

View File

@ -0,0 +1 @@
7ca56a6cebb50899092124900f33d945ce7233c4

View File

@ -1 +0,0 @@
6face13500e975b3710f086709d5badaec03f49a

View File

@ -0,0 +1 @@
16911245a11527612f0180bd10b9be82ecbe9b55

View File

@ -1 +0,0 @@
d2e078d2590829e3f4c593a8e37d99eae48ddd6c

View File

@ -0,0 +1 @@
f6adb514a50abad2b067bfe9ef3829b6962f3a1c

View File

@ -1 +0,0 @@
62fdddbbafe4cecda591fc03c6e093aec8d28981

View File

@ -0,0 +1 @@
a0e9bb6cdc6cc2eecdbb8be401662db36935da8a

View File

@ -1 +0,0 @@
fc2347e8559394345932415a2a124bf81d6f22c0

View File

@ -0,0 +1 @@
0d35c16d9e969ea9ee5a3594a12d56b81bbcbad7

View File

@ -1 +0,0 @@
c7f8321de0198ca879636fbc4dde0eac0d8ab855

View File

@ -0,0 +1 @@
8614efee0fde1d0ae22ea74d5c13323cd1f54572

View File

@ -1 +0,0 @@
2ef99b2592c61cfd52c7e4982014ecbe26929540

View File

@ -0,0 +1 @@
5106571200056a68f0b6e555c9b2a0fe4429ee09

View File

@ -1 +0,0 @@
95bd7fa58d6a40251a028bd7af51087721a3185f

View File

@ -0,0 +1 @@
495ec1cecc01f87850305d1f2dbf1e859c961726

View File

@ -1 +0,0 @@
4067b745014da2cdbcf18715caf08661d9c65c85

View File

@ -0,0 +1 @@
4b0f5152b0bdf834a47fb5aecd3b0cdf98e21f32

View File

@ -1 +0,0 @@
6cd4bc79cd1d5816fc0c076f2a2063cbd6b79a77

View File

@ -23,8 +23,10 @@ import org.apache.lucene.index.LeafReaderContext;
import org.apache.lucene.index.NumericDocValues;
import org.apache.lucene.search.DocIdSetIterator;
import org.apache.lucene.search.FieldComparator;
import org.apache.lucene.search.LeafFieldComparator;
import org.apache.lucene.search.Scorable;
import org.apache.lucene.search.SortField;
import org.apache.lucene.search.comparators.DoubleComparator;
import org.apache.lucene.util.BitSet;
import org.elasticsearch.common.Nullable;
import org.elasticsearch.common.util.BigArrays;
@ -83,14 +85,20 @@ public class DoubleValuesComparatorSource extends IndexFieldData.XFieldComparato
final double dMissingValue = (Double) missingObject(missingValue, reversed);
// NOTE: it's important to pass null as a missing value in the constructor so that
// the comparator doesn't check docsWithField since we replace missing values in select()
return new FieldComparator.DoubleComparator(numHits, null, null) {
return new DoubleComparator(numHits, null, null, reversed, sortPos) {
@Override
protected NumericDocValues getNumericDocValues(LeafReaderContext context, String field) throws IOException {
return DoubleValuesComparatorSource.this.getNumericDocValues(context, dMissingValue).getRawDoubleValues();
}
@Override
public void setScorer(Scorable scorer) {
DoubleValuesComparatorSource.this.setScorer(scorer);
public LeafFieldComparator getLeafComparator(LeafReaderContext context) throws IOException {
return new DoubleLeafComparator(context) {
@Override
protected NumericDocValues getNumericDocValues(LeafReaderContext context, String field) throws IOException {
return DoubleValuesComparatorSource.this.getNumericDocValues(context, dMissingValue).getRawDoubleValues();
}
@Override
public void setScorer(Scorable scorer) {
DoubleValuesComparatorSource.this.setScorer(scorer);
}
};
}
};
}

View File

@ -22,8 +22,10 @@ import org.apache.lucene.index.LeafReaderContext;
import org.apache.lucene.index.NumericDocValues;
import org.apache.lucene.search.DocIdSetIterator;
import org.apache.lucene.search.FieldComparator;
import org.apache.lucene.search.LeafFieldComparator;
import org.apache.lucene.search.Scorable;
import org.apache.lucene.search.SortField;
import org.apache.lucene.search.comparators.FloatComparator;
import org.apache.lucene.util.BitSet;
import org.elasticsearch.common.Nullable;
import org.elasticsearch.common.util.BigArrays;
@ -76,10 +78,15 @@ public class FloatValuesComparatorSource extends IndexFieldData.XFieldComparator
final float fMissingValue = (Float) missingObject(missingValue, reversed);
// NOTE: it's important to pass null as a missing value in the constructor so that
// the comparator doesn't check docsWithField since we replace missing values in select()
return new FieldComparator.FloatComparator(numHits, null, null) {
return new FloatComparator(numHits, null, null, reversed, sortPos) {
@Override
protected NumericDocValues getNumericDocValues(LeafReaderContext context, String field) throws IOException {
return FloatValuesComparatorSource.this.getNumericDocValues(context, fMissingValue).getRawFloatValues();
public LeafFieldComparator getLeafComparator(LeafReaderContext context) throws IOException {
return new FloatLeafComparator(context) {
@Override
protected NumericDocValues getNumericDocValues(LeafReaderContext context, String field) throws IOException {
return FloatValuesComparatorSource.this.getNumericDocValues(context, fMissingValue).getRawFloatValues();
}
};
}
};
}

View File

@ -23,7 +23,9 @@ import org.apache.lucene.index.NumericDocValues;
import org.apache.lucene.index.SortedNumericDocValues;
import org.apache.lucene.search.DocIdSetIterator;
import org.apache.lucene.search.FieldComparator;
import org.apache.lucene.search.LeafFieldComparator;
import org.apache.lucene.search.SortField;
import org.apache.lucene.search.comparators.LongComparator;
import org.apache.lucene.util.BitSet;
import org.elasticsearch.common.Nullable;
import org.elasticsearch.common.util.BigArrays;
@ -95,10 +97,15 @@ public class LongValuesComparatorSource extends IndexFieldData.XFieldComparatorS
final long lMissingValue = (Long) missingObject(missingValue, reversed);
// NOTE: it's important to pass null as a missing value in the constructor so that
// the comparator doesn't check docsWithField since we replace missing values in select()
return new FieldComparator.LongComparator(numHits, null, null) {
return new LongComparator(numHits, null, null, reversed, sortPos) {
@Override
protected NumericDocValues getNumericDocValues(LeafReaderContext context, String field) throws IOException {
return LongValuesComparatorSource.this.getNumericDocValues(context, lMissingValue);
public LeafFieldComparator getLeafComparator(LeafReaderContext context) throws IOException {
return new LongLeafComparator(context) {
@Override
protected NumericDocValues getNumericDocValues(LeafReaderContext context, String field) throws IOException {
return LongValuesComparatorSource.this.getNumericDocValues(context, lMissingValue);
}
};
}
};
}

View File

@ -32,6 +32,7 @@ import org.apache.lucene.search.DocIdSet;
import org.apache.lucene.search.DocIdSetIterator;
import org.apache.lucene.search.FieldComparator;
import org.apache.lucene.search.FieldDoc;
import org.apache.lucene.search.LeafFieldComparator;
import org.apache.lucene.search.Query;
import org.apache.lucene.search.ScoreMode;
import org.apache.lucene.search.Scorer;
@ -40,6 +41,7 @@ import org.apache.lucene.search.SortField;
import org.apache.lucene.search.SortedNumericSelector;
import org.apache.lucene.search.SortedNumericSortField;
import org.apache.lucene.search.Weight;
import org.apache.lucene.search.comparators.LongComparator;
import org.apache.lucene.util.RoaringDocIdSet;
import org.elasticsearch.common.lease.Releasables;
import org.elasticsearch.index.IndexSortConfig;
@ -289,40 +291,47 @@ final class CompositeAggregator extends BucketsAggregator {
@Override
public FieldComparator<?> getComparator(int numHits, int sortPos) {
return new FieldComparator.LongComparator(1, delegate.getField(), (Long) missingValue) {
return new LongComparator(1, delegate.getField(), (Long) missingValue, delegate.getReverse(), sortPos) {
@Override
protected NumericDocValues getNumericDocValues(LeafReaderContext context, String field) throws IOException {
NumericDocValues dvs = SortedNumericSelector.wrap(DocValues.getSortedNumeric(context.reader(), field),
delegate.getSelector(), delegate.getNumericType());
return new NumericDocValues() {
public LeafFieldComparator getLeafComparator(LeafReaderContext context) throws IOException {
return new LongLeafComparator(context) {
@Override
public long longValue() throws IOException {
return round.applyAsLong(dvs.longValue());
}
protected NumericDocValues getNumericDocValues(LeafReaderContext context, String field)
throws IOException {
NumericDocValues dvs = SortedNumericSelector.wrap(
DocValues.getSortedNumeric(context.reader(), field),
delegate.getSelector(), delegate.getNumericType());
return new NumericDocValues() {
@Override
public long longValue() throws IOException {
return round.applyAsLong(dvs.longValue());
}
@Override
public boolean advanceExact(int target) throws IOException {
return dvs.advanceExact(target);
}
@Override
public boolean advanceExact(int target) throws IOException {
return dvs.advanceExact(target);
}
@Override
public int docID() {
return dvs.docID();
}
@Override
public int docID() {
return dvs.docID();
}
@Override
public int nextDoc() throws IOException {
return dvs.nextDoc();
}
@Override
public int nextDoc() throws IOException {
return dvs.nextDoc();
}
@Override
public int advance(int target) throws IOException {
return dvs.advance(target);
}
@Override
public int advance(int target) throws IOException {
return dvs.advance(target);
}
@Override
public long cost() {
return dvs.cost();
@Override
public long cost() {
return dvs.cost();
}
};
}
};
}

View File

@ -24,7 +24,9 @@ import org.apache.lucene.index.LeafReaderContext;
import org.apache.lucene.index.NumericDocValues;
import org.apache.lucene.search.DocIdSetIterator;
import org.apache.lucene.search.FieldComparator;
import org.apache.lucene.search.LeafFieldComparator;
import org.apache.lucene.search.SortField;
import org.apache.lucene.search.comparators.DoubleComparator;
import org.apache.lucene.util.BitSet;
import org.elasticsearch.ElasticsearchParseException;
import org.elasticsearch.Version;
@ -699,10 +701,15 @@ public class GeoDistanceSortBuilder extends SortBuilder<GeoDistanceSortBuilder>
@Override
public FieldComparator<?> newComparator(String fieldname, int numHits, int sortPos, boolean reversed) {
return new FieldComparator.DoubleComparator(numHits, null, null) {
return new DoubleComparator(numHits, null, null, reversed, sortPos) {
@Override
protected NumericDocValues getNumericDocValues(LeafReaderContext context, String field) throws IOException {
return getNumericDoubleValues(context).getRawDoubleValues();
public LeafFieldComparator getLeafComparator(LeafReaderContext context) throws IOException {
return new DoubleLeafComparator(context) {
@Override
protected NumericDocValues getNumericDocValues(LeafReaderContext context, String field) throws IOException {
return getNumericDoubleValues(context).getRawDoubleValues();
}
};
}
};
}

View File

@ -670,11 +670,11 @@ public class QueryPhaseTests extends IndexShardTestCase {
context.sort(new SortAndFormats(new Sort(new SortField("other", SortField.Type.INT)),
new DocValueFormat[]{DocValueFormat.RAW}));
topDocsContext = TopDocsCollectorContext.createTopDocsCollectorContext(context, false);
assertEquals(topDocsContext.create(null).scoreMode(), org.apache.lucene.search.ScoreMode.COMPLETE_NO_SCORES);
assertEquals(topDocsContext.create(null).scoreMode(), org.apache.lucene.search.ScoreMode.TOP_DOCS);
QueryPhase.executeInternal(context);
assertEquals(5, context.queryResult().topDocs().topDocs.totalHits.value);
assertThat(context.queryResult().topDocs().topDocs.scoreDocs.length, equalTo(3));
assertEquals(context.queryResult().topDocs().topDocs.totalHits.relation, TotalHits.Relation.EQUAL_TO);
assertEquals(context.queryResult().topDocs().topDocs.totalHits.relation, TotalHits.Relation.GREATER_THAN_OR_EQUAL_TO);
reader.close();
dir.close();

View File

@ -0,0 +1 @@
a634da70c00c91a3f71568fd888711312b0deaf7

View File

@ -1 +0,0 @@
25d62b2f5a4f796ae0e525a982b31d2c51341be3