DATAES-788 - Add missing path mapping to completion context.
Original PR: #424
This commit is contained in:
committed by
GitHub
parent
bbc9ec213a
commit
89944b66c4
@@ -43,6 +43,7 @@ import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.assertj.core.data.Percentage;
|
||||
import org.elasticsearch.search.suggest.completion.context.ContextMapping;
|
||||
import org.json.JSONException;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
@@ -560,6 +561,28 @@ public class MappingBuilderTests extends MappingContextBaseTests {
|
||||
assertEquals(expected, mapping, true);
|
||||
}
|
||||
|
||||
@Test // DATAES-788
|
||||
void shouldWriteCompletionContextInfo() throws JSONException {
|
||||
String expected = "{\n" + //
|
||||
" \"properties\": {\n" + //
|
||||
" \"suggest\": {\n" + //
|
||||
" \"type\": \"completion\",\n" + //
|
||||
" \"contexts\": [\n" + //
|
||||
" {\n" + //
|
||||
" \"name\": \"location\",\n" + //
|
||||
" \"type\": \"geo\",\n" + //
|
||||
" \"path\": \"proppath\"\n" + //
|
||||
" }\n" + //
|
||||
" ]\n" + //
|
||||
" }\n" + //
|
||||
" }\n" + //
|
||||
"}";
|
||||
|
||||
String mapping = getMappingBuilder().buildPropertyMapping(CompletionDocument.class);
|
||||
|
||||
assertEquals(expected, mapping, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* @author Xiao Yu
|
||||
*/
|
||||
@@ -1029,4 +1052,14 @@ public class MappingBuilderTests extends MappingContextBaseTests {
|
||||
static class ValueDoc {
|
||||
@Field(type = Text) private ValueObject valueObject;
|
||||
}
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@Document(indexName = "completion")
|
||||
static class CompletionDocument {
|
||||
@Id private String id;
|
||||
|
||||
@CompletionField(contexts = { @CompletionContext(name = "location", type = ContextMapping.Type.GEO,
|
||||
path = "proppath") }) private Completion suggest;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user