mirror of
https://github.com/spring-projects/spring-data-elasticsearch.git
synced 2025-06-28 14:52:20 +00:00
DATAES-754 - Completion field deserialization is failing due to class cast error.
Original PR: #399
This commit is contained in:
parent
bf51de3805
commit
251adc1eec
@ -3,6 +3,7 @@ package org.springframework.data.elasticsearch.core.completion;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.springframework.data.annotation.PersistenceConstructor;
|
||||||
import org.springframework.lang.Nullable;
|
import org.springframework.lang.Nullable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -23,6 +24,11 @@ public class Completion {
|
|||||||
this.input = input;
|
this.input = input;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@PersistenceConstructor
|
||||||
|
public Completion(List<String> input) {
|
||||||
|
this.input = input.toArray(new String[0]);
|
||||||
|
}
|
||||||
|
|
||||||
public String[] getInput() {
|
public String[] getInput() {
|
||||||
return input;
|
return input;
|
||||||
}
|
}
|
||||||
|
@ -87,7 +87,8 @@ public class ElasticsearchTemplateCompletionTests {
|
|||||||
indexQueries.add(new CompletionEntityBuilder("4").name("Artur Konczak").suggest(new String[] { "Artur", "Konczak" })
|
indexQueries.add(new CompletionEntityBuilder("4").name("Artur Konczak").suggest(new String[] { "Artur", "Konczak" })
|
||||||
.buildIndex());
|
.buildIndex());
|
||||||
|
|
||||||
operations.bulkIndex(indexQueries, IndexCoordinates.of("test-index-core-completion").withTypes("completion-type"));
|
IndexCoordinates index = IndexCoordinates.of("test-index-core-completion");
|
||||||
|
operations.bulkIndex(indexQueries, index);
|
||||||
operations.indexOps(CompletionEntity.class).refresh();
|
operations.indexOps(CompletionEntity.class).refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -151,6 +152,13 @@ public class ElasticsearchTemplateCompletionTests {
|
|||||||
assertThat(options.get(1).getText().string()).isIn("Marchand", "Mohsin");
|
assertThat(options.get(1).getText().string()).isIn("Marchand", "Mohsin");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test // DATAES-754
|
||||||
|
void shouldRetrieveEntityWithCompletion() {
|
||||||
|
loadCompletionObjectEntities();
|
||||||
|
IndexCoordinates index = IndexCoordinates.of("test-index-core-completion");
|
||||||
|
operations.get("1", CompletionEntity.class, index);
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void shouldFindSuggestionsForGivenCriteriaQueryUsingAnnotatedCompletionEntity() {
|
public void shouldFindSuggestionsForGivenCriteriaQueryUsingAnnotatedCompletionEntity() {
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user