Compare commits
11 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 1723fd24c3 | |||
| 7b01fa3582 | |||
| 27954e83c2 | |||
| 6c4d101b46 | |||
| 48d77796ab | |||
| 96a4605361 | |||
| 144ae6d7d1 | |||
| 7c429c4a94 | |||
| 08ec702138 | |||
| 91af6fefde | |||
| 823c164ae7 |
+2
-2
@@ -1,3 +1,3 @@
|
||||
#Mon Feb 20 12:02:21 CET 2023
|
||||
#Thu Apr 06 16:18:44 CEST 2023
|
||||
wrapperUrl=https\://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar
|
||||
distributionUrl=https\://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.0/apache-maven-3.9.0-bin.zip
|
||||
distributionUrl=https\://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.1/apache-maven-3.9.1-bin.zip
|
||||
|
||||
@@ -5,12 +5,12 @@
|
||||
|
||||
<groupId>org.springframework.data</groupId>
|
||||
<artifactId>spring-data-elasticsearch</artifactId>
|
||||
<version>4.4.9</version>
|
||||
<version>4.4.11</version>
|
||||
|
||||
<parent>
|
||||
<groupId>org.springframework.data.build</groupId>
|
||||
<artifactId>spring-data-parent</artifactId>
|
||||
<version>2.7.9</version>
|
||||
<version>2.7.11</version>
|
||||
</parent>
|
||||
|
||||
<name>Spring Data Elasticsearch</name>
|
||||
@@ -24,7 +24,7 @@
|
||||
<elasticsearch-java>7.17.9</elasticsearch-java>
|
||||
<log4j>2.17.1</log4j>
|
||||
<netty>4.1.65.Final</netty>
|
||||
<springdata.commons>2.7.9</springdata.commons>
|
||||
<springdata.commons>2.7.11</springdata.commons>
|
||||
<testcontainers>1.16.2</testcontainers>
|
||||
<blockhound-junit>1.0.6.RELEASE</blockhound-junit>
|
||||
<java-module-name>spring.data.elasticsearch</java-module-name>
|
||||
|
||||
@@ -45,6 +45,7 @@ import org.springframework.util.Assert;
|
||||
* @author Roman Puchkovskiy
|
||||
* @author Matt Gilene
|
||||
* @author Sascha Woo
|
||||
* @author Jakob Hoeper
|
||||
* @since 4.0
|
||||
*/
|
||||
public class SearchHitMapping<T> {
|
||||
@@ -197,9 +198,10 @@ public class SearchHitMapping<T> {
|
||||
}
|
||||
|
||||
try {
|
||||
ElasticsearchPersistentEntity<?> persistentEntityForType = mappingContext.getPersistentEntity(type);
|
||||
NestedMetaData nestedMetaData = searchHits.getSearchHit(0).getContent().getNestedMetaData();
|
||||
ElasticsearchPersistentEntityWithNestedMetaData persistentEntityWithNestedMetaData = getPersistentEntity(
|
||||
mappingContext.getPersistentEntity(type), nestedMetaData);
|
||||
persistentEntityForType, nestedMetaData);
|
||||
|
||||
if (persistentEntityWithNestedMetaData.entity != null) {
|
||||
List<SearchHit<Object>> convertedSearchHits = new ArrayList<>();
|
||||
@@ -217,7 +219,8 @@ public class SearchHitMapping<T> {
|
||||
searchDocument.getSortValues(), //
|
||||
searchDocument.getHighlightFields(), //
|
||||
searchHit.getInnerHits(), //
|
||||
persistentEntityWithNestedMetaData.nestedMetaData, //
|
||||
getPersistentEntity(persistentEntityForType, //
|
||||
searchHit.getContent().getNestedMetaData()).nestedMetaData, //
|
||||
searchHit.getExplanation(), //
|
||||
searchHit.getMatchedQueries(), //
|
||||
targetObject));
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
Spring Data Elasticsearch 4.4.9 (2021.2.9)
|
||||
Spring Data Elasticsearch 4.4.11 (2021.2.11)
|
||||
Copyright (c) [2013-2021] Pivotal Software, Inc.
|
||||
|
||||
This product is licensed to you under the Apache License, Version 2.0 (the "License").
|
||||
@@ -44,6 +44,8 @@ conditions of the subcomponent's license, as noted in the LICENSE file.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
+10
-4
@@ -42,6 +42,7 @@ import org.springframework.lang.Nullable;
|
||||
* Testing the querying and parsing of inner_hits.
|
||||
*
|
||||
* @author Peter-Josef Meisch
|
||||
* @author Jakob Hoeper
|
||||
*/
|
||||
@SpringIntegrationTest
|
||||
public abstract class InnerHitsIntegrationTests {
|
||||
@@ -58,8 +59,9 @@ public abstract class InnerHitsIntegrationTests {
|
||||
indexOps.createWithMapping();
|
||||
|
||||
Inhabitant john = new Inhabitant("John", "Smith");
|
||||
Inhabitant carla = new Inhabitant("Carla", "Miller");
|
||||
House cornerHouse = new House("Round the corner", "7", Arrays.asList(john, carla));
|
||||
Inhabitant carla1 = new Inhabitant("Carla", "Miller");
|
||||
Inhabitant carla2 = new Inhabitant("Carla", "Nguyen");
|
||||
House cornerHouse = new House("Round the corner", "7", Arrays.asList(john, carla1, carla2));
|
||||
City metropole = new City("Metropole", Arrays.asList(cornerHouse));
|
||||
|
||||
Inhabitant jack = new Inhabitant("Jack", "Wayne");
|
||||
@@ -76,7 +78,7 @@ public abstract class InnerHitsIntegrationTests {
|
||||
operations.indexOps(IndexCoordinates.of(indexNameProvider.getPrefix() + "*")).delete();
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test // #2521
|
||||
void shouldReturnInnerHits() {
|
||||
|
||||
Query query = buildQueryForInnerHits("inner_hit_name", "hou-ses.in-habi-tants", "hou-ses.in-habi-tants.first-name",
|
||||
@@ -91,7 +93,7 @@ public abstract class InnerHitsIntegrationTests {
|
||||
softly.assertThat(searchHit.getInnerHits()).hasSize(1);
|
||||
|
||||
SearchHits<?> innerHits = searchHit.getInnerHits("inner_hit_name");
|
||||
softly.assertThat(innerHits).hasSize(1);
|
||||
softly.assertThat(innerHits).hasSize(2);
|
||||
|
||||
SearchHit<?> innerHit = innerHits.getSearchHit(0);
|
||||
Object content = innerHit.getContent();
|
||||
@@ -106,6 +108,10 @@ public abstract class InnerHitsIntegrationTests {
|
||||
softly.assertThat(nestedMetaData.getChild().getField()).isEqualTo("inhabitants");
|
||||
softly.assertThat(nestedMetaData.getChild().getOffset()).isEqualTo(1);
|
||||
|
||||
innerHit = innerHits.getSearchHit(1);
|
||||
softly.assertThat(((Inhabitant) innerHit.getContent()).getLastName()).isEqualTo("Nguyen");
|
||||
softly.assertThat(innerHit.getNestedMetaData().getChild().getOffset()).isEqualTo(2);
|
||||
|
||||
softly.assertAll();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user