Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade to Lucene 8.5.0-snapshot-c4475920b08 (#52950) #52977

Merged
merged 1 commit into from
Feb 29, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.7.0
lucene = 8.5.0-snapshot-b01d7cb
lucene = 8.5.0-snapshot-c4475920b08

bundled_jdk_vendor = adoptopenjdk
bundled_jdk = 13.0.2+8
Expand Down

This file was deleted.

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

This file was deleted.

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

This file was deleted.

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

This file was deleted.

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

This file was deleted.

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

This file was deleted.

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

This file was deleted.

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

This file was deleted.

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

This file was deleted.

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

This file was deleted.

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

This file was deleted.

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

This file was deleted.

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

This file was deleted.

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

This file was deleted.

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

This file was deleted.

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

This file was deleted.

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

This file was deleted.

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

This file was deleted.

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

This file was deleted.

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

This file was deleted.

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

This file was deleted.

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

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
b3ad5d3476ed85a529892962d057518555ccfcc9
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import org.apache.lucene.search.BooleanClause;
import org.apache.lucene.search.BooleanClause.Occur;
import org.apache.lucene.search.BooleanQuery;
import org.apache.lucene.search.BoostAttribute;
import org.apache.lucene.search.FuzzyQuery;
import org.apache.lucene.search.MultiTermQuery;
import org.apache.lucene.search.Query;
Expand Down Expand Up @@ -60,6 +61,7 @@

import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
Expand Down Expand Up @@ -274,7 +276,7 @@ public Query parse(Type type, String fieldName, Object value) throws IOException
&& (fieldType instanceof TextFieldMapper.TextFieldType || fieldType instanceof KeywordFieldMapper.KeywordFieldType)) {
return builder.newPrefixQuery(term);
} else {
return builder.newTermQuery(term);
return builder.newTermQuery(term, BoostAttribute.DEFAULT_BOOST);
}
}

Expand Down Expand Up @@ -562,7 +564,7 @@ private SpanQuery createSpanQuery(TokenStream in, String field, boolean isPrefix
}

@Override
protected Query newTermQuery(Term term) {
protected Query newTermQuery(Term term, float boost) {
Supplier<Query> querySupplier;
if (fuzziness != null) {
querySupplier = () -> {
Expand Down Expand Up @@ -613,7 +615,8 @@ private Query analyzeTerm(String field, TokenStream stream, boolean isPrefix) th
final Term term = new Term(field, termAtt.getBytesRef());
int lastOffset = offsetAtt.endOffset();
stream.end();
return isPrefix && lastOffset == offsetAtt.endOffset() ? newPrefixQuery(term) : newTermQuery(term);
return isPrefix && lastOffset == offsetAtt.endOffset() ?
newPrefixQuery(term) : newTermQuery(term, BoostAttribute.DEFAULT_BOOST);
}

private void add(BooleanQuery.Builder q, String field, List<Term> current, BooleanClause.Occur operator, boolean isPrefix) {
Expand All @@ -624,11 +627,14 @@ private void add(BooleanQuery.Builder q, String field, List<Term> current, Boole
if (isPrefix) {
q.add(newPrefixQuery(current.get(0)), operator);
} else {
q.add(newTermQuery(current.get(0)), operator);
q.add(newTermQuery(current.get(0), BoostAttribute.DEFAULT_BOOST), operator);
}
} else {
// We don't apply prefix on synonyms
q.add(newSynonymQuery(current.toArray(new Term[current.size()])), operator);
final TermAndBoost[] termAndBoosts = current.stream()
.map(t -> new TermAndBoost(t, BoostAttribute.DEFAULT_BOOST))
.toArray(TermAndBoost[]::new);
q.add(newSynonymQuery(termAndBoosts), operator);
}
}

Expand Down Expand Up @@ -739,10 +745,13 @@ public Query next() {
Term[] terms = graph.getTerms(field, start);
assert terms.length > 0;
if (terms.length == 1) {
queryPos = usePrefix ? newPrefixQuery(terms[0]) : newTermQuery(terms[0]);
queryPos = usePrefix ? newPrefixQuery(terms[0]) : newTermQuery(terms[0], BoostAttribute.DEFAULT_BOOST);
} else {
// We don't apply prefix on synonyms
queryPos = newSynonymQuery(terms);
final TermAndBoost[] termAndBoosts = Arrays.stream(terms)
.map(t -> new TermAndBoost(t, BoostAttribute.DEFAULT_BOOST))
.toArray(TermAndBoost[]::new);
queryPos = newSynonymQuery(termAndBoosts);
}
}
if (queryPos != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,16 +180,16 @@ private class BlendedQueryBuilder extends MatchQueryBuilder {
}

@Override
protected Query newSynonymQuery(Term[] terms) {
protected Query newSynonymQuery(TermAndBoost[] terms) {
BytesRef[] values = new BytesRef[terms.length];
for (int i = 0; i < terms.length; i++) {
values[i] = terms[i].bytes();
values[i] = terms[i].term.bytes();
}
return blendTerms(context, values, commonTermsCutoff, tieBreaker, lenient, blendedFields);
}

@Override
protected Query newTermQuery(Term term) {
protected Query newTermQuery(Term term, float boost) {
return blendTerm(context, term.bytes(), commonTermsCutoff, tieBreaker, lenient, blendedFields);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import org.apache.lucene.queryparser.classic.Token;
import org.apache.lucene.queryparser.classic.XQueryParser;
import org.apache.lucene.search.BooleanClause;
import org.apache.lucene.search.BoostAttribute;
import org.apache.lucene.search.BoostQuery;
import org.apache.lucene.search.DisjunctionMaxQuery;
import org.apache.lucene.search.FuzzyQuery;
Expand Down Expand Up @@ -588,7 +589,7 @@ private Query getPossiblyAnalyzedPrefixQuery(String field, String termStr) throw
if (isLastPos) {
posQuery = currentFieldType.prefixQuery(plist.get(0), getMultiTermRewriteMethod(), context);
} else {
posQuery = newTermQuery(new Term(field, plist.get(0)));
posQuery = newTermQuery(new Term(field, plist.get(0)), BoostAttribute.DEFAULT_BOOST);
}
} else if (isLastPos == false) {
// build a synonym query for terms in the same position.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import org.apache.lucene.queryparser.simple.SimpleQueryParser;
import org.apache.lucene.search.BooleanClause;
import org.apache.lucene.search.BooleanQuery;
import org.apache.lucene.search.BoostAttribute;
import org.apache.lucene.search.BoostQuery;
import org.apache.lucene.search.DisjunctionMaxQuery;
import org.apache.lucene.search.MatchNoDocsQuery;
Expand Down Expand Up @@ -104,7 +105,7 @@ public void setDefaultOperator(BooleanClause.Occur operator) {
}

@Override
protected Query newTermQuery(Term term) {
protected Query newTermQuery(Term term, float boost) {
MappedFieldType ft = context.fieldMapper(term.field());
if (ft == null) {
return newUnmappedFieldQuery(term.field());
Expand Down Expand Up @@ -259,7 +260,7 @@ private Query newPossiblyAnalyzedQuery(String field, String termStr, Analyzer an
if (isLastPos) {
posQuery = new PrefixQuery(new Term(field, plist.get(0)));
} else {
posQuery = newTermQuery(new Term(field, plist.get(0)));
posQuery = newTermQuery(new Term(field, plist.get(0)), BoostAttribute.DEFAULT_BOOST);
}
} else if (isLastPos == false) {
// build a synonym query for terms in the same position.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ public abstract class AnalysisFactoryTestCase extends ESTestCase {
.put("concatenategraph", Void.class)
// LUCENE-8936
.put("spanishminimalstem", Void.class)

.put("delimitedboost", Void.class)
.immutableMap();

static final Map<String,Class<?>> KNOWN_CHARFILTERS = new MapBuilder<String,Class<?>>()
Expand Down

This file was deleted.

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