fix breaking mapping for keyword type
Follow-up of the MR: #726, that MR adds back support for link & []link types that was broken due Bag of words feature (MR: 649). Though fix only works for new kind or if we can reindex (with force_clean=true). Indexer is still not able to process link & []link if index was already setup before M22, we have found there two different exceptions related to current issue:
- It cannot reconcile mapping for link or []link types on existing indices. With recent fixes (MR: 743) we don't fail indexing request and log the error but Indexer service drops entire data block and users won't be able to search on any property. We get following error:
This change-set restore the link & []link mapping to pre M22.
- Bag of words feature (MR: 649) changes the schema sync behavior on index worker request. With this change, on every request Indexer service will try to sync schema from Schema service with indexer mapping. This results in random null pointer error (as shown below) while getting data attribute mapping.
We should be utilizing schema-event instead to sync the index mapping with schema from Schema service; indexer service already provides implementation for the same. We have renamed IMappingService.syncIndexMappingIfRequired
to IMappingService.syncMetaAttributeIndexMappingIfRequired
to better reflect usage and moved the offending schema sync code to Bag of words feature flag to avoid any breaking change for that feature.
We also observed we are missing tests on TypeMapper
so multiple tests have been added to prevent any accidental updates.