Introduce a way to map a single entity type to multiple indexes:
on bootstrap, user code will provide a list of index names that this entity type will be mapped to (instead of just one usually).
at runtime, each entity to index will be inspected by user code upon indexing, and routed to the correct index.
For example, we could repurpose the RoutingKeyBridge, renaming it to a RoutingBridge. Its APIs would change a lot, but something like this could do:
This should address:
Part of the use cases mentioned in HSEARCH-3313: essentially all the use cases except those where the list of indexes is not known in advance. Even that one could be covered eventually, but let's keep it for later.
Most, if not all, of the use cases for Indexing Event Interceptors (). These interceptors are mainly used to prevent indexing of entities that are in a certain state. We could provide a way for users to route an entity to "nowhere" (route.discard()?), meaning it will be removed from all indexes and will not be added anywhere.