Skip to content

Commit

Permalink
Upgrade to lucene-8.7.0-snapshot-830bd186a8d. (#62596)
Browse files Browse the repository at this point in the history
  • Loading branch information
jpountz authored Sep 18, 2020
1 parent 0a3f2c4 commit 4de8579
Show file tree
Hide file tree
Showing 53 changed files with 112 additions and 74 deletions.
2 changes: 1 addition & 1 deletion buildSrc/version.properties
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
e91724fb3ca6b4a88bca6c06f33cf3ece2570d2a

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
570181517723658fb81e417d3e1034d21602f3af

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
d5c9c026382e5eacbbc917b08b51e140c30c2186

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
7fad372e469d55db8eca00188e65b837a6b4ec2b

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
899683551059ac5ab4fb88d4a96d0ec75743bfdd

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
8d6cd0bd8b28de9d09560b1597791cc533258df5

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
87d11fe1b430f124d79f514a5e74eda43bd941a8

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
42eea3dc402968fda468fd0c4cd785192d8103c9

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
f7911b977b8f38b9f24bd5b0af77f14d3f5b51a2

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
d0269710e4c54ae429b7004fbe2d72d7e7b6e6c3

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
a634da70c00c91a3f71568fd888711312b0deaf7

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
19666d433d1f00db94120224b1e44127a3322201

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
b3ec82ee53c13a22991c0d418ba7814a698f0841

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
7ca56a6cebb50899092124900f33d945ce7233c4

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
16911245a11527612f0180bd10b9be82ecbe9b55

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
f6adb514a50abad2b067bfe9ef3829b6962f3a1c

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
a0e9bb6cdc6cc2eecdbb8be401662db36935da8a

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0d35c16d9e969ea9ee5a3594a12d56b81bbcbad7

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
8614efee0fde1d0ae22ea74d5c13323cd1f54572

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
5106571200056a68f0b6e555c9b2a0fe4429ee09

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
495ec1cecc01f87850305d1f2dbf1e859c961726

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
4b0f5152b0bdf834a47fb5aecd3b0cdf98e21f32

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,10 @@
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;
Expand Down Expand Up @@ -83,14 +85,20 @@ public FieldComparator<?> newComparator(String fieldname, int numHits, int sortP
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);
}
};
}
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,10 @@
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;
Expand Down Expand Up @@ -76,10 +78,15 @@ public FieldComparator<?> newComparator(String fieldname, int numHits, int sortP
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();
}
};
}
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@
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;
Expand Down Expand Up @@ -95,10 +97,15 @@ public FieldComparator<?> newComparator(String fieldname, int numHits, int sortP
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);
}
};
}
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
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;
Expand All @@ -40,6 +41,7 @@
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;
Expand Down Expand Up @@ -289,40 +291,47 @@ public int hashCode() {

@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());
}

@Override
public boolean advanceExact(int target) throws IOException {
return dvs.advanceExact(target);
}

@Override
public int docID() {
return dvs.docID();
}

@Override
public int nextDoc() throws IOException {
return dvs.nextDoc();
}

@Override
public int advance(int target) throws IOException {
return dvs.advance(target);
}

@Override
public long cost() {
return dvs.cost();
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 int docID() {
return dvs.docID();
}

@Override
public int nextDoc() throws IOException {
return dvs.nextDoc();
}

@Override
public int advance(int target) throws IOException {
return dvs.advance(target);
}

@Override
public long cost() {
return dvs.cost();
}
};
}
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@
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;
Expand Down Expand Up @@ -699,10 +701,15 @@ private NumericDoubleValues getNumericDoubleValues(LeafReaderContext context) th

@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();
}
};
}
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -670,11 +670,11 @@ public void testDisableTopScoreCollection() throws Exception {
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();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
a634da70c00c91a3f71568fd888711312b0deaf7

This file was deleted.

0 comments on commit 4de8579

Please sign in to comment.