feat(search) - add DATETIME FieldType (#4407)

* feat(search) - add DATETIME FieldType
This commit is contained in:
Aditya Radhakrishnan 2022-04-05 14:41:54 -07:00 committed by GitHub
parent bc1c06069a
commit 8610c29e49
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 2 deletions

View File

@ -323,7 +323,7 @@ It takes the following parameters:
annotations. To customize the set of analyzers used to index a certain field, you must add a new field type and define
the set of mappings to be applied in the MappingsBuilder.
Thus far, we have implemented 8 fieldTypes:
Thus far, we have implemented 9 fieldTypes:
1. *KEYWORD* - Short text fields that only support exact matches, often used only for filtering
@ -342,6 +342,8 @@ It takes the following parameters:
7. *BOOLEAN* - Boolean fields used for filtering.
8. *COUNT* - Count fields used for filtering.
9. *DATETIME* - Datetime fields used to represent timestamps.
- **fieldName**: string (optional) - The name of the field in search index document. Defaults to the field name where
the annotation resides.

View File

@ -52,7 +52,8 @@ public class SearchableAnnotation {
URN,
URN_PARTIAL,
BOOLEAN,
COUNT
COUNT,
DATETIME
}
@Nonnull

View File

@ -77,6 +77,8 @@ public class MappingsBuilder {
mappingForField.put("type", "boolean");
} else if (fieldType == FieldType.COUNT) {
mappingForField.put("type", "long");
} else if (fieldType == FieldType.DATETIME) {
mappingForField.put("type", "date");
} else {
log.info("FieldType {} has no mappings implemented", fieldType);
}