mirror of
https://github.com/datahub-project/datahub.git
synced 2025-06-27 05:03:31 +00:00
feat(gms/search): Adding support for DOUBLE Searchable type (#9369)
Co-authored-by: si-chakraborty <si.chakraborty@adevinta.com>
This commit is contained in:
parent
c66619ccc7
commit
7fb60869f2
@ -66,7 +66,8 @@ public class SearchableAnnotation {
|
||||
DATETIME,
|
||||
OBJECT,
|
||||
BROWSE_PATH_V2,
|
||||
WORD_GRAM
|
||||
WORD_GRAM,
|
||||
DOUBLE
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
|
@ -142,7 +142,7 @@ public class EntitySpecBuilderTest {
|
||||
assertEquals(new TestEntityInfo().schema().getFullName(), testEntityInfo.getPegasusSchema().getFullName());
|
||||
|
||||
// Assert on Searchable Fields
|
||||
assertEquals(testEntityInfo.getSearchableFieldSpecs().size(), 10);
|
||||
assertEquals(testEntityInfo.getSearchableFieldSpecs().size(), 11);
|
||||
assertEquals("customProperties", testEntityInfo.getSearchableFieldSpecMap().get(
|
||||
new PathSpec("customProperties").toString()).getSearchableAnnotation().getFieldName());
|
||||
assertEquals(SearchableAnnotation.FieldType.KEYWORD, testEntityInfo.getSearchableFieldSpecMap().get(
|
||||
@ -189,6 +189,10 @@ public class EntitySpecBuilderTest {
|
||||
new PathSpec("foreignKey").toString()).getSearchableAnnotation().getFieldName());
|
||||
assertEquals(true, testEntityInfo.getSearchableFieldSpecMap().get(
|
||||
new PathSpec("foreignKey").toString()).getSearchableAnnotation().isQueryByDefault());
|
||||
assertEquals("doubleField", testEntityInfo.getSearchableFieldSpecMap().get(
|
||||
new PathSpec("doubleField").toString()).getSearchableAnnotation().getFieldName());
|
||||
assertEquals(SearchableAnnotation.FieldType.DOUBLE, testEntityInfo.getSearchableFieldSpecMap().get(
|
||||
new PathSpec("doubleField").toString()).getSearchableAnnotation().getFieldType());
|
||||
|
||||
|
||||
// Assert on Relationship Fields
|
||||
|
@ -134,6 +134,8 @@ public class MappingsBuilder {
|
||||
mappingForField.put(TYPE, ESUtils.DATE_FIELD_TYPE);
|
||||
} else if (fieldType == FieldType.OBJECT) {
|
||||
mappingForField.put(TYPE, ESUtils.OBJECT_FIELD_TYPE);
|
||||
} else if (fieldType == FieldType.DOUBLE) {
|
||||
mappingForField.put(TYPE, ESUtils.DOUBLE_FIELD_TYPE);
|
||||
} else {
|
||||
log.info("FieldType {} has no mappings implemented", fieldType);
|
||||
}
|
||||
|
@ -18,7 +18,7 @@ public class MappingsBuilderTest {
|
||||
Map<String, Object> result = MappingsBuilder.getMappings(TestEntitySpecBuilder.getSpec());
|
||||
assertEquals(result.size(), 1);
|
||||
Map<String, Object> properties = (Map<String, Object>) result.get("properties");
|
||||
assertEquals(properties.size(), 19);
|
||||
assertEquals(properties.size(), 20);
|
||||
assertEquals(properties.get("urn"), ImmutableMap.of("type", "keyword",
|
||||
"fields",
|
||||
ImmutableMap.of("delimited",
|
||||
@ -123,5 +123,9 @@ public class MappingsBuilderTest {
|
||||
assertEquals(feature1.get("type"), "double");
|
||||
Map<String, Object> feature2 = (Map<String, Object>) properties.get("feature2");
|
||||
assertEquals(feature2.get("type"), "double");
|
||||
|
||||
// DOUBLE
|
||||
Map<String, Object> doubleField = (Map<String, Object>) properties.get("doubleField");
|
||||
assertEquals(doubleField.get("type"), "double");
|
||||
}
|
||||
}
|
||||
|
@ -90,4 +90,10 @@ record TestEntityInfo includes CustomProperties {
|
||||
}
|
||||
}
|
||||
esObjectField: optional map[string, string]
|
||||
|
||||
@Searchable = {
|
||||
"fieldName": "doubleField",
|
||||
"fieldType": "DOUBLE"
|
||||
}
|
||||
doubleField: optional double
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user