Merge branch 'master' into feature/query-refactoring
Conflicts: core/src/main/java/org/elasticsearch/index/query/FilteredQueryParser.java
This commit is contained in:
commit
8bd7cdbdad
|
@ -191,13 +191,6 @@
|
|||
<optional>true</optional>
|
||||
</dependency>
|
||||
|
||||
<!-- remove this for java 8 -->
|
||||
<dependency>
|
||||
<groupId>com.twitter</groupId>
|
||||
<artifactId>jsr166e</artifactId>
|
||||
<version>1.1.0</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
<component>
|
||||
<dependencySets>
|
||||
<!-- TODO: wtf is this file doing, is it still used? must we list all deps here? -->
|
||||
<dependencySet>
|
||||
<outputDirectory>/lib</outputDirectory>
|
||||
<useTransitiveFiltering>true</useTransitiveFiltering>
|
||||
|
@ -24,7 +25,6 @@
|
|||
<include>com.github.spullara.mustache.java:compiler</include>
|
||||
<include>com.tdunning:t-digest</include>
|
||||
<include>commons-cli:commons-cli</include>
|
||||
<include>com.twitter:jsr166e</include>
|
||||
<include>org.hdrhistogram:HdrHistogram</include>
|
||||
</includes>
|
||||
</dependencySet>
|
||||
|
|
|
@ -122,7 +122,6 @@ final class Security {
|
|||
static {
|
||||
Map<Pattern,String> m = new IdentityHashMap<>();
|
||||
m.put(Pattern.compile(".*lucene-core-.*\\.jar$"), "es.security.jar.lucene.core");
|
||||
m.put(Pattern.compile(".*jsr166e-.*\\.jar$"), "es.security.jar.twitter.jsr166e");
|
||||
m.put(Pattern.compile(".*securemock-.*\\.jar$"), "es.security.jar.elasticsearch.securemock");
|
||||
SPECIAL_JARS = Collections.unmodifiableMap(m);
|
||||
}
|
||||
|
|
|
@ -107,7 +107,7 @@ public class Lucene {
|
|||
for (SegmentCommitInfo info : infos) {
|
||||
list.add(info.files());
|
||||
}
|
||||
return Iterables.concat(list.toArray(new Collection[0]));
|
||||
return Iterables.concat(list);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -20,12 +20,7 @@
|
|||
package org.elasticsearch.common.lucene.search;
|
||||
|
||||
import com.carrotsearch.hppc.ObjectHashSet;
|
||||
|
||||
import org.apache.lucene.index.IndexReader;
|
||||
import org.apache.lucene.index.LeafReaderContext;
|
||||
import org.apache.lucene.index.Term;
|
||||
import org.apache.lucene.index.Terms;
|
||||
import org.apache.lucene.index.TermsEnum;
|
||||
import org.apache.lucene.index.*;
|
||||
import org.apache.lucene.search.MatchNoDocsQuery;
|
||||
import org.apache.lucene.search.MultiPhraseQuery;
|
||||
import org.apache.lucene.search.Query;
|
||||
|
@ -34,12 +29,7 @@ import org.apache.lucene.util.StringHelper;
|
|||
import org.apache.lucene.util.ToStringUtils;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.ListIterator;
|
||||
import java.util.*;
|
||||
|
||||
public class MultiPhrasePrefixQuery extends Query {
|
||||
|
||||
|
@ -90,7 +80,7 @@ public class MultiPhrasePrefixQuery extends Query {
|
|||
public void add(Term[] terms) {
|
||||
int position = 0;
|
||||
if (positions.size() > 0)
|
||||
position = positions.get(positions.size() - 1).intValue() + 1;
|
||||
position = positions.get(positions.size() - 1) + 1;
|
||||
|
||||
add(terms, position);
|
||||
}
|
||||
|
@ -98,8 +88,8 @@ public class MultiPhrasePrefixQuery extends Query {
|
|||
/**
|
||||
* Allows to specify the relative position of terms within the phrase.
|
||||
*
|
||||
* @param terms
|
||||
* @param position
|
||||
* @param terms the terms
|
||||
* @param position the position of the terms provided as argument
|
||||
* @see org.apache.lucene.search.PhraseQuery#add(Term, int)
|
||||
*/
|
||||
public void add(Term[] terms, int position) {
|
||||
|
@ -115,15 +105,7 @@ public class MultiPhrasePrefixQuery extends Query {
|
|||
}
|
||||
|
||||
termArrays.add(terms);
|
||||
positions.add(Integer.valueOf(position));
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a List of the terms in the multiphrase.
|
||||
* Do not modify the List or its contents.
|
||||
*/
|
||||
public List<Term[]> getTermArrays() {
|
||||
return Collections.unmodifiableList(termArrays);
|
||||
positions.add(position);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -132,7 +114,7 @@ public class MultiPhrasePrefixQuery extends Query {
|
|||
public int[] getPositions() {
|
||||
int[] result = new int[positions.size()];
|
||||
for (int i = 0; i < positions.size(); i++)
|
||||
result[i] = positions.get(i).intValue();
|
||||
result[i] = positions.get(i);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -160,6 +142,7 @@ public class MultiPhrasePrefixQuery extends Query {
|
|||
return Queries.newMatchNoDocsQuery();
|
||||
}
|
||||
query.add(terms.toArray(Term.class), position);
|
||||
query.setBoost(getBoost());
|
||||
return query.rewrite(reader);
|
||||
}
|
||||
|
||||
|
|
|
@ -20,15 +20,8 @@
|
|||
package org.elasticsearch.common.lucene.search;
|
||||
|
||||
import org.apache.lucene.index.Term;
|
||||
import org.apache.lucene.search.BooleanClause;
|
||||
import org.apache.lucene.search.*;
|
||||
import org.apache.lucene.search.BooleanClause.Occur;
|
||||
import org.apache.lucene.search.BooleanQuery;
|
||||
import org.apache.lucene.search.ConstantScoreQuery;
|
||||
import org.apache.lucene.search.Filter;
|
||||
import org.apache.lucene.search.MatchAllDocsQuery;
|
||||
import org.apache.lucene.search.PrefixQuery;
|
||||
import org.apache.lucene.search.Query;
|
||||
import org.apache.lucene.search.QueryWrapperFilter;
|
||||
import org.apache.lucene.util.BytesRef;
|
||||
import org.elasticsearch.common.Nullable;
|
||||
import org.elasticsearch.index.mapper.internal.TypeFieldMapper;
|
||||
|
@ -58,11 +51,15 @@ public class Queries {
|
|||
return new QueryWrapperFilter(not(newNestedFilter()));
|
||||
}
|
||||
|
||||
public static BooleanQuery filtered(Query query, Query filter) {
|
||||
BooleanQuery bq = new BooleanQuery();
|
||||
bq.add(query, Occur.MUST);
|
||||
bq.add(filter, Occur.FILTER);
|
||||
return bq;
|
||||
public static BooleanQuery filtered(@Nullable Query query, @Nullable Query filter) {
|
||||
BooleanQuery.Builder builder = new BooleanQuery.Builder();
|
||||
if (query != null) {
|
||||
builder.add(new BooleanClause(query, Occur.MUST));
|
||||
}
|
||||
if (filter != null) {
|
||||
builder.add(new BooleanClause(filter, Occur.FILTER));
|
||||
}
|
||||
return builder.build();
|
||||
}
|
||||
|
||||
/** Return a query that matches all documents but those that match the given query. */
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
|
||||
package org.elasticsearch.common.metrics;
|
||||
|
||||
import com.twitter.jsr166e.LongAdder;
|
||||
import java.util.concurrent.atomic.LongAdder;
|
||||
|
||||
/**
|
||||
*/
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
|
||||
package org.elasticsearch.common.metrics;
|
||||
|
||||
import com.twitter.jsr166e.LongAdder;
|
||||
import java.util.concurrent.atomic.LongAdder;
|
||||
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
|
||||
package org.elasticsearch.common.metrics;
|
||||
|
||||
import com.twitter.jsr166e.LongAdder;
|
||||
import java.util.concurrent.atomic.LongAdder;
|
||||
|
||||
/**
|
||||
*/
|
||||
|
|
|
@ -19,9 +19,9 @@
|
|||
|
||||
package org.elasticsearch.common.metrics;
|
||||
|
||||
import com.twitter.jsr166e.LongAdder;
|
||||
import org.elasticsearch.common.util.concurrent.FutureUtils;
|
||||
|
||||
import java.util.concurrent.atomic.LongAdder;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
import java.util.concurrent.ScheduledFuture;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
|
|
@ -22,12 +22,13 @@ package org.elasticsearch.common.network;
|
|||
import org.elasticsearch.common.component.AbstractComponent;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.transport.InetSocketTransportAddress;
|
||||
import org.elasticsearch.common.unit.ByteSizeValue;
|
||||
import org.elasticsearch.common.unit.TimeValue;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.InetAddress;
|
||||
import java.net.InterfaceAddress;
|
||||
import java.net.NetworkInterface;
|
||||
import java.net.UnknownHostException;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
|
@ -110,7 +111,26 @@ public class NetworkService extends AbstractComponent {
|
|||
if (bindHost == null) {
|
||||
bindHost = DEFAULT_NETWORK_HOST;
|
||||
}
|
||||
return resolveInetAddress(bindHost);
|
||||
InetAddress addresses[] = resolveInetAddress(bindHost);
|
||||
|
||||
// try to deal with some (mis)configuration
|
||||
if (addresses != null) {
|
||||
for (InetAddress address : addresses) {
|
||||
// check if its multicast: flat out mistake
|
||||
if (address.isMulticastAddress()) {
|
||||
throw new IllegalArgumentException("bind address: {" + NetworkAddress.format(address) + "} is invalid: multicast address");
|
||||
}
|
||||
// check if its broadcast: flat out mistake
|
||||
for (NetworkInterface nic : NetworkUtils.getInterfaces()) {
|
||||
for (InterfaceAddress intf : nic.getInterfaceAddresses()) {
|
||||
if (address.equals(intf.getBroadcast())) {
|
||||
throw new IllegalArgumentException("bind address: {" + NetworkAddress.format(address) + "} is invalid: broadcast address");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return addresses;
|
||||
}
|
||||
|
||||
// TODO: needs to be InetAddress[]
|
||||
|
@ -133,7 +153,31 @@ public class NetworkService extends AbstractComponent {
|
|||
publishHost = DEFAULT_NETWORK_HOST;
|
||||
}
|
||||
// TODO: allow publishing multiple addresses
|
||||
return resolveInetAddress(publishHost)[0];
|
||||
InetAddress address = resolveInetAddress(publishHost)[0];
|
||||
|
||||
// try to deal with some (mis)configuration
|
||||
if (address != null) {
|
||||
// check if its multicast: flat out mistake
|
||||
if (address.isMulticastAddress()) {
|
||||
throw new IllegalArgumentException("publish address: {" + NetworkAddress.format(address) + "} is invalid: multicast address");
|
||||
}
|
||||
// check if its broadcast: flat out mistake
|
||||
for (NetworkInterface nic : NetworkUtils.getInterfaces()) {
|
||||
for (InterfaceAddress intf : nic.getInterfaceAddresses()) {
|
||||
if (address.equals(intf.getBroadcast())) {
|
||||
throw new IllegalArgumentException("publish address: {" + NetworkAddress.format(address) + "} is invalid: broadcast address");
|
||||
}
|
||||
}
|
||||
}
|
||||
// wildcard address, probably set by network.host
|
||||
if (address.isAnyLocalAddress()) {
|
||||
InetAddress old = address;
|
||||
address = NetworkUtils.getFirstNonLoopbackAddresses()[0];
|
||||
logger.warn("publish address: {{}} is a wildcard address, falling back to first non-loopback: {{}}",
|
||||
NetworkAddress.format(old), NetworkAddress.format(address));
|
||||
}
|
||||
}
|
||||
return address;
|
||||
}
|
||||
|
||||
private InetAddress[] resolveInetAddress(String host) throws UnknownHostException, IOException {
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
|
||||
package org.elasticsearch.index.query;
|
||||
|
||||
import org.apache.lucene.search.ConstantScoreQuery;
|
||||
import org.apache.lucene.search.Query;
|
||||
import org.elasticsearch.common.io.stream.StreamInput;
|
||||
import org.elasticsearch.common.io.stream.StreamOutput;
|
||||
|
@ -105,14 +104,6 @@ public class FilteredQueryBuilder extends AbstractQueryBuilder<FilteredQueryBuil
|
|||
return null;
|
||||
}
|
||||
|
||||
if (filter == null || Queries.isConstantMatchAllQuery(filter)) {
|
||||
// no filter, or match all filter
|
||||
return query;
|
||||
} else if (Queries.isConstantMatchAllQuery(query)) {
|
||||
// if its a match_all query, use constant_score
|
||||
return new ConstantScoreQuery(filter);
|
||||
}
|
||||
|
||||
// use a BooleanQuery
|
||||
return Queries.filtered(query, filter);
|
||||
}
|
||||
|
|
|
@ -88,5 +88,4 @@ public class FilteredQueryParser extends BaseQueryParser<FilteredQueryBuilder> {
|
|||
public FilteredQueryBuilder getBuilderPrototype() {
|
||||
return FilteredQueryBuilder.PROTOTYPE;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -470,7 +470,7 @@ public class InternalSearchHit implements SearchHit {
|
|||
builder.field(Fields._SCORE, score);
|
||||
}
|
||||
for (SearchHitField field : metaFields) {
|
||||
builder.field(field.name(), field.value());
|
||||
builder.field(field.name(), (Object) field.value());
|
||||
}
|
||||
if (source != null) {
|
||||
XContentHelper.writeRawField("_source", source, builder, params);
|
||||
|
|
|
@ -112,6 +112,18 @@ public class QueryPhase implements SearchPhase {
|
|||
aggregationPhase.execute(searchContext);
|
||||
}
|
||||
|
||||
private static boolean returnsDocsInOrder(Query query, Sort sort) {
|
||||
if (sort == null || Sort.RELEVANCE.equals(sort)) {
|
||||
// sort by score
|
||||
// queries that return constant scores will return docs in index
|
||||
// order since Lucene tie-breaks on the doc id
|
||||
return query.getClass() == ConstantScoreQuery.class
|
||||
|| query.getClass() == MatchAllDocsQuery.class;
|
||||
} else {
|
||||
return Sort.INDEXORDER.equals(sort);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* In a package-private method so that it can be tested without having to
|
||||
* wire everything (mapperService, etc.)
|
||||
|
@ -165,7 +177,7 @@ public class QueryPhase implements SearchPhase {
|
|||
numDocs = Math.min(searchContext.size(), totalNumDocs);
|
||||
lastEmittedDoc = scrollContext.lastEmittedDoc;
|
||||
|
||||
if (Sort.INDEXORDER.equals(searchContext.sort())) {
|
||||
if (returnsDocsInOrder(query, searchContext.sort())) {
|
||||
if (scrollContext.totalHits == -1) {
|
||||
// first round
|
||||
assert scrollContext.lastEmittedDoc == null;
|
||||
|
|
|
@ -112,6 +112,7 @@ public class Suggest implements Iterable<Suggest.Suggestion<? extends Entry<? ex
|
|||
final int size = in.readVInt();
|
||||
suggestions = new ArrayList<>(size);
|
||||
for (int i = 0; i < size; i++) {
|
||||
// TODO: remove these complicated generics
|
||||
Suggestion<? extends Entry<? extends Option>> suggestion;
|
||||
final int type = in.readVInt();
|
||||
switch (type) {
|
||||
|
@ -125,7 +126,7 @@ public class Suggest implements Iterable<Suggest.Suggestion<? extends Entry<? ex
|
|||
suggestion = new PhraseSuggestion();
|
||||
break;
|
||||
default:
|
||||
suggestion = new Suggestion<>();
|
||||
suggestion = new Suggestion<Entry<? extends Option>>();
|
||||
break;
|
||||
}
|
||||
suggestion.readFrom(in);
|
||||
|
|
|
@ -36,12 +36,6 @@ grant codeBase "${es.security.jar.lucene.core}" {
|
|||
permission java.lang.RuntimePermission "accessClassInPackage.sun.misc";
|
||||
};
|
||||
|
||||
grant codeBase "${es.security.jar.twitter.jsr166e}" {
|
||||
// needed for LongAdder etc
|
||||
// TODO: remove this in java 8!
|
||||
permission java.lang.RuntimePermission "accessClassInPackage.sun.misc";
|
||||
};
|
||||
|
||||
grant codeBase "${es.security.jar.elasticsearch.securemock}" {
|
||||
// needed to support creation of mocks
|
||||
permission java.lang.RuntimePermission "reflectionFactoryAccess";
|
||||
|
|
|
@ -23,13 +23,12 @@ import org.apache.lucene.document.Document;
|
|||
import org.apache.lucene.document.Field;
|
||||
import org.apache.lucene.document.TextField;
|
||||
import org.apache.lucene.index.*;
|
||||
import org.apache.lucene.search.IndexSearcher;
|
||||
import org.apache.lucene.search.*;
|
||||
import org.apache.lucene.store.RAMDirectory;
|
||||
import org.elasticsearch.common.lucene.Lucene;
|
||||
import org.elasticsearch.test.ESTestCase;
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
|
||||
public class MultiPhrasePrefixQueryTests extends ESTestCase {
|
||||
|
@ -63,4 +62,21 @@ public class MultiPhrasePrefixQueryTests extends ESTestCase {
|
|||
query.add(new Term("field", "xxx"));
|
||||
assertThat(Lucene.count(searcher, query), equalTo(0l));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testBoost() throws Exception {
|
||||
IndexWriter writer = new IndexWriter(new RAMDirectory(), new IndexWriterConfig(Lucene.STANDARD_ANALYZER));
|
||||
Document doc = new Document();
|
||||
doc.add(new Field("field", "aaa bbb", TextField.TYPE_NOT_STORED));
|
||||
writer.addDocument(doc);
|
||||
doc = new Document();
|
||||
doc.add(new Field("field", "ccc ddd", TextField.TYPE_NOT_STORED));
|
||||
writer.addDocument(doc);
|
||||
IndexReader reader = DirectoryReader.open(writer, true);
|
||||
MultiPhrasePrefixQuery multiPhrasePrefixQuery = new MultiPhrasePrefixQuery();
|
||||
multiPhrasePrefixQuery.add(new Term[]{new Term("field", "aaa"), new Term("field", "bb")});
|
||||
multiPhrasePrefixQuery.setBoost(randomFloat());
|
||||
Query query = multiPhrasePrefixQuery.rewrite(reader);
|
||||
assertThat(query.getBoost(), equalTo(multiPhrasePrefixQuery.getBoost()));
|
||||
}
|
||||
}
|
|
@ -0,0 +1,170 @@
|
|||
/*
|
||||
* Licensed to Elasticsearch under one or more contributor
|
||||
* license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright
|
||||
* ownership. Elasticsearch licenses this file to you under
|
||||
* the Apache License, Version 2.0 (the "License"); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
package org.elasticsearch.common.network;
|
||||
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.test.ESTestCase;
|
||||
|
||||
import java.net.InetAddress;
|
||||
import java.net.InterfaceAddress;
|
||||
import java.net.NetworkInterface;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Tests for network service... try to keep them safe depending upon configuration
|
||||
* please don't actually bind to anything, just test the addresses.
|
||||
*/
|
||||
public class NetworkServiceTests extends ESTestCase {
|
||||
|
||||
/**
|
||||
* ensure exception if we bind to multicast ipv4 address
|
||||
*/
|
||||
public void testBindMulticastV4() throws Exception {
|
||||
NetworkService service = new NetworkService(Settings.EMPTY);
|
||||
try {
|
||||
service.resolveBindHostAddress("239.1.1.1");
|
||||
fail("should have hit exception");
|
||||
} catch (IllegalArgumentException e) {
|
||||
assertTrue(e.getMessage().contains("invalid: multicast"));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* ensure exception if we bind to multicast ipv6 address
|
||||
*/
|
||||
public void testBindMulticastV6() throws Exception {
|
||||
NetworkService service = new NetworkService(Settings.EMPTY);
|
||||
try {
|
||||
service.resolveBindHostAddress("FF08::108");
|
||||
fail("should have hit exception");
|
||||
} catch (IllegalArgumentException e) {
|
||||
assertTrue(e.getMessage().contains("invalid: multicast"));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* ensure exception if we publish to multicast ipv4 address
|
||||
*/
|
||||
public void testPublishMulticastV4() throws Exception {
|
||||
NetworkService service = new NetworkService(Settings.EMPTY);
|
||||
try {
|
||||
service.resolvePublishHostAddress("239.1.1.1");
|
||||
fail("should have hit exception");
|
||||
} catch (IllegalArgumentException e) {
|
||||
assertTrue(e.getMessage().contains("invalid: multicast"));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* ensure exception if we publish to multicast ipv6 address
|
||||
*/
|
||||
public void testPublishMulticastV6() throws Exception {
|
||||
NetworkService service = new NetworkService(Settings.EMPTY);
|
||||
try {
|
||||
service.resolvePublishHostAddress("FF08::108");
|
||||
fail("should have hit exception");
|
||||
} catch (IllegalArgumentException e) {
|
||||
assertTrue(e.getMessage().contains("invalid: multicast"));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* ensure exception if we bind/publish to broadcast address
|
||||
*/
|
||||
public void testBindPublishBroadcast() throws Exception {
|
||||
NetworkService service = new NetworkService(Settings.EMPTY);
|
||||
// collect any broadcast addresses on the system
|
||||
List<InetAddress> addresses = new ArrayList<>();
|
||||
for (NetworkInterface nic : Collections.list(NetworkInterface.getNetworkInterfaces())) {
|
||||
for (InterfaceAddress intf : nic.getInterfaceAddresses()) {
|
||||
InetAddress address = intf.getBroadcast();
|
||||
if (address != null) {
|
||||
addresses.add(address);
|
||||
}
|
||||
}
|
||||
}
|
||||
// can easily happen (ipv6-only, localhost-only, ...)
|
||||
assumeTrue("test requires broadcast addresses configured", addresses.size() > 0);
|
||||
// make sure we fail on each one
|
||||
for (InetAddress address : addresses) {
|
||||
try {
|
||||
service.resolveBindHostAddress(NetworkAddress.formatAddress(address));
|
||||
fail("should have hit exception for broadcast address: " + address);
|
||||
} catch (IllegalArgumentException e) {
|
||||
assertTrue(e.getMessage().contains("invalid: broadcast"));
|
||||
}
|
||||
|
||||
try {
|
||||
service.resolvePublishHostAddress(NetworkAddress.formatAddress(address));
|
||||
fail("should have hit exception for broadcast address: " + address);
|
||||
} catch (IllegalArgumentException e) {
|
||||
assertTrue(e.getMessage().contains("invalid: broadcast"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* ensure specifying wildcard ipv4 address will bind to all interfaces
|
||||
*/
|
||||
public void testBindAnyLocalV4() throws Exception {
|
||||
NetworkService service = new NetworkService(Settings.EMPTY);
|
||||
assertEquals(InetAddress.getByName("0.0.0.0"), service.resolveBindHostAddress("0.0.0.0")[0]);
|
||||
}
|
||||
|
||||
/**
|
||||
* ensure specifying wildcard ipv6 address will bind to all interfaces
|
||||
*/
|
||||
public void testBindAnyLocalV6() throws Exception {
|
||||
NetworkService service = new NetworkService(Settings.EMPTY);
|
||||
assertEquals(InetAddress.getByName("::"), service.resolveBindHostAddress("::")[0]);
|
||||
}
|
||||
|
||||
/**
|
||||
* ensure specifying wildcard ipv4 address selects reasonable publish address
|
||||
*/
|
||||
public void testPublishAnyLocalV4() throws Exception {
|
||||
InetAddress expected = null;
|
||||
try {
|
||||
expected = NetworkUtils.getFirstNonLoopbackAddresses()[0];
|
||||
} catch (Exception e) {
|
||||
assumeNoException("test requires up-and-running non-loopback address", e);
|
||||
}
|
||||
|
||||
NetworkService service = new NetworkService(Settings.EMPTY);
|
||||
assertEquals(expected, service.resolvePublishHostAddress("0.0.0.0"));
|
||||
}
|
||||
|
||||
/**
|
||||
* ensure specifying wildcard ipv6 address selects reasonable publish address
|
||||
*/
|
||||
public void testPublishAnyLocalV6() throws Exception {
|
||||
InetAddress expected = null;
|
||||
try {
|
||||
expected = NetworkUtils.getFirstNonLoopbackAddresses()[0];
|
||||
} catch (Exception e) {
|
||||
assumeNoException("test requires up-and-running non-loopback address", e);
|
||||
}
|
||||
|
||||
NetworkService service = new NetworkService(Settings.EMPTY);
|
||||
assertEquals(expected, service.resolvePublishHostAddress("::"));
|
||||
}
|
||||
}
|
|
@ -21,6 +21,7 @@ package org.elasticsearch.discovery;
|
|||
|
||||
import com.google.common.base.Predicate;
|
||||
import org.apache.lucene.util.LuceneTestCase;
|
||||
import org.apache.lucene.util.LuceneTestCase.AwaitsFix;
|
||||
import org.elasticsearch.ElasticsearchException;
|
||||
import org.elasticsearch.action.admin.cluster.health.ClusterHealthResponse;
|
||||
import org.elasticsearch.action.admin.cluster.reroute.ClusterRerouteResponse;
|
||||
|
@ -983,6 +984,7 @@ public class DiscoveryWithServiceDisruptionsIT extends ESIntegTestCase {
|
|||
* successful.
|
||||
*/
|
||||
@Test
|
||||
@AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/13316")
|
||||
public void testReadOnPostRecoveryShards() throws Exception {
|
||||
List<BlockClusterStateProcessing> clusterStateBlocks = new ArrayList<>();
|
||||
try {
|
||||
|
|
|
@ -844,7 +844,6 @@ public class SimpleIndexQueryParserTests extends ESSingleNodeTestCase {
|
|||
assertEquals(expected, parsedQuery);
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testBoolFilteredQuery() throws IOException {
|
||||
IndexQueryParserService queryParser = queryParser();
|
||||
|
@ -869,8 +868,10 @@ public class SimpleIndexQueryParserTests extends ESSingleNodeTestCase {
|
|||
BooleanQuery and = new BooleanQuery();
|
||||
and.add(new TermQuery(new Term("name.first", "shay1")), Occur.MUST);
|
||||
and.add(new TermQuery(new Term("name.first", "shay4")), Occur.MUST);
|
||||
ConstantScoreQuery expected = new ConstantScoreQuery(and);
|
||||
assertEquals(expected, parsedQuery);
|
||||
BooleanQuery.Builder builder = new BooleanQuery.Builder();
|
||||
builder.add(new BooleanClause(new MatchAllDocsQuery(), Occur.MUST));
|
||||
builder.add(new BooleanClause(and, Occur.FILTER));
|
||||
assertEquals(builder.build(), parsedQuery);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -922,8 +923,10 @@ public class SimpleIndexQueryParserTests extends ESSingleNodeTestCase {
|
|||
BooleanQuery or = new BooleanQuery();
|
||||
or.add(new TermQuery(new Term("name.first", "shay1")), Occur.SHOULD);
|
||||
or.add(new TermQuery(new Term("name.first", "shay4")), Occur.SHOULD);
|
||||
ConstantScoreQuery expected = new ConstantScoreQuery(or);
|
||||
assertEquals(expected, parsedQuery);
|
||||
BooleanQuery.Builder builder = new BooleanQuery.Builder();
|
||||
builder.add(new MatchAllDocsQuery(), Occur.MUST);
|
||||
builder.add(or, Occur.FILTER);
|
||||
assertEquals(builder.build(), parsedQuery);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -958,8 +961,10 @@ public class SimpleIndexQueryParserTests extends ESSingleNodeTestCase {
|
|||
public void testNotFilteredQueryBuilder() throws IOException {
|
||||
IndexQueryParserService queryParser = queryParser();
|
||||
Query parsedQuery = queryParser.parse(filteredQuery(matchAllQuery(), notQuery(termQuery("name.first", "shay1")))).query();
|
||||
ConstantScoreQuery expected = new ConstantScoreQuery(Queries.not(new TermQuery(new Term("name.first", "shay1"))));
|
||||
assertEquals(expected, parsedQuery);
|
||||
BooleanQuery.Builder builder = new BooleanQuery.Builder();
|
||||
builder.add(new MatchAllDocsQuery(), Occur.MUST);
|
||||
builder.add(Queries.not(new TermQuery(new Term("name.first", "shay1"))), Occur.FILTER);
|
||||
assertEquals(builder.build(), parsedQuery);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -1782,9 +1787,16 @@ public class SimpleIndexQueryParserTests extends ESSingleNodeTestCase {
|
|||
String query = copyToStringFromClasspath("/org/elasticsearch/index/query/geo_distance-named.json");
|
||||
ParsedQuery parsedQuery = queryParser.parse(query);
|
||||
assertThat(parsedQuery.namedFilters().containsKey("test"), equalTo(true));
|
||||
assertThat(parsedQuery.query(), instanceOf(ConstantScoreQuery.class));
|
||||
ConstantScoreQuery constantScoreQuery = (ConstantScoreQuery) parsedQuery.query();
|
||||
GeoDistanceRangeQuery filter = (GeoDistanceRangeQuery) constantScoreQuery.getQuery();
|
||||
assertThat(parsedQuery.query(), instanceOf(BooleanQuery.class));
|
||||
BooleanQuery booleanQuery = (BooleanQuery) parsedQuery.query();
|
||||
assertThat(booleanQuery.clauses().size(), equalTo(2));
|
||||
BooleanClause booleanClause = booleanQuery.clauses().get(0);
|
||||
assertThat(booleanClause.getOccur(), equalTo(Occur.MUST));
|
||||
assertThat(booleanClause.getQuery(), instanceOf(MatchAllDocsQuery.class));
|
||||
booleanClause = booleanQuery.clauses().get(1);
|
||||
assertThat(booleanClause.getOccur(), equalTo(Occur.FILTER));
|
||||
assertThat(booleanClause.getQuery(), instanceOf(GeoDistanceRangeQuery.class));
|
||||
GeoDistanceRangeQuery filter = (GeoDistanceRangeQuery) booleanClause.getQuery();
|
||||
assertThat(filter.fieldName(), equalTo("location"));
|
||||
assertThat(filter.lat(), closeTo(40, 0.00001));
|
||||
assertThat(filter.lon(), closeTo(-70, 0.00001));
|
||||
|
@ -1797,9 +1809,16 @@ public class SimpleIndexQueryParserTests extends ESSingleNodeTestCase {
|
|||
IndexQueryParserService queryParser = queryParser();
|
||||
String query = copyToStringFromClasspath("/org/elasticsearch/index/query/geo_distance1.json");
|
||||
Query parsedQuery = queryParser.parse(query).query();
|
||||
assertThat(parsedQuery, instanceOf(ConstantScoreQuery.class));
|
||||
ConstantScoreQuery constantScoreQuery = (ConstantScoreQuery) parsedQuery;
|
||||
GeoDistanceRangeQuery filter = (GeoDistanceRangeQuery) constantScoreQuery.getQuery();
|
||||
assertThat(parsedQuery, instanceOf(BooleanQuery.class));
|
||||
BooleanQuery booleanQuery = (BooleanQuery) parsedQuery;
|
||||
assertThat(booleanQuery.clauses().size(), equalTo(2));
|
||||
BooleanClause booleanClause = booleanQuery.clauses().get(0);
|
||||
assertThat(booleanClause.getOccur(), equalTo(Occur.MUST));
|
||||
assertThat(booleanClause.getQuery(), instanceOf(MatchAllDocsQuery.class));
|
||||
booleanClause = booleanQuery.clauses().get(1);
|
||||
assertThat(booleanClause.getOccur(), equalTo(Occur.FILTER));
|
||||
assertThat(booleanClause.getQuery(), instanceOf(GeoDistanceRangeQuery.class));
|
||||
GeoDistanceRangeQuery filter = (GeoDistanceRangeQuery) booleanClause.getQuery();
|
||||
assertThat(filter.fieldName(), equalTo("location"));
|
||||
assertThat(filter.lat(), closeTo(40, 0.00001));
|
||||
assertThat(filter.lon(), closeTo(-70, 0.00001));
|
||||
|
@ -1812,9 +1831,16 @@ public class SimpleIndexQueryParserTests extends ESSingleNodeTestCase {
|
|||
IndexQueryParserService queryParser = queryParser();
|
||||
String query = copyToStringFromClasspath("/org/elasticsearch/index/query/geo_distance2.json");
|
||||
Query parsedQuery = queryParser.parse(query).query();
|
||||
assertThat(parsedQuery, instanceOf(ConstantScoreQuery.class));
|
||||
ConstantScoreQuery constantScoreQuery = (ConstantScoreQuery) parsedQuery;
|
||||
GeoDistanceRangeQuery filter = (GeoDistanceRangeQuery) constantScoreQuery.getQuery();
|
||||
assertThat(parsedQuery, instanceOf(BooleanQuery.class));
|
||||
BooleanQuery booleanQuery = (BooleanQuery) parsedQuery;
|
||||
assertThat(booleanQuery.clauses().size(), equalTo(2));
|
||||
BooleanClause booleanClause = booleanQuery.clauses().get(0);
|
||||
assertThat(booleanClause.getOccur(), equalTo(Occur.MUST));
|
||||
assertThat(booleanClause.getQuery(), instanceOf(MatchAllDocsQuery.class));
|
||||
booleanClause = booleanQuery.clauses().get(1);
|
||||
assertThat(booleanClause.getOccur(), equalTo(Occur.FILTER));
|
||||
assertThat(booleanClause.getQuery(), instanceOf(GeoDistanceRangeQuery.class));
|
||||
GeoDistanceRangeQuery filter = (GeoDistanceRangeQuery) booleanClause.getQuery();
|
||||
assertThat(filter.fieldName(), equalTo("location"));
|
||||
assertThat(filter.lat(), closeTo(40, 0.00001));
|
||||
assertThat(filter.lon(), closeTo(-70, 0.00001));
|
||||
|
@ -1827,9 +1853,16 @@ public class SimpleIndexQueryParserTests extends ESSingleNodeTestCase {
|
|||
IndexQueryParserService queryParser = queryParser();
|
||||
String query = copyToStringFromClasspath("/org/elasticsearch/index/query/geo_distance3.json");
|
||||
Query parsedQuery = queryParser.parse(query).query();
|
||||
assertThat(parsedQuery, instanceOf(ConstantScoreQuery.class));
|
||||
ConstantScoreQuery constantScoreQuery = (ConstantScoreQuery) parsedQuery;
|
||||
GeoDistanceRangeQuery filter = (GeoDistanceRangeQuery) constantScoreQuery.getQuery();
|
||||
assertThat(parsedQuery, instanceOf(BooleanQuery.class));
|
||||
BooleanQuery booleanQuery = (BooleanQuery) parsedQuery;
|
||||
assertThat(booleanQuery.clauses().size(), equalTo(2));
|
||||
BooleanClause booleanClause = booleanQuery.clauses().get(0);
|
||||
assertThat(booleanClause.getOccur(), equalTo(Occur.MUST));
|
||||
assertThat(booleanClause.getQuery(), instanceOf(MatchAllDocsQuery.class));
|
||||
booleanClause = booleanQuery.clauses().get(1);
|
||||
assertThat(booleanClause.getOccur(), equalTo(Occur.FILTER));
|
||||
assertThat(booleanClause.getQuery(), instanceOf(GeoDistanceRangeQuery.class));
|
||||
GeoDistanceRangeQuery filter = (GeoDistanceRangeQuery) booleanClause.getQuery();
|
||||
assertThat(filter.fieldName(), equalTo("location"));
|
||||
assertThat(filter.lat(), closeTo(40, 0.00001));
|
||||
assertThat(filter.lon(), closeTo(-70, 0.00001));
|
||||
|
@ -1842,9 +1875,16 @@ public class SimpleIndexQueryParserTests extends ESSingleNodeTestCase {
|
|||
IndexQueryParserService queryParser = queryParser();
|
||||
String query = copyToStringFromClasspath("/org/elasticsearch/index/query/geo_distance4.json");
|
||||
Query parsedQuery = queryParser.parse(query).query();
|
||||
assertThat(parsedQuery, instanceOf(ConstantScoreQuery.class));
|
||||
ConstantScoreQuery constantScoreQuery = (ConstantScoreQuery) parsedQuery;
|
||||
GeoDistanceRangeQuery filter = (GeoDistanceRangeQuery) constantScoreQuery.getQuery();
|
||||
assertThat(parsedQuery, instanceOf(BooleanQuery.class));
|
||||
BooleanQuery booleanQuery = (BooleanQuery) parsedQuery;
|
||||
assertThat(booleanQuery.clauses().size(), equalTo(2));
|
||||
BooleanClause booleanClause = booleanQuery.clauses().get(0);
|
||||
assertThat(booleanClause.getOccur(), equalTo(Occur.MUST));
|
||||
assertThat(booleanClause.getQuery(), instanceOf(MatchAllDocsQuery.class));
|
||||
booleanClause = booleanQuery.clauses().get(1);
|
||||
assertThat(booleanClause.getOccur(), equalTo(Occur.FILTER));
|
||||
assertThat(booleanClause.getQuery(), instanceOf(GeoDistanceRangeQuery.class));
|
||||
GeoDistanceRangeQuery filter = (GeoDistanceRangeQuery) booleanClause.getQuery();
|
||||
assertThat(filter.fieldName(), equalTo("location"));
|
||||
assertThat(filter.lat(), closeTo(40, 0.00001));
|
||||
assertThat(filter.lon(), closeTo(-70, 0.00001));
|
||||
|
@ -1857,9 +1897,16 @@ public class SimpleIndexQueryParserTests extends ESSingleNodeTestCase {
|
|||
IndexQueryParserService queryParser = queryParser();
|
||||
String query = copyToStringFromClasspath("/org/elasticsearch/index/query/geo_distance5.json");
|
||||
Query parsedQuery = queryParser.parse(query).query();
|
||||
assertThat(parsedQuery, instanceOf(ConstantScoreQuery.class));
|
||||
ConstantScoreQuery constantScoreQuery = (ConstantScoreQuery) parsedQuery;
|
||||
GeoDistanceRangeQuery filter = (GeoDistanceRangeQuery) constantScoreQuery.getQuery();
|
||||
assertThat(parsedQuery, instanceOf(BooleanQuery.class));
|
||||
BooleanQuery booleanQuery = (BooleanQuery) parsedQuery;
|
||||
assertThat(booleanQuery.clauses().size(), equalTo(2));
|
||||
BooleanClause booleanClause = booleanQuery.clauses().get(0);
|
||||
assertThat(booleanClause.getOccur(), equalTo(Occur.MUST));
|
||||
assertThat(booleanClause.getQuery(), instanceOf(MatchAllDocsQuery.class));
|
||||
booleanClause = booleanQuery.clauses().get(1);
|
||||
assertThat(booleanClause.getOccur(), equalTo(Occur.FILTER));
|
||||
assertThat(booleanClause.getQuery(), instanceOf(GeoDistanceRangeQuery.class));
|
||||
GeoDistanceRangeQuery filter = (GeoDistanceRangeQuery) booleanClause.getQuery();
|
||||
assertThat(filter.fieldName(), equalTo("location"));
|
||||
assertThat(filter.lat(), closeTo(40, 0.00001));
|
||||
assertThat(filter.lon(), closeTo(-70, 0.00001));
|
||||
|
@ -1872,9 +1919,16 @@ public class SimpleIndexQueryParserTests extends ESSingleNodeTestCase {
|
|||
IndexQueryParserService queryParser = queryParser();
|
||||
String query = copyToStringFromClasspath("/org/elasticsearch/index/query/geo_distance6.json");
|
||||
Query parsedQuery = queryParser.parse(query).query();
|
||||
assertThat(parsedQuery, instanceOf(ConstantScoreQuery.class));
|
||||
ConstantScoreQuery constantScoreQuery = (ConstantScoreQuery) parsedQuery;
|
||||
GeoDistanceRangeQuery filter = (GeoDistanceRangeQuery) constantScoreQuery.getQuery();
|
||||
assertThat(parsedQuery, instanceOf(BooleanQuery.class));
|
||||
BooleanQuery booleanQuery = (BooleanQuery) parsedQuery;
|
||||
assertThat(booleanQuery.clauses().size(), equalTo(2));
|
||||
BooleanClause booleanClause = booleanQuery.clauses().get(0);
|
||||
assertThat(booleanClause.getOccur(), equalTo(Occur.MUST));
|
||||
assertThat(booleanClause.getQuery(), instanceOf(MatchAllDocsQuery.class));
|
||||
booleanClause = booleanQuery.clauses().get(1);
|
||||
assertThat(booleanClause.getOccur(), equalTo(Occur.FILTER));
|
||||
assertThat(booleanClause.getQuery(), instanceOf(GeoDistanceRangeQuery.class));
|
||||
GeoDistanceRangeQuery filter = (GeoDistanceRangeQuery) booleanClause.getQuery();
|
||||
assertThat(filter.fieldName(), equalTo("location"));
|
||||
assertThat(filter.lat(), closeTo(40, 0.00001));
|
||||
assertThat(filter.lon(), closeTo(-70, 0.00001));
|
||||
|
@ -1887,9 +1941,16 @@ public class SimpleIndexQueryParserTests extends ESSingleNodeTestCase {
|
|||
IndexQueryParserService queryParser = queryParser();
|
||||
String query = copyToStringFromClasspath("/org/elasticsearch/index/query/geo_distance7.json");
|
||||
Query parsedQuery = queryParser.parse(query).query();
|
||||
assertThat(parsedQuery, instanceOf(ConstantScoreQuery.class));
|
||||
ConstantScoreQuery constantScoreQuery = (ConstantScoreQuery) parsedQuery;
|
||||
GeoDistanceRangeQuery filter = (GeoDistanceRangeQuery) constantScoreQuery.getQuery();
|
||||
assertThat(parsedQuery, instanceOf(BooleanQuery.class));
|
||||
BooleanQuery booleanQuery = (BooleanQuery) parsedQuery;
|
||||
assertThat(booleanQuery.clauses().size(), equalTo(2));
|
||||
BooleanClause booleanClause = booleanQuery.clauses().get(0);
|
||||
assertThat(booleanClause.getOccur(), equalTo(Occur.MUST));
|
||||
assertThat(booleanClause.getQuery(), instanceOf(MatchAllDocsQuery.class));
|
||||
booleanClause = booleanQuery.clauses().get(1);
|
||||
assertThat(booleanClause.getOccur(), equalTo(Occur.FILTER));
|
||||
assertThat(booleanClause.getQuery(), instanceOf(GeoDistanceRangeQuery.class));
|
||||
GeoDistanceRangeQuery filter = (GeoDistanceRangeQuery) booleanClause.getQuery();
|
||||
assertThat(filter.fieldName(), equalTo("location"));
|
||||
assertThat(filter.lat(), closeTo(40, 0.00001));
|
||||
assertThat(filter.lon(), closeTo(-70, 0.00001));
|
||||
|
@ -1902,9 +1963,16 @@ public class SimpleIndexQueryParserTests extends ESSingleNodeTestCase {
|
|||
IndexQueryParserService queryParser = queryParser();
|
||||
String query = copyToStringFromClasspath("/org/elasticsearch/index/query/geo_distance8.json");
|
||||
Query parsedQuery = queryParser.parse(query).query();
|
||||
assertThat(parsedQuery, instanceOf(ConstantScoreQuery.class));
|
||||
ConstantScoreQuery constantScoreQuery = (ConstantScoreQuery) parsedQuery;
|
||||
GeoDistanceRangeQuery filter = (GeoDistanceRangeQuery) constantScoreQuery.getQuery();
|
||||
assertThat(parsedQuery, instanceOf(BooleanQuery.class));
|
||||
BooleanQuery booleanQuery = (BooleanQuery) parsedQuery;
|
||||
assertThat(booleanQuery.clauses().size(), equalTo(2));
|
||||
BooleanClause booleanClause = booleanQuery.clauses().get(0);
|
||||
assertThat(booleanClause.getOccur(), equalTo(Occur.MUST));
|
||||
assertThat(booleanClause.getQuery(), instanceOf(MatchAllDocsQuery.class));
|
||||
booleanClause = booleanQuery.clauses().get(1);
|
||||
assertThat(booleanClause.getOccur(), equalTo(Occur.FILTER));
|
||||
assertThat(booleanClause.getQuery(), instanceOf(GeoDistanceRangeQuery.class));
|
||||
GeoDistanceRangeQuery filter = (GeoDistanceRangeQuery) booleanClause.getQuery();
|
||||
assertThat(filter.fieldName(), equalTo("location"));
|
||||
assertThat(filter.lat(), closeTo(40, 0.00001));
|
||||
assertThat(filter.lon(), closeTo(-70, 0.00001));
|
||||
|
@ -1917,9 +1985,16 @@ public class SimpleIndexQueryParserTests extends ESSingleNodeTestCase {
|
|||
IndexQueryParserService queryParser = queryParser();
|
||||
String query = copyToStringFromClasspath("/org/elasticsearch/index/query/geo_distance9.json");
|
||||
Query parsedQuery = queryParser.parse(query).query();
|
||||
assertThat(parsedQuery, instanceOf(ConstantScoreQuery.class));
|
||||
ConstantScoreQuery constantScoreQuery = (ConstantScoreQuery) parsedQuery;
|
||||
GeoDistanceRangeQuery filter = (GeoDistanceRangeQuery) constantScoreQuery.getQuery();
|
||||
assertThat(parsedQuery, instanceOf(BooleanQuery.class));
|
||||
BooleanQuery booleanQuery = (BooleanQuery) parsedQuery;
|
||||
assertThat(booleanQuery.clauses().size(), equalTo(2));
|
||||
BooleanClause booleanClause = booleanQuery.clauses().get(0);
|
||||
assertThat(booleanClause.getOccur(), equalTo(Occur.MUST));
|
||||
assertThat(booleanClause.getQuery(), instanceOf(MatchAllDocsQuery.class));
|
||||
booleanClause = booleanQuery.clauses().get(1);
|
||||
assertThat(booleanClause.getOccur(), equalTo(Occur.FILTER));
|
||||
assertThat(booleanClause.getQuery(), instanceOf(GeoDistanceRangeQuery.class));
|
||||
GeoDistanceRangeQuery filter = (GeoDistanceRangeQuery) booleanClause.getQuery();
|
||||
assertThat(filter.fieldName(), equalTo("location"));
|
||||
assertThat(filter.lat(), closeTo(40, 0.00001));
|
||||
assertThat(filter.lon(), closeTo(-70, 0.00001));
|
||||
|
@ -1932,9 +2007,16 @@ public class SimpleIndexQueryParserTests extends ESSingleNodeTestCase {
|
|||
IndexQueryParserService queryParser = queryParser();
|
||||
String query = copyToStringFromClasspath("/org/elasticsearch/index/query/geo_distance10.json");
|
||||
Query parsedQuery = queryParser.parse(query).query();
|
||||
assertThat(parsedQuery, instanceOf(ConstantScoreQuery.class));
|
||||
ConstantScoreQuery constantScoreQuery = (ConstantScoreQuery) parsedQuery;
|
||||
GeoDistanceRangeQuery filter = (GeoDistanceRangeQuery) constantScoreQuery.getQuery();
|
||||
assertThat(parsedQuery, instanceOf(BooleanQuery.class));
|
||||
BooleanQuery booleanQuery = (BooleanQuery) parsedQuery;
|
||||
assertThat(booleanQuery.clauses().size(), equalTo(2));
|
||||
BooleanClause booleanClause = booleanQuery.clauses().get(0);
|
||||
assertThat(booleanClause.getOccur(), equalTo(Occur.MUST));
|
||||
assertThat(booleanClause.getQuery(), instanceOf(MatchAllDocsQuery.class));
|
||||
booleanClause = booleanQuery.clauses().get(1);
|
||||
assertThat(booleanClause.getOccur(), equalTo(Occur.FILTER));
|
||||
assertThat(booleanClause.getQuery(), instanceOf(GeoDistanceRangeQuery.class));
|
||||
GeoDistanceRangeQuery filter = (GeoDistanceRangeQuery) booleanClause.getQuery();
|
||||
assertThat(filter.fieldName(), equalTo("location"));
|
||||
assertThat(filter.lat(), closeTo(40, 0.00001));
|
||||
assertThat(filter.lon(), closeTo(-70, 0.00001));
|
||||
|
@ -1947,9 +2029,16 @@ public class SimpleIndexQueryParserTests extends ESSingleNodeTestCase {
|
|||
IndexQueryParserService queryParser = queryParser();
|
||||
String query = copyToStringFromClasspath("/org/elasticsearch/index/query/geo_distance11.json");
|
||||
Query parsedQuery = queryParser.parse(query).query();
|
||||
assertThat(parsedQuery, instanceOf(ConstantScoreQuery.class));
|
||||
ConstantScoreQuery constantScoreQuery = (ConstantScoreQuery) parsedQuery;
|
||||
GeoDistanceRangeQuery filter = (GeoDistanceRangeQuery) constantScoreQuery.getQuery();
|
||||
assertThat(parsedQuery, instanceOf(BooleanQuery.class));
|
||||
BooleanQuery booleanQuery = (BooleanQuery) parsedQuery;
|
||||
assertThat(booleanQuery.clauses().size(), equalTo(2));
|
||||
BooleanClause booleanClause = booleanQuery.clauses().get(0);
|
||||
assertThat(booleanClause.getOccur(), equalTo(Occur.MUST));
|
||||
assertThat(booleanClause.getQuery(), instanceOf(MatchAllDocsQuery.class));
|
||||
booleanClause = booleanQuery.clauses().get(1);
|
||||
assertThat(booleanClause.getOccur(), equalTo(Occur.FILTER));
|
||||
assertThat(booleanClause.getQuery(), instanceOf(GeoDistanceRangeQuery.class));
|
||||
GeoDistanceRangeQuery filter = (GeoDistanceRangeQuery) booleanClause.getQuery();
|
||||
assertThat(filter.fieldName(), equalTo("location"));
|
||||
assertThat(filter.lat(), closeTo(40, 0.00001));
|
||||
assertThat(filter.lon(), closeTo(-70, 0.00001));
|
||||
|
@ -1962,9 +2051,16 @@ public class SimpleIndexQueryParserTests extends ESSingleNodeTestCase {
|
|||
IndexQueryParserService queryParser = queryParser();
|
||||
String query = copyToStringFromClasspath("/org/elasticsearch/index/query/geo_distance12.json");
|
||||
Query parsedQuery = queryParser.parse(query).query();
|
||||
assertThat(parsedQuery, instanceOf(ConstantScoreQuery.class));
|
||||
ConstantScoreQuery constantScoreQuery = (ConstantScoreQuery) parsedQuery;
|
||||
GeoDistanceRangeQuery filter = (GeoDistanceRangeQuery) constantScoreQuery.getQuery();
|
||||
assertThat(parsedQuery, instanceOf(BooleanQuery.class));
|
||||
BooleanQuery booleanQuery = (BooleanQuery) parsedQuery;
|
||||
assertThat(booleanQuery.clauses().size(), equalTo(2));
|
||||
BooleanClause booleanClause = booleanQuery.clauses().get(0);
|
||||
assertThat(booleanClause.getOccur(), equalTo(Occur.MUST));
|
||||
assertThat(booleanClause.getQuery(), instanceOf(MatchAllDocsQuery.class));
|
||||
booleanClause = booleanQuery.clauses().get(1);
|
||||
assertThat(booleanClause.getOccur(), equalTo(Occur.FILTER));
|
||||
assertThat(booleanClause.getQuery(), instanceOf(GeoDistanceRangeQuery.class));
|
||||
GeoDistanceRangeQuery filter = (GeoDistanceRangeQuery) booleanClause.getQuery();
|
||||
assertThat(filter.fieldName(), equalTo("location"));
|
||||
assertThat(filter.lat(), closeTo(40, 0.00001));
|
||||
assertThat(filter.lon(), closeTo(-70, 0.00001));
|
||||
|
@ -1977,10 +2073,17 @@ public class SimpleIndexQueryParserTests extends ESSingleNodeTestCase {
|
|||
IndexQueryParserService queryParser = queryParser();
|
||||
String query = copyToStringFromClasspath("/org/elasticsearch/index/query/geo_boundingbox-named.json");
|
||||
ParsedQuery parsedQuery = queryParser.parse(query);
|
||||
assertThat(parsedQuery.query(), instanceOf(ConstantScoreQuery.class));
|
||||
assertThat(parsedQuery.namedFilters().containsKey("test"), equalTo(true));
|
||||
ConstantScoreQuery constantScoreQuery = (ConstantScoreQuery) parsedQuery.query();
|
||||
InMemoryGeoBoundingBoxQuery filter = (InMemoryGeoBoundingBoxQuery) constantScoreQuery.getQuery();
|
||||
assertThat(parsedQuery.query(), instanceOf(BooleanQuery.class));
|
||||
BooleanQuery booleanQuery = (BooleanQuery) parsedQuery.query();
|
||||
assertThat(booleanQuery.clauses().size(), equalTo(2));
|
||||
BooleanClause booleanClause = booleanQuery.clauses().get(0);
|
||||
assertThat(booleanClause.getOccur(), equalTo(Occur.MUST));
|
||||
assertThat(booleanClause.getQuery(), instanceOf(MatchAllDocsQuery.class));
|
||||
booleanClause = booleanQuery.clauses().get(1);
|
||||
assertThat(booleanClause.getOccur(), equalTo(Occur.FILTER));
|
||||
assertThat(booleanClause.getQuery(), instanceOf(InMemoryGeoBoundingBoxQuery.class));
|
||||
InMemoryGeoBoundingBoxQuery filter = (InMemoryGeoBoundingBoxQuery) booleanClause.getQuery();
|
||||
assertThat(filter.fieldName(), equalTo("location"));
|
||||
assertThat(filter.topLeft().lat(), closeTo(40, 0.00001));
|
||||
assertThat(filter.topLeft().lon(), closeTo(-70, 0.00001));
|
||||
|
@ -1993,9 +2096,16 @@ public class SimpleIndexQueryParserTests extends ESSingleNodeTestCase {
|
|||
IndexQueryParserService queryParser = queryParser();
|
||||
String query = copyToStringFromClasspath("/org/elasticsearch/index/query/geo_boundingbox1.json");
|
||||
Query parsedQuery = queryParser.parse(query).query();
|
||||
assertThat(parsedQuery, instanceOf(ConstantScoreQuery.class));
|
||||
ConstantScoreQuery constantScoreQuery = (ConstantScoreQuery) parsedQuery;
|
||||
InMemoryGeoBoundingBoxQuery filter = (InMemoryGeoBoundingBoxQuery) constantScoreQuery.getQuery();
|
||||
assertThat(parsedQuery, instanceOf(BooleanQuery.class));
|
||||
BooleanQuery booleanQuery = (BooleanQuery) parsedQuery;
|
||||
assertThat(booleanQuery.clauses().size(), equalTo(2));
|
||||
BooleanClause booleanClause = booleanQuery.clauses().get(0);
|
||||
assertThat(booleanClause.getOccur(), equalTo(Occur.MUST));
|
||||
assertThat(booleanClause.getQuery(), instanceOf(MatchAllDocsQuery.class));
|
||||
booleanClause = booleanQuery.clauses().get(1);
|
||||
assertThat(booleanClause.getOccur(), equalTo(Occur.FILTER));
|
||||
assertThat(booleanClause.getQuery(), instanceOf(InMemoryGeoBoundingBoxQuery.class));
|
||||
InMemoryGeoBoundingBoxQuery filter = (InMemoryGeoBoundingBoxQuery) booleanClause.getQuery();
|
||||
assertThat(filter.fieldName(), equalTo("location"));
|
||||
assertThat(filter.topLeft().lat(), closeTo(40, 0.00001));
|
||||
assertThat(filter.topLeft().lon(), closeTo(-70, 0.00001));
|
||||
|
@ -2008,9 +2118,16 @@ public class SimpleIndexQueryParserTests extends ESSingleNodeTestCase {
|
|||
IndexQueryParserService queryParser = queryParser();
|
||||
String query = copyToStringFromClasspath("/org/elasticsearch/index/query/geo_boundingbox2.json");
|
||||
Query parsedQuery = queryParser.parse(query).query();
|
||||
assertThat(parsedQuery, instanceOf(ConstantScoreQuery.class));
|
||||
ConstantScoreQuery constantScoreQuery = (ConstantScoreQuery) parsedQuery;
|
||||
InMemoryGeoBoundingBoxQuery filter = (InMemoryGeoBoundingBoxQuery) constantScoreQuery.getQuery();
|
||||
assertThat(parsedQuery, instanceOf(BooleanQuery.class));
|
||||
BooleanQuery booleanQuery = (BooleanQuery) parsedQuery;
|
||||
assertThat(booleanQuery.clauses().size(), equalTo(2));
|
||||
BooleanClause booleanClause = booleanQuery.clauses().get(0);
|
||||
assertThat(booleanClause.getOccur(), equalTo(Occur.MUST));
|
||||
assertThat(booleanClause.getQuery(), instanceOf(MatchAllDocsQuery.class));
|
||||
booleanClause = booleanQuery.clauses().get(1);
|
||||
assertThat(booleanClause.getOccur(), equalTo(Occur.FILTER));
|
||||
assertThat(booleanClause.getQuery(), instanceOf(InMemoryGeoBoundingBoxQuery.class));
|
||||
InMemoryGeoBoundingBoxQuery filter = (InMemoryGeoBoundingBoxQuery) booleanClause.getQuery();
|
||||
assertThat(filter.fieldName(), equalTo("location"));
|
||||
assertThat(filter.topLeft().lat(), closeTo(40, 0.00001));
|
||||
assertThat(filter.topLeft().lon(), closeTo(-70, 0.00001));
|
||||
|
@ -2023,9 +2140,16 @@ public class SimpleIndexQueryParserTests extends ESSingleNodeTestCase {
|
|||
IndexQueryParserService queryParser = queryParser();
|
||||
String query = copyToStringFromClasspath("/org/elasticsearch/index/query/geo_boundingbox3.json");
|
||||
Query parsedQuery = queryParser.parse(query).query();
|
||||
assertThat(parsedQuery, instanceOf(ConstantScoreQuery.class));
|
||||
ConstantScoreQuery constantScoreQuery = (ConstantScoreQuery) parsedQuery;
|
||||
InMemoryGeoBoundingBoxQuery filter = (InMemoryGeoBoundingBoxQuery) constantScoreQuery.getQuery();
|
||||
assertThat(parsedQuery, instanceOf(BooleanQuery.class));
|
||||
BooleanQuery booleanQuery = (BooleanQuery) parsedQuery;
|
||||
assertThat(booleanQuery.clauses().size(), equalTo(2));
|
||||
BooleanClause booleanClause = booleanQuery.clauses().get(0);
|
||||
assertThat(booleanClause.getOccur(), equalTo(Occur.MUST));
|
||||
assertThat(booleanClause.getQuery(), instanceOf(MatchAllDocsQuery.class));
|
||||
booleanClause = booleanQuery.clauses().get(1);
|
||||
assertThat(booleanClause.getOccur(), equalTo(Occur.FILTER));
|
||||
assertThat(booleanClause.getQuery(), instanceOf(InMemoryGeoBoundingBoxQuery.class));
|
||||
InMemoryGeoBoundingBoxQuery filter = (InMemoryGeoBoundingBoxQuery) booleanClause.getQuery();
|
||||
assertThat(filter.fieldName(), equalTo("location"));
|
||||
assertThat(filter.topLeft().lat(), closeTo(40, 0.00001));
|
||||
assertThat(filter.topLeft().lon(), closeTo(-70, 0.00001));
|
||||
|
@ -2038,9 +2162,16 @@ public class SimpleIndexQueryParserTests extends ESSingleNodeTestCase {
|
|||
IndexQueryParserService queryParser = queryParser();
|
||||
String query = copyToStringFromClasspath("/org/elasticsearch/index/query/geo_boundingbox4.json");
|
||||
Query parsedQuery = queryParser.parse(query).query();
|
||||
assertThat(parsedQuery, instanceOf(ConstantScoreQuery.class));
|
||||
ConstantScoreQuery constantScoreQuery = (ConstantScoreQuery) parsedQuery;
|
||||
InMemoryGeoBoundingBoxQuery filter = (InMemoryGeoBoundingBoxQuery) constantScoreQuery.getQuery();
|
||||
assertThat(parsedQuery, instanceOf(BooleanQuery.class));
|
||||
BooleanQuery booleanQuery = (BooleanQuery) parsedQuery;
|
||||
assertThat(booleanQuery.clauses().size(), equalTo(2));
|
||||
BooleanClause booleanClause = booleanQuery.clauses().get(0);
|
||||
assertThat(booleanClause.getOccur(), equalTo(Occur.MUST));
|
||||
assertThat(booleanClause.getQuery(), instanceOf(MatchAllDocsQuery.class));
|
||||
booleanClause = booleanQuery.clauses().get(1);
|
||||
assertThat(booleanClause.getOccur(), equalTo(Occur.FILTER));
|
||||
assertThat(booleanClause.getQuery(), instanceOf(InMemoryGeoBoundingBoxQuery.class));
|
||||
InMemoryGeoBoundingBoxQuery filter = (InMemoryGeoBoundingBoxQuery) booleanClause.getQuery();
|
||||
assertThat(filter.fieldName(), equalTo("location"));
|
||||
assertThat(filter.topLeft().lat(), closeTo(40, 0.00001));
|
||||
assertThat(filter.topLeft().lon(), closeTo(-70, 0.00001));
|
||||
|
@ -2053,9 +2184,16 @@ public class SimpleIndexQueryParserTests extends ESSingleNodeTestCase {
|
|||
IndexQueryParserService queryParser = queryParser();
|
||||
String query = copyToStringFromClasspath("/org/elasticsearch/index/query/geo_boundingbox5.json");
|
||||
Query parsedQuery = queryParser.parse(query).query();
|
||||
assertThat(parsedQuery, instanceOf(ConstantScoreQuery.class));
|
||||
ConstantScoreQuery constantScoreQuery = (ConstantScoreQuery) parsedQuery;
|
||||
InMemoryGeoBoundingBoxQuery filter = (InMemoryGeoBoundingBoxQuery) constantScoreQuery.getQuery();
|
||||
assertThat(parsedQuery, instanceOf(BooleanQuery.class));
|
||||
BooleanQuery booleanQuery = (BooleanQuery) parsedQuery;
|
||||
assertThat(booleanQuery.clauses().size(), equalTo(2));
|
||||
BooleanClause booleanClause = booleanQuery.clauses().get(0);
|
||||
assertThat(booleanClause.getOccur(), equalTo(Occur.MUST));
|
||||
assertThat(booleanClause.getQuery(), instanceOf(MatchAllDocsQuery.class));
|
||||
booleanClause = booleanQuery.clauses().get(1);
|
||||
assertThat(booleanClause.getOccur(), equalTo(Occur.FILTER));
|
||||
assertThat(booleanClause.getQuery(), instanceOf(InMemoryGeoBoundingBoxQuery.class));
|
||||
InMemoryGeoBoundingBoxQuery filter = (InMemoryGeoBoundingBoxQuery) booleanClause.getQuery();
|
||||
assertThat(filter.fieldName(), equalTo("location"));
|
||||
assertThat(filter.topLeft().lat(), closeTo(40, 0.00001));
|
||||
assertThat(filter.topLeft().lon(), closeTo(-70, 0.00001));
|
||||
|
@ -2068,9 +2206,16 @@ public class SimpleIndexQueryParserTests extends ESSingleNodeTestCase {
|
|||
IndexQueryParserService queryParser = queryParser();
|
||||
String query = copyToStringFromClasspath("/org/elasticsearch/index/query/geo_boundingbox6.json");
|
||||
Query parsedQuery = queryParser.parse(query).query();
|
||||
assertThat(parsedQuery, instanceOf(ConstantScoreQuery.class));
|
||||
ConstantScoreQuery constantScoreQuery = (ConstantScoreQuery) parsedQuery;
|
||||
InMemoryGeoBoundingBoxQuery filter = (InMemoryGeoBoundingBoxQuery) constantScoreQuery.getQuery();
|
||||
assertThat(parsedQuery, instanceOf(BooleanQuery.class));
|
||||
BooleanQuery booleanQuery = (BooleanQuery) parsedQuery;
|
||||
assertThat(booleanQuery.clauses().size(), equalTo(2));
|
||||
BooleanClause booleanClause = booleanQuery.clauses().get(0);
|
||||
assertThat(booleanClause.getOccur(), equalTo(Occur.MUST));
|
||||
assertThat(booleanClause.getQuery(), instanceOf(MatchAllDocsQuery.class));
|
||||
booleanClause = booleanQuery.clauses().get(1);
|
||||
assertThat(booleanClause.getOccur(), equalTo(Occur.FILTER));
|
||||
assertThat(booleanClause.getQuery(), instanceOf(InMemoryGeoBoundingBoxQuery.class));
|
||||
InMemoryGeoBoundingBoxQuery filter = (InMemoryGeoBoundingBoxQuery) booleanClause.getQuery();
|
||||
assertThat(filter.fieldName(), equalTo("location"));
|
||||
assertThat(filter.topLeft().lat(), closeTo(40, 0.00001));
|
||||
assertThat(filter.topLeft().lon(), closeTo(-70, 0.00001));
|
||||
|
@ -2085,9 +2230,16 @@ public class SimpleIndexQueryParserTests extends ESSingleNodeTestCase {
|
|||
String query = copyToStringFromClasspath("/org/elasticsearch/index/query/geo_polygon-named.json");
|
||||
ParsedQuery parsedQuery = queryParser.parse(query);
|
||||
assertThat(parsedQuery.namedFilters().containsKey("test"), equalTo(true));
|
||||
assertThat(parsedQuery.query(), instanceOf(ConstantScoreQuery.class));
|
||||
ConstantScoreQuery constantScoreQuery = (ConstantScoreQuery) parsedQuery.query();
|
||||
GeoPolygonQuery filter = (GeoPolygonQuery) constantScoreQuery.getQuery();
|
||||
assertThat(parsedQuery.query(), instanceOf(BooleanQuery.class));
|
||||
BooleanQuery booleanQuery = (BooleanQuery) parsedQuery.query();
|
||||
assertThat(booleanQuery.clauses().size(), equalTo(2));
|
||||
BooleanClause booleanClause = booleanQuery.clauses().get(0);
|
||||
assertThat(booleanClause.getOccur(), equalTo(Occur.MUST));
|
||||
assertThat(booleanClause.getQuery(), instanceOf(MatchAllDocsQuery.class));
|
||||
booleanClause = booleanQuery.clauses().get(1);
|
||||
assertThat(booleanClause.getOccur(), equalTo(Occur.FILTER));
|
||||
assertThat(booleanClause.getQuery(), instanceOf(GeoPolygonQuery.class));
|
||||
GeoPolygonQuery filter = (GeoPolygonQuery) booleanClause.getQuery();
|
||||
assertThat(filter.fieldName(), equalTo("location"));
|
||||
assertThat(filter.points().length, equalTo(4));
|
||||
assertThat(filter.points()[0].lat(), closeTo(40, 0.00001));
|
||||
|
@ -2126,9 +2278,16 @@ public class SimpleIndexQueryParserTests extends ESSingleNodeTestCase {
|
|||
IndexQueryParserService queryParser = queryParser();
|
||||
String query = copyToStringFromClasspath("/org/elasticsearch/index/query/geo_polygon1.json");
|
||||
Query parsedQuery = queryParser.parse(query).query();
|
||||
assertThat(parsedQuery, instanceOf(ConstantScoreQuery.class));
|
||||
ConstantScoreQuery constantScoreQuery = (ConstantScoreQuery) parsedQuery;
|
||||
GeoPolygonQuery filter = (GeoPolygonQuery) constantScoreQuery.getQuery();
|
||||
assertThat(parsedQuery, instanceOf(BooleanQuery.class));
|
||||
BooleanQuery booleanQuery = (BooleanQuery) parsedQuery;
|
||||
assertThat(booleanQuery.clauses().size(), equalTo(2));
|
||||
BooleanClause booleanClause = booleanQuery.clauses().get(0);
|
||||
assertThat(booleanClause.getOccur(), equalTo(Occur.MUST));
|
||||
assertThat(booleanClause.getQuery(), instanceOf(MatchAllDocsQuery.class));
|
||||
booleanClause = booleanQuery.clauses().get(1);
|
||||
assertThat(booleanClause.getOccur(), equalTo(Occur.FILTER));
|
||||
assertThat(booleanClause.getQuery(), instanceOf(GeoPolygonQuery.class));
|
||||
GeoPolygonQuery filter = (GeoPolygonQuery) booleanClause.getQuery();
|
||||
assertThat(filter.fieldName(), equalTo("location"));
|
||||
assertThat(filter.points().length, equalTo(4));
|
||||
assertThat(filter.points()[0].lat(), closeTo(40, 0.00001));
|
||||
|
@ -2144,9 +2303,16 @@ public class SimpleIndexQueryParserTests extends ESSingleNodeTestCase {
|
|||
IndexQueryParserService queryParser = queryParser();
|
||||
String query = copyToStringFromClasspath("/org/elasticsearch/index/query/geo_polygon2.json");
|
||||
Query parsedQuery = queryParser.parse(query).query();
|
||||
assertThat(parsedQuery, instanceOf(ConstantScoreQuery.class));
|
||||
ConstantScoreQuery constantScoreQuery = (ConstantScoreQuery) parsedQuery;
|
||||
GeoPolygonQuery filter = (GeoPolygonQuery) constantScoreQuery.getQuery();
|
||||
assertThat(parsedQuery, instanceOf(BooleanQuery.class));
|
||||
BooleanQuery booleanQuery = (BooleanQuery) parsedQuery;
|
||||
assertThat(booleanQuery.clauses().size(), equalTo(2));
|
||||
BooleanClause booleanClause = booleanQuery.clauses().get(0);
|
||||
assertThat(booleanClause.getOccur(), equalTo(Occur.MUST));
|
||||
assertThat(booleanClause.getQuery(), instanceOf(MatchAllDocsQuery.class));
|
||||
booleanClause = booleanQuery.clauses().get(1);
|
||||
assertThat(booleanClause.getOccur(), equalTo(Occur.FILTER));
|
||||
assertThat(booleanClause.getQuery(), instanceOf(GeoPolygonQuery.class));
|
||||
GeoPolygonQuery filter = (GeoPolygonQuery) booleanClause.getQuery();
|
||||
assertThat(filter.fieldName(), equalTo("location"));
|
||||
assertThat(filter.points().length, equalTo(4));
|
||||
assertThat(filter.points()[0].lat(), closeTo(40, 0.00001));
|
||||
|
@ -2162,9 +2328,16 @@ public class SimpleIndexQueryParserTests extends ESSingleNodeTestCase {
|
|||
IndexQueryParserService queryParser = queryParser();
|
||||
String query = copyToStringFromClasspath("/org/elasticsearch/index/query/geo_polygon3.json");
|
||||
Query parsedQuery = queryParser.parse(query).query();
|
||||
assertThat(parsedQuery, instanceOf(ConstantScoreQuery.class));
|
||||
ConstantScoreQuery constantScoreQuery = (ConstantScoreQuery) parsedQuery;
|
||||
GeoPolygonQuery filter = (GeoPolygonQuery) constantScoreQuery.getQuery();
|
||||
assertThat(parsedQuery, instanceOf(BooleanQuery.class));
|
||||
BooleanQuery booleanQuery = (BooleanQuery) parsedQuery;
|
||||
assertThat(booleanQuery.clauses().size(), equalTo(2));
|
||||
BooleanClause booleanClause = booleanQuery.clauses().get(0);
|
||||
assertThat(booleanClause.getOccur(), equalTo(Occur.MUST));
|
||||
assertThat(booleanClause.getQuery(), instanceOf(MatchAllDocsQuery.class));
|
||||
booleanClause = booleanQuery.clauses().get(1);
|
||||
assertThat(booleanClause.getOccur(), equalTo(Occur.FILTER));
|
||||
assertThat(booleanClause.getQuery(), instanceOf(GeoPolygonQuery.class));
|
||||
GeoPolygonQuery filter = (GeoPolygonQuery) booleanClause.getQuery();
|
||||
assertThat(filter.fieldName(), equalTo("location"));
|
||||
assertThat(filter.points().length, equalTo(4));
|
||||
assertThat(filter.points()[0].lat(), closeTo(40, 0.00001));
|
||||
|
@ -2180,9 +2353,16 @@ public class SimpleIndexQueryParserTests extends ESSingleNodeTestCase {
|
|||
IndexQueryParserService queryParser = queryParser();
|
||||
String query = copyToStringFromClasspath("/org/elasticsearch/index/query/geo_polygon4.json");
|
||||
Query parsedQuery = queryParser.parse(query).query();
|
||||
assertThat(parsedQuery, instanceOf(ConstantScoreQuery.class));
|
||||
ConstantScoreQuery constantScoreQuery = (ConstantScoreQuery) parsedQuery;
|
||||
GeoPolygonQuery filter = (GeoPolygonQuery) constantScoreQuery.getQuery();
|
||||
assertThat(parsedQuery, instanceOf(BooleanQuery.class));
|
||||
BooleanQuery booleanQuery = (BooleanQuery) parsedQuery;
|
||||
assertThat(booleanQuery.clauses().size(), equalTo(2));
|
||||
BooleanClause booleanClause = booleanQuery.clauses().get(0);
|
||||
assertThat(booleanClause.getOccur(), equalTo(Occur.MUST));
|
||||
assertThat(booleanClause.getQuery(), instanceOf(MatchAllDocsQuery.class));
|
||||
booleanClause = booleanQuery.clauses().get(1);
|
||||
assertThat(booleanClause.getOccur(), equalTo(Occur.FILTER));
|
||||
assertThat(booleanClause.getQuery(), instanceOf(GeoPolygonQuery.class));
|
||||
GeoPolygonQuery filter = (GeoPolygonQuery) booleanClause.getQuery();
|
||||
assertThat(filter.fieldName(), equalTo("location"));
|
||||
assertThat(filter.points().length, equalTo(4));
|
||||
assertThat(filter.points()[0].lat(), closeTo(40, 0.00001));
|
||||
|
@ -2198,11 +2378,16 @@ public class SimpleIndexQueryParserTests extends ESSingleNodeTestCase {
|
|||
IndexQueryParserService queryParser = queryParser();
|
||||
String query = copyToStringFromClasspath("/org/elasticsearch/index/query/geoShape-filter.json");
|
||||
Query parsedQuery = queryParser.parse(query).query();
|
||||
assertThat(parsedQuery, instanceOf(ConstantScoreQuery.class));
|
||||
while (parsedQuery instanceof ConstantScoreQuery) {
|
||||
parsedQuery = ((ConstantScoreQuery) parsedQuery).getQuery();
|
||||
}
|
||||
assertThat(parsedQuery, instanceOf(IntersectsPrefixTreeFilter.class));
|
||||
BooleanQuery booleanQuery = (BooleanQuery) parsedQuery;
|
||||
assertThat(booleanQuery.clauses().size(), equalTo(2));
|
||||
BooleanClause booleanClause = booleanQuery.clauses().get(0);
|
||||
assertThat(booleanClause.getOccur(), equalTo(Occur.MUST));
|
||||
assertThat(booleanClause.getQuery(), instanceOf(MatchAllDocsQuery.class));
|
||||
booleanClause = booleanQuery.clauses().get(1);
|
||||
assertThat(booleanClause.getOccur(), equalTo(Occur.FILTER));
|
||||
assertThat(booleanClause.getQuery(), instanceOf(ConstantScoreQuery.class));
|
||||
ConstantScoreQuery constantScoreQuery = (ConstantScoreQuery) booleanClause.getQuery();
|
||||
assertThat(constantScoreQuery.getQuery(), instanceOf(IntersectsPrefixTreeFilter.class));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -2464,9 +2649,17 @@ public class SimpleIndexQueryParserTests extends ESSingleNodeTestCase {
|
|||
SearchContext.setCurrent(createSearchContext(indexService));
|
||||
IndexQueryParserService queryParser = indexService.queryParserService();
|
||||
Query parsedQuery = queryParser.parse(query).query();
|
||||
assertThat(parsedQuery, instanceOf(ConstantScoreQuery.class));
|
||||
assertThat(((ConstantScoreQuery) parsedQuery).getQuery(), instanceOf(ToParentBlockJoinQuery.class));
|
||||
assertThat(((ConstantScoreQuery) parsedQuery).getQuery().toString(), equalTo("ToParentBlockJoinQuery (+*:* #QueryWrapperFilter(_type:__nested))"));
|
||||
assertThat(parsedQuery, instanceOf(BooleanQuery.class));
|
||||
BooleanQuery booleanQuery = (BooleanQuery) parsedQuery;
|
||||
assertThat(booleanQuery.clauses().size(), equalTo(2));
|
||||
BooleanClause booleanClause = booleanQuery.clauses().get(0);
|
||||
assertThat(booleanClause.getOccur(), equalTo(Occur.MUST));
|
||||
assertThat(booleanClause.getQuery(), instanceOf(MatchAllDocsQuery.class));
|
||||
booleanClause = booleanQuery.clauses().get(1);
|
||||
assertThat(booleanClause.getOccur(), equalTo(Occur.FILTER));
|
||||
assertThat(booleanClause.getQuery(), instanceOf(ToParentBlockJoinQuery.class));
|
||||
ToParentBlockJoinQuery toParentBlockJoinQuery = (ToParentBlockJoinQuery) booleanClause.getQuery();
|
||||
assertThat(toParentBlockJoinQuery.toString(), equalTo("ToParentBlockJoinQuery (+*:* #QueryWrapperFilter(_type:__nested))"));
|
||||
SearchContext.removeCurrent();
|
||||
}
|
||||
|
||||
|
|
|
@ -85,7 +85,7 @@ public class ExpressionScriptIT extends ESIntegTestCase {
|
|||
client().prepareIndex("test", "doc", "1").setSource("foo", 4).setRefresh(true).get();
|
||||
SearchResponse rsp = buildRequest("doc['foo'] + 1").get();
|
||||
assertEquals(1, rsp.getHits().getTotalHits());
|
||||
assertEquals(5.0, rsp.getHits().getAt(0).field("foo").getValue());
|
||||
assertEquals(5.0, rsp.getHits().getAt(0).field("foo").getValue(), 0.0D);
|
||||
}
|
||||
|
||||
public void testBasicUsingDotValue() throws Exception {
|
||||
|
@ -94,7 +94,7 @@ public class ExpressionScriptIT extends ESIntegTestCase {
|
|||
client().prepareIndex("test", "doc", "1").setSource("foo", 4).setRefresh(true).get();
|
||||
SearchResponse rsp = buildRequest("doc['foo'].value + 1").get();
|
||||
assertEquals(1, rsp.getHits().getTotalHits());
|
||||
assertEquals(5.0, rsp.getHits().getAt(0).field("foo").getValue());
|
||||
assertEquals(5.0, rsp.getHits().getAt(0).field("foo").getValue(), 0.0D);
|
||||
}
|
||||
|
||||
public void testScore() throws Exception {
|
||||
|
@ -126,23 +126,23 @@ public class ExpressionScriptIT extends ESIntegTestCase {
|
|||
SearchResponse rsp = buildRequest("doc['date0'].getSeconds() - doc['date0'].getMinutes()").get();
|
||||
assertEquals(2, rsp.getHits().getTotalHits());
|
||||
SearchHits hits = rsp.getHits();
|
||||
assertEquals(5.0, hits.getAt(0).field("foo").getValue());
|
||||
assertEquals(-11.0, hits.getAt(1).field("foo").getValue());
|
||||
assertEquals(5.0, hits.getAt(0).field("foo").getValue(), 0.0D);
|
||||
assertEquals(-11.0, hits.getAt(1).field("foo").getValue(), 0.0D);
|
||||
rsp = buildRequest("doc['date0'].getHourOfDay() + doc['date1'].getDayOfMonth()").get();
|
||||
assertEquals(2, rsp.getHits().getTotalHits());
|
||||
hits = rsp.getHits();
|
||||
assertEquals(5.0, hits.getAt(0).field("foo").getValue());
|
||||
assertEquals(24.0, hits.getAt(1).field("foo").getValue());
|
||||
assertEquals(5.0, hits.getAt(0).field("foo").getValue(), 0.0D);
|
||||
assertEquals(24.0, hits.getAt(1).field("foo").getValue(), 0.0D);
|
||||
rsp = buildRequest("doc['date1'].getMonth() + 1").get();
|
||||
assertEquals(2, rsp.getHits().getTotalHits());
|
||||
hits = rsp.getHits();
|
||||
assertEquals(9.0, hits.getAt(0).field("foo").getValue());
|
||||
assertEquals(10.0, hits.getAt(1).field("foo").getValue());
|
||||
assertEquals(9.0, hits.getAt(0).field("foo").getValue(), 0.0D);
|
||||
assertEquals(10.0, hits.getAt(1).field("foo").getValue(), 0.0D);
|
||||
rsp = buildRequest("doc['date1'].getYear()").get();
|
||||
assertEquals(2, rsp.getHits().getTotalHits());
|
||||
hits = rsp.getHits();
|
||||
assertEquals(1985.0, hits.getAt(0).field("foo").getValue());
|
||||
assertEquals(1983.0, hits.getAt(1).field("foo").getValue());
|
||||
assertEquals(1985.0, hits.getAt(0).field("foo").getValue(), 0.0D);
|
||||
assertEquals(1983.0, hits.getAt(1).field("foo").getValue(), 0.0D);
|
||||
}
|
||||
|
||||
public void testMultiValueMethods() throws Exception {
|
||||
|
@ -158,57 +158,57 @@ public class ExpressionScriptIT extends ESIntegTestCase {
|
|||
assertSearchResponse(rsp);
|
||||
SearchHits hits = rsp.getHits();
|
||||
assertEquals(3, hits.getTotalHits());
|
||||
assertEquals(5.0, hits.getAt(0).field("foo").getValue());
|
||||
assertEquals(2.0, hits.getAt(1).field("foo").getValue());
|
||||
assertEquals(5.0, hits.getAt(2).field("foo").getValue());
|
||||
assertEquals(5.0, hits.getAt(0).field("foo").getValue(), 0.0D);
|
||||
assertEquals(2.0, hits.getAt(1).field("foo").getValue(), 0.0D);
|
||||
assertEquals(5.0, hits.getAt(2).field("foo").getValue(), 0.0D);
|
||||
|
||||
rsp = buildRequest("doc['double0'].sum()").get();
|
||||
assertSearchResponse(rsp);
|
||||
hits = rsp.getHits();
|
||||
assertEquals(3, hits.getTotalHits());
|
||||
assertEquals(7.5, hits.getAt(0).field("foo").getValue());
|
||||
assertEquals(5.0, hits.getAt(1).field("foo").getValue());
|
||||
assertEquals(6.0, hits.getAt(2).field("foo").getValue());
|
||||
assertEquals(7.5, hits.getAt(0).field("foo").getValue(), 0.0D);
|
||||
assertEquals(5.0, hits.getAt(1).field("foo").getValue(), 0.0D);
|
||||
assertEquals(6.0, hits.getAt(2).field("foo").getValue(), 0.0D);
|
||||
|
||||
rsp = buildRequest("doc['double0'].avg() + doc['double1'].avg()").get();
|
||||
assertSearchResponse(rsp);
|
||||
hits = rsp.getHits();
|
||||
assertEquals(3, hits.getTotalHits());
|
||||
assertEquals(4.3, hits.getAt(0).field("foo").getValue());
|
||||
assertEquals(8.0, hits.getAt(1).field("foo").getValue());
|
||||
assertEquals(5.5, hits.getAt(2).field("foo").getValue());
|
||||
assertEquals(4.3, hits.getAt(0).field("foo").getValue(), 0.0D);
|
||||
assertEquals(8.0, hits.getAt(1).field("foo").getValue(), 0.0D);
|
||||
assertEquals(5.5, hits.getAt(2).field("foo").getValue(), 0.0D);
|
||||
|
||||
rsp = buildRequest("doc['double0'].median()").get();
|
||||
assertSearchResponse(rsp);
|
||||
hits = rsp.getHits();
|
||||
assertEquals(3, hits.getTotalHits());
|
||||
assertEquals(1.5, hits.getAt(0).field("foo").getValue());
|
||||
assertEquals(5.0, hits.getAt(1).field("foo").getValue());
|
||||
assertEquals(1.25, hits.getAt(2).field("foo").getValue());
|
||||
assertEquals(1.5, hits.getAt(0).field("foo").getValue(), 0.0D);
|
||||
assertEquals(5.0, hits.getAt(1).field("foo").getValue(), 0.0D);
|
||||
assertEquals(1.25, hits.getAt(2).field("foo").getValue(), 0.0D);
|
||||
|
||||
rsp = buildRequest("doc['double0'].min()").get();
|
||||
assertSearchResponse(rsp);
|
||||
hits = rsp.getHits();
|
||||
assertEquals(3, hits.getTotalHits());
|
||||
assertEquals(1.0, hits.getAt(0).field("foo").getValue());
|
||||
assertEquals(5.0, hits.getAt(1).field("foo").getValue());
|
||||
assertEquals(-1.5, hits.getAt(2).field("foo").getValue());
|
||||
assertEquals(1.0, hits.getAt(0).field("foo").getValue(), 0.0D);
|
||||
assertEquals(5.0, hits.getAt(1).field("foo").getValue(), 0.0D);
|
||||
assertEquals(-1.5, hits.getAt(2).field("foo").getValue(), 0.0D);
|
||||
|
||||
rsp = buildRequest("doc['double0'].max()").get();
|
||||
assertSearchResponse(rsp);
|
||||
hits = rsp.getHits();
|
||||
assertEquals(3, hits.getTotalHits());
|
||||
assertEquals(5.0, hits.getAt(0).field("foo").getValue());
|
||||
assertEquals(5.0, hits.getAt(1).field("foo").getValue());
|
||||
assertEquals(5.0, hits.getAt(2).field("foo").getValue());
|
||||
assertEquals(5.0, hits.getAt(0).field("foo").getValue(), 0.0D);
|
||||
assertEquals(5.0, hits.getAt(1).field("foo").getValue(), 0.0D);
|
||||
assertEquals(5.0, hits.getAt(2).field("foo").getValue(), 0.0D);
|
||||
|
||||
rsp = buildRequest("doc['double0'].sum()/doc['double0'].count()").get();
|
||||
assertSearchResponse(rsp);
|
||||
hits = rsp.getHits();
|
||||
assertEquals(3, hits.getTotalHits());
|
||||
assertEquals(2.5, hits.getAt(0).field("foo").getValue());
|
||||
assertEquals(5.0, hits.getAt(1).field("foo").getValue());
|
||||
assertEquals(1.5, hits.getAt(2).field("foo").getValue());
|
||||
assertEquals(2.5, hits.getAt(0).field("foo").getValue(), 0.0D);
|
||||
assertEquals(5.0, hits.getAt(1).field("foo").getValue(), 0.0D);
|
||||
assertEquals(1.5, hits.getAt(2).field("foo").getValue(), 0.0D);
|
||||
}
|
||||
|
||||
public void testInvalidDateMethodCall() throws Exception {
|
||||
|
@ -236,8 +236,8 @@ public class ExpressionScriptIT extends ESIntegTestCase {
|
|||
ElasticsearchAssertions.assertSearchResponse(rsp);
|
||||
SearchHits hits = rsp.getHits();
|
||||
assertEquals(2, rsp.getHits().getTotalHits());
|
||||
assertEquals(5.0, hits.getAt(0).field("foo").getValue());
|
||||
assertEquals(1.0, hits.getAt(1).field("foo").getValue());
|
||||
assertEquals(5.0, hits.getAt(0).field("foo").getValue(), 0.0D);
|
||||
assertEquals(1.0, hits.getAt(1).field("foo").getValue(), 0.0D);
|
||||
}
|
||||
|
||||
public void testMissingField() throws Exception {
|
||||
|
@ -267,9 +267,9 @@ public class ExpressionScriptIT extends ESIntegTestCase {
|
|||
SearchResponse rsp = buildRequest(script, "a", 2, "b", 3.5, "c", 5000000000L).get();
|
||||
SearchHits hits = rsp.getHits();
|
||||
assertEquals(3, hits.getTotalHits());
|
||||
assertEquals(24.5, hits.getAt(0).field("foo").getValue());
|
||||
assertEquals(9.5, hits.getAt(1).field("foo").getValue());
|
||||
assertEquals(13.5, hits.getAt(2).field("foo").getValue());
|
||||
assertEquals(24.5, hits.getAt(0).field("foo").getValue(), 0.0D);
|
||||
assertEquals(9.5, hits.getAt(1).field("foo").getValue(), 0.0D);
|
||||
assertEquals(13.5, hits.getAt(2).field("foo").getValue(), 0.0D);
|
||||
}
|
||||
|
||||
public void testCompileFailure() {
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
|
||||
package org.elasticsearch.search.innerhits;
|
||||
|
||||
import org.apache.lucene.util.LuceneTestCase;
|
||||
import org.elasticsearch.Version;
|
||||
import org.elasticsearch.action.admin.cluster.health.ClusterHealthStatus;
|
||||
import org.elasticsearch.action.index.IndexRequestBuilder;
|
||||
|
@ -734,7 +733,7 @@ public class InnerHitsIT extends ESIntegTestCase {
|
|||
assertThat(response.getHits().getAt(0).getInnerHits().get("comments").getAt(0).getNestedIdentity().getField().string(), equalTo("comments"));
|
||||
assertThat(response.getHits().getAt(0).getInnerHits().get("comments").getAt(0).getNestedIdentity().getOffset(), equalTo(0));
|
||||
assertThat(response.getHits().getAt(0).getInnerHits().get("comments").getAt(0).getNestedIdentity().getChild(), nullValue());
|
||||
assertThat(String.valueOf(response.getHits().getAt(0).getInnerHits().get("comments").getAt(0).fields().get("comments.message").getValue()), equalTo("fox eat quick"));
|
||||
assertThat(String.valueOf((Object)response.getHits().getAt(0).getInnerHits().get("comments").getAt(0).fields().get("comments.message").getValue()), equalTo("fox eat quick"));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -811,7 +810,7 @@ public class InnerHitsIT extends ESIntegTestCase {
|
|||
assertThat(response.getHits().getAt(0).getInnerHits().get("comments").getAt(0).getNestedIdentity().getField().string(), equalTo("comments"));
|
||||
assertThat(response.getHits().getAt(0).getInnerHits().get("comments").getAt(0).getNestedIdentity().getOffset(), equalTo(0));
|
||||
assertThat(response.getHits().getAt(0).getInnerHits().get("comments").getAt(0).getNestedIdentity().getChild(), nullValue());
|
||||
assertThat(String.valueOf(response.getHits().getAt(0).getInnerHits().get("comments").getAt(0).fields().get("comments.message").getValue()), equalTo("fox eat quick"));
|
||||
assertThat(String.valueOf((Object)response.getHits().getAt(0).getInnerHits().get("comments").getAt(0).fields().get("comments.message").getValue()), equalTo("fox eat quick"));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
233098147123ee5ddcd39ffc57ff648be4b7e5b2
|
File diff suppressed because it is too large
Load Diff
|
@ -1 +0,0 @@
|
|||
|
33
pom.xml
33
pom.xml
|
@ -37,8 +37,8 @@
|
|||
<!-- elasticsearch stack -->
|
||||
<elasticsearch.version>${project.version}</elasticsearch.version>
|
||||
<jvm.executable>${java.home}${file.separator}bin${file.separator}java</jvm.executable>
|
||||
<maven.compiler.source>1.7</maven.compiler.source>
|
||||
<maven.compiler.target>1.7</maven.compiler.target>
|
||||
<maven.compiler.source>1.8</maven.compiler.source>
|
||||
<maven.compiler.target>1.8</maven.compiler.target>
|
||||
|
||||
<!-- libraries -->
|
||||
<lucene.version>5.3.0</lucene.version>
|
||||
|
@ -171,12 +171,6 @@
|
|||
<version>1.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.twitter</groupId>
|
||||
<artifactId>jsr166e</artifactId>
|
||||
<version>1.1.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.lucene</groupId>
|
||||
<artifactId>lucene-test-framework</artifactId>
|
||||
|
@ -605,7 +599,6 @@
|
|||
<jvmArgs>
|
||||
<param>-Xmx${tests.heap.size}</param>
|
||||
<param>-Xms${tests.heap.size}</param>
|
||||
<param>${java.permGenSpace}</param>
|
||||
<param>-XX:MaxDirectMemorySize=512m</param>
|
||||
<param>-Des.logger.prefix=</param>
|
||||
<param>-XX:+HeapDumpOnOutOfMemoryError</param>
|
||||
|
@ -1016,8 +1009,8 @@ org.eclipse.jdt.core.compiler.annotation.inheritNullAnnotations=enabled
|
|||
org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore
|
||||
org.eclipse.jdt.core.compiler.annotation.nullable=org.elasticsearch.common.Nullable
|
||||
org.eclipse.jdt.core.compiler.annotation.nullanalysis=enabled
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
|
||||
org.eclipse.jdt.core.compiler.compliance=1.7
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
|
||||
org.eclipse.jdt.core.compiler.compliance=1.8
|
||||
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
|
||||
org.eclipse.jdt.core.compiler.problem.nonnullParameterAnnotationDropped=warning
|
||||
org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=warning
|
||||
|
@ -1025,7 +1018,7 @@ org.eclipse.jdt.core.compiler.problem.nullReference=warning
|
|||
org.eclipse.jdt.core.compiler.problem.nullSpecViolation=warning
|
||||
org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning
|
||||
org.eclipse.jdt.core.compiler.problem.potentialNullReference=warning
|
||||
org.eclipse.jdt.core.compiler.source=1.7
|
||||
org.eclipse.jdt.core.compiler.source=1.8
|
||||
org.eclipse.jdt.core.formatter.lineSplit=140
|
||||
org.eclipse.jdt.core.formatter.tabulation.char=space
|
||||
org.eclipse.jdt.core.formatter.tabulation.size=4
|
||||
|
@ -1108,22 +1101,6 @@ org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UT
|
|||
<artifactId>maven-antrun-plugin</artifactId>
|
||||
<version>1.8</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>set-permgen</id>
|
||||
<phase>validate</phase>
|
||||
<goals>
|
||||
<goal>run</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<target>
|
||||
<!-- if we are on java 1.7.* we set perm gen space since some tests need it otherwise we just inject a dummy value -->
|
||||
<condition property="java.permGenSpace" value="-XX:MaxPermSize=128m" else="-Dsome.dummy.value=" >
|
||||
<matches pattern="1\.7\..+$" string="${java.runtime.version}" />
|
||||
</condition>
|
||||
</target>
|
||||
<exportAntProperties>true</exportAntProperties>
|
||||
</configuration>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>check-invalid-patterns</id>
|
||||
<phase>validate</phase>
|
||||
|
|
Loading…
Reference in New Issue