Upgrade to lucene-6.0.0-f0aa4fc. #17075

This commit is contained in:
Adrien Grand 2016-03-11 17:21:36 +01:00
parent 8ac5a98b87
commit 5596e31068
51 changed files with 41 additions and 42 deletions

View File

@ -1,5 +1,5 @@
elasticsearch = 5.0.0
lucene = 6.0.0-snapshot-bea235f
lucene = 6.0.0-snapshot-f0aa4fc
# optional dependencies
spatial4j = 0.6

View File

@ -787,8 +787,9 @@ public class MapperQueryParser extends QueryParser {
assert q instanceof BoostQuery == false;
return pq;
} else if (q instanceof MultiPhraseQuery) {
((MultiPhraseQuery) q).setSlop(slop);
return q;
MultiPhraseQuery.Builder builder = new MultiPhraseQuery.Builder((MultiPhraseQuery) q);
builder.setSlop(slop);
return builder.build();
} else {
return q;
}

View File

@ -34,7 +34,6 @@ import org.elasticsearch.common.lucene.search.function.FunctionScoreQuery;
import java.io.IOException;
import java.util.Collection;
import java.util.List;
/**
*
@ -68,7 +67,7 @@ public class CustomFieldQuery extends FieldQuery {
flatten(((FiltersFunctionScoreQuery) sourceQuery).getSubQuery(), reader, flatQueries, boost);
} else if (sourceQuery instanceof MultiPhraseQuery) {
MultiPhraseQuery q = ((MultiPhraseQuery) sourceQuery);
convertMultiPhraseQuery(0, new int[q.getTermArrays().size()], q, q.getTermArrays(), q.getPositions(), reader, flatQueries);
convertMultiPhraseQuery(0, new int[q.getTermArrays().length], q, q.getTermArrays(), q.getPositions(), reader, flatQueries);
} else if (sourceQuery instanceof BlendedTermQuery) {
final BlendedTermQuery blendedTermQuery = (BlendedTermQuery) sourceQuery;
flatten(blendedTermQuery.rewrite(reader), reader, flatQueries, boost);
@ -77,7 +76,7 @@ public class CustomFieldQuery extends FieldQuery {
}
}
private void convertMultiPhraseQuery(int currentPos, int[] termsIdx, MultiPhraseQuery orig, List<Term[]> terms, int[] pos, IndexReader reader, Collection<Query> flatQueries) throws IOException {
private void convertMultiPhraseQuery(int currentPos, int[] termsIdx, MultiPhraseQuery orig, Term[][] terms, int[] pos, IndexReader reader, Collection<Query> flatQueries) throws IOException {
if (currentPos == 0) {
// if we have more than 16 terms
int numTerms = 0;
@ -97,16 +96,16 @@ public class CustomFieldQuery extends FieldQuery {
* we walk all possible ways and for each path down the MPQ we create a PhraseQuery this is what FieldQuery supports.
* It seems expensive but most queries will pretty small.
*/
if (currentPos == terms.size()) {
if (currentPos == terms.length) {
PhraseQuery.Builder queryBuilder = new PhraseQuery.Builder();
queryBuilder.setSlop(orig.getSlop());
for (int i = 0; i < termsIdx.length; i++) {
queryBuilder.add(terms.get(i)[termsIdx[i]], pos[i]);
queryBuilder.add(terms[i][termsIdx[i]], pos[i]);
}
Query query = queryBuilder.build();
this.flatten(query, reader, flatQueries, 1F);
} else {
Term[] t = terms.get(currentPos);
Term[] t = terms[currentPos];
for (int i = 0; i < t.length; i++) {
termsIdx[currentPos] = i;
convertMultiPhraseQuery(currentPos+1, termsIdx, orig, terms, pos, reader, flatQueries);

View File

@ -134,7 +134,7 @@ public class MultiPhrasePrefixQuery extends Query {
if (termArrays.isEmpty()) {
return new MatchNoDocsQuery();
}
MultiPhraseQuery query = new MultiPhraseQuery();
MultiPhraseQuery.Builder query = new MultiPhraseQuery.Builder();
query.setSlop(slop);
int sizeMinus1 = termArrays.size() - 1;
for (int i = 0; i < sizeMinus1; i++) {
@ -153,7 +153,7 @@ public class MultiPhrasePrefixQuery extends Query {
return Queries.newMatchNoDocsQuery();
}
query.add(terms.toArray(Term.class), position);
return query.rewrite(reader);
return query.build();
}
private void getPrefixTerms(ObjectHashSet<Term> terms, final Term prefix, final IndexReader reader) throws IOException {

View File

@ -45,7 +45,6 @@ import org.elasticsearch.index.query.QueryShardContext;
import org.elasticsearch.index.query.support.QueryParsers;
import java.io.IOException;
import java.util.List;
public class MatchQuery {
@ -336,10 +335,10 @@ public class MatchQuery {
return prefixQuery;
} else if (query instanceof MultiPhraseQuery) {
MultiPhraseQuery pq = (MultiPhraseQuery)query;
List<Term[]> terms = pq.getTermArrays();
Term[][] terms = pq.getTermArrays();
int[] positions = pq.getPositions();
for (int i = 0; i < terms.size(); i++) {
prefixQuery.add(terms.get(i), positions[i]);
for (int i = 0; i < terms.length; i++) {
prefixQuery.add(terms[i], positions[i]);
}
return prefixQuery;
} else if (query instanceof TermQuery) {

View File

@ -31,7 +31,7 @@ grant codeBase "${codebase.securesm-1.0.jar}" {
//// Very special jar permissions:
//// These are dangerous permissions that we don't want to grant to everything.
grant codeBase "${codebase.lucene-core-6.0.0-snapshot-bea235f.jar}" {
grant codeBase "${codebase.lucene-core-6.0.0-snapshot-f0aa4fc.jar}" {
// needed to allow MMapDirectory's "unmap hack" (die unmap hack, die)
// java 8 package
permission java.lang.RuntimePermission "accessClassInPackage.sun.misc";

View File

@ -31,7 +31,7 @@ grant codeBase "${codebase.securemock-1.2.jar}" {
permission java.lang.reflect.ReflectPermission "suppressAccessChecks";
};
grant codeBase "${codebase.lucene-test-framework-6.0.0-snapshot-bea235f.jar}" {
grant codeBase "${codebase.lucene-test-framework-6.0.0-snapshot-f0aa4fc.jar}" {
// needed by RamUsageTester
permission java.lang.reflect.ReflectPermission "suppressAccessChecks";
};

View File

@ -52,7 +52,7 @@ public class ReplaceMissingTests extends ESTestCase {
iw.close();
DirectoryReader reader = DirectoryReader.open(dir);
LeafReader ar = getOnlySegmentReader(reader);
LeafReader ar = getOnlyLeafReader(reader);
SortedDocValues raw = ar.getSortedDocValues("field");
assertEquals(2, raw.getValueCount());

View File

@ -576,20 +576,20 @@ public class ChildQuerySearchIT extends ESIntegTestCase {
.setQuery(hasChildQuery("child", termQuery("c_field", "1")).scoreMode(ScoreMode.Max))
.get();
assertHitCount(searchResponse, 1L);
assertThat(searchResponse.getHits().getAt(0).explanation().getDescription(), equalTo("Score based on join value p1"));
assertThat(searchResponse.getHits().getAt(0).explanation().getDescription(), containsString("join value p1"));
searchResponse = client().prepareSearch("test")
.setExplain(true)
.setQuery(hasParentQuery("parent", termQuery("p_field", "1")).score(true))
.get();
assertHitCount(searchResponse, 1L);
assertThat(searchResponse.getHits().getAt(0).explanation().getDescription(), equalTo("Score based on join value p1"));
assertThat(searchResponse.getHits().getAt(0).explanation().getDescription(), containsString("join value p1"));
ExplainResponse explainResponse = client().prepareExplain("test", "parent", parentId)
.setQuery(hasChildQuery("child", termQuery("c_field", "1")).scoreMode(ScoreMode.Max))
.get();
assertThat(explainResponse.isExists(), equalTo(true));
assertThat(explainResponse.getExplanation().getDetails()[0].getDescription(), equalTo("Score based on join value p1"));
assertThat(explainResponse.getExplanation().getDetails()[0].getDescription(), containsString("join value p1"));
}
List<IndexRequestBuilder> createDocBuilders() {

View File

@ -1 +0,0 @@
3510af19947deadd929123aaf14d69b4bdec759a

View File

@ -0,0 +1 @@
cd2388adc4b33c7530bbb8cd386e5c8c5c8e6aca

View File

@ -1 +0,0 @@
247ad7c17cb7c742d7a9abd5d9980e4fab815178

View File

@ -0,0 +1 @@
f5bbdd01b98fab7c18b46e762de3e39221b0c8fc

View File

@ -1 +0,0 @@
c0712dbec58abad545646edab67d58f7373f5329

View File

@ -0,0 +1 @@
18ad74518b34af7cfbd6c1e3a408920ff7665501

View File

@ -1 +0,0 @@
7573e3efb12dd16fdc991edaf408877dab20c030

View File

@ -0,0 +1 @@
dc0b211e31b8f1e0ee3a9e8f9c71b13fa088dabf

View File

@ -1 +0,0 @@
96ef0a9a43a5fc99d27bb7e7d61517ee4c7e54a4

View File

@ -0,0 +1 @@
bbd503396c08546f1b9e023e77dbf25bbb052d1c

View File

@ -1 +0,0 @@
d93de34947d37e31a337cdfed400333588c378d8

View File

@ -0,0 +1 @@
96fd93d4a4192c42b0d56198b73a25440d4db2f7

View File

@ -1 +0,0 @@
9c292930b1828e68f06509944a5346c141d56fd4

View File

@ -0,0 +1 @@
ddd44a319d201ff73cd25be139bd3175226ab5a5

View File

@ -1 +0,0 @@
866ed93f48683e877ffa4d9baa1323dcffbc65d7

View File

@ -0,0 +1 @@
07d943ecdc552632bdca8f2772fd081a02cbf589

View File

@ -1 +0,0 @@
967d9c2647bdd4d88961747f7436a5a92aa0385b

View File

@ -0,0 +1 @@
66c72fd979f54480af75d01719ef25da62c0a8b6

View File

@ -1 +0,0 @@
981030d83a7504267f3141d7365fad9b46d51465

View File

@ -0,0 +1 @@
8992204f922fe52af557e691cbfb4c54f92b76bd

View File

@ -1 +0,0 @@
707691b1baf22c29020569f5b875d200a4955411

View File

@ -0,0 +1 @@
8565264e00bc43e1226ff0d2e986dbb26d353ce2

View File

@ -1 +0,0 @@
be9e78130a069983f611f484d5b7b87bda0d6370

View File

@ -0,0 +1 @@
98fc1bb7e005f33c388be66486341ad8168b72eb

View File

@ -1 +0,0 @@
edeef6ce8a58d5e6a074bebf545918d04e8579e1

View File

@ -0,0 +1 @@
b5b651b0adbc2f404e091817282dabd7b432c677

View File

@ -1 +0,0 @@
d86a7ba859576bdcee1dacd8f407ccf71f982c60

View File

@ -0,0 +1 @@
334e194bf83c75f0ae165e3e72b6fa35c5d636c5

View File

@ -1 +0,0 @@
a3860de6502576f142dc948eb2005fa4dc0c27c5

View File

@ -0,0 +1 @@
89c46e9601cf8fb9acf77398838f8710c9e44053

View File

@ -1 +0,0 @@
8d11bf581b0afc25f87a57c06834cd85930d2ffa

View File

@ -0,0 +1 @@
f36f8010c9fec7342d34bece819c13de5f241135

View File

@ -1 +0,0 @@
38fda9b86e4f68eb6c9d31fb636a2540da219927

View File

@ -0,0 +1 @@
1378905632ff45a9887b267c4b30f7adef415ca4

View File

@ -1 +0,0 @@
352fea7a169ada6a7ae18e4ec34559496e09b465

View File

@ -0,0 +1 @@
49acd38e206d9c2fe28269fcba9b752d3b605e0e

View File

@ -1 +0,0 @@
445f5ea7822d0dd6b91364ec119cd6cb4635d285

View File

@ -0,0 +1 @@
7c11723d7d4dc3b1c9bf80089cfc2de7bc8a2b6e

View File

@ -1 +0,0 @@
0b216b7b9ff583bc1382edc8adfee4d4acd02859

View File

@ -0,0 +1 @@
654d961bd4975a3cb13388d86d72fefb6994f659

View File

@ -1 +0,0 @@
8d161a8c7e5b5b82f64dc5df2ca46197a3716672

View File

@ -0,0 +1 @@
0f408ac498782617a0f80d6a295d82f6d3609499