Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(addParent): support explicitly passing null abbreviation
For some time, we have [used null values](11bd4f6) to ensure Elasticsearch properly handles the optional abbreviation value in parent records. As a result, we have been very strict in what we allow for values of the abbreviation field. Currently, the Javascript value `undefined` is converted to `null` (Elasticsearch has `null` but not `undefined`), and passing `null` in is forbidden. However, this means that if we wish to take a value that has been already added with `addParent` and "re-add" it (perhaps after some processing, as in pelias/wof-admin-lookup#232), the model code will throw a validation error. This PR changes `addParent` to accept any value with `typeof` `string`. All others are stored as `null`s. After testing of importing around 5 million OSM records from around the world, no numeric abbreviation values was found, so this should cover all cases well. As it relates to pelias/wof-admin-lookup#232, this fixes a problem where many many otherwise valid records will be skipped with postal cities admin lookup is enabled.
- Loading branch information