1
0
mirror of synced 2026-05-23 12:43:17 +00:00

Compare commits

...

8 Commits

Author SHA1 Message Date
Spring Builds 06db4fde05 Release version 4.4.4 (2021.2.4).
See #2296
2022-10-13 08:59:56 +00:00
Spring Builds c823ce1946 Prepare 4.4.4 (2021.2.4).
See #2296
2022-10-13 08:57:08 +00:00
Peter-Josef Meisch 2fa15f772a Escape backslash in StringQuery.
Original Pull Request
Closes #2326

(cherry picked from commit 03ecc48b09)
2022-10-11 22:38:22 +02:00
Peter-Josef Meisch 02b6d54cc9 Prefer config supplied content-type and accept header.
Original Pull Request #2328
Closes #2327
2022-10-08 15:10:26 +02:00
Peter-Josef Meisch 8bb3474c05 Revert "Support partially update document by entity."
This reverts commit 7e904cdbe7.
2022-09-24 22:00:49 +02:00
puppylpg 7e904cdbe7 Support partially update document by entity.
Original Pull Request #2305
Closes #2304
2022-09-24 21:57:41 +02:00
Spring Builds e46b4977a4 After release cleanups.
See #2221
2022-09-19 12:00:24 +00:00
Spring Builds 5de2e0b96e Prepare next development iteration.
See #2221
2022-09-19 12:00:12 +00:00
5 changed files with 31 additions and 6 deletions
+3 -3
View File
@@ -5,12 +5,12 @@
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-elasticsearch</artifactId>
<version>4.4.3</version>
<version>4.4.4</version>
<parent>
<groupId>org.springframework.data.build</groupId>
<artifactId>spring-data-parent</artifactId>
<version>2.7.3</version>
<version>2.7.4</version>
</parent>
<name>Spring Data Elasticsearch</name>
@@ -24,7 +24,7 @@
<elasticsearch-java>7.17.6</elasticsearch-java>
<log4j>2.17.1</log4j>
<netty>4.1.65.Final</netty>
<springdata.commons>2.7.3</springdata.commons>
<springdata.commons>2.7.4</springdata.commons>
<testcontainers>1.16.2</testcontainers>
<blockhound-junit>1.0.6.RELEASE</blockhound-junit>
<java-module-name>spring.data.elasticsearch</java-module-name>
@@ -256,6 +256,15 @@ public interface WebClientProvider {
HttpHeaders suppliedHeaders = clientConfiguration.getHeadersSupplier().get();
if (suppliedHeaders != null && suppliedHeaders != HttpHeaders.EMPTY) {
// remove content-type and accept if they are provided by the client configuration (ES7 compatibility headers)
if (suppliedHeaders.containsKey(HttpHeaders.CONTENT_TYPE)) {
httpHeaders.remove(HttpHeaders.CONTENT_TYPE);
}
if (suppliedHeaders.containsKey(HttpHeaders.ACCEPT)) {
httpHeaders.remove(HttpHeaders.ACCEPT);
}
httpHeaders.addAll(suppliedHeaders);
}
}));
@@ -46,7 +46,11 @@ final public class StringQueryUtil {
String placeholder = Pattern.quote(matcher.group()) + "(?!\\d+)";
int index = NumberUtils.parseNumber(matcher.group(1), Integer.class);
result = result.replaceAll(placeholder, Matcher.quoteReplacement(getParameterWithIndex(accessor, index)));
String replacement = Matcher.quoteReplacement(getParameterWithIndex(accessor, index));
result = result.replaceAll(placeholder, replacement);
// need to escape backslashes that are not escapes for quotes so that they are sent as double-backslashes
// to Elasticsearch
result = result.replaceAll("\\\\([^\"'])", "\\\\\\\\$1");
}
return result;
}
@@ -56,7 +60,6 @@ final public class StringQueryUtil {
Object parameter = accessor.getBindableValue(index);
String parameterValue = "null";
// noinspection ConstantConditions
if (parameter != null) {
parameterValue = convert(parameter);
+2 -1
View File
@@ -1,4 +1,4 @@
Spring Data Elasticsearch 4.4.3 (2021.2.3)
Spring Data Elasticsearch 4.4.4 (2021.2.4)
Copyright (c) [2013-2021] Pivotal Software, Inc.
This product is licensed to you under the Apache License, Version 2.0 (the "License").
@@ -39,5 +39,6 @@ conditions of the subcomponent's license, as noted in the LICENSE file.
@@ -129,6 +129,18 @@ public class ElasticsearchStringQueryUnitTests extends ElasticsearchStringQueryU
"{ 'bool' : { 'must' : { 'terms' : { 'name' : [\"hello \\\"Stranger\\\"\",\"Another string\"] } } } }");
}
@Test // #2326
@DisplayName("should escape backslashes in collection query parameters")
void shouldEscapeBackslashesInCollectionQueryParameters() throws NoSuchMethodException {
final List<String> parameters = Arrays.asList("param\\1", "param\\2");
List<String> params = new ArrayList<>(parameters);
org.springframework.data.elasticsearch.core.query.Query query = createQuery("findByNameIn", params);
assertThat(query).isInstanceOf(StringQuery.class);
assertThat(((StringQuery) query).getSource()).isEqualTo(
"{ 'bool' : { 'must' : { 'terms' : { 'name' : [\"param\\\\1\",\"param\\\\2\"] } } } }");
}
private org.springframework.data.elasticsearch.core.query.Query createQuery(String methodName, Object... args)
throws NoSuchMethodException {