{{org.hibernate.search.mapper.pojo.work.impl.PojoIndexedTypeIndexingPlan.IndexedEntityIndexingPlan#purge}} sets {{entitySupplier}} to {{null}}:
{code} void purge() { // This is a purge: do not resolve reindexing entitySupplier = null; shouldResolveToReindex = false; // This is a purge: force deletion even if it doesn't seem this document was added considerAllDirty = false; dirtyPaths = null; add = false; delete = true; } {code}
But then the actual execution of the purge will try to retrieve the routing key, which will involve dereferencing the {{entitySupplier}}. For example {{org.hibernate.search.backend.lucene.work.execution.impl.LuceneIndexIndexingPlan#delete}}:
{code} @Override public void delete(DocumentReferenceProvider referenceProvider) { String id = referenceProvider.getIdentifier(); String routingKey = referenceProvider.getRoutingKey();
collect( id, routingKey, factory.delete( tenantId, id ) ); } {code}
Two problems to solve:
1. - When the user doesn't use routing key, this should work fine and not throw an NPE. - => Actually this already works fine: we don't try to dereference the entitySupplier in that case. 2. When the user does use routing key, we should expect users to provide the routing key to {{org.hibernate.search.mapper.orm.work.SearchIndexingPlan#purge(java.lang.Class<?>, java.lang.Object)}}/{{org.hibernate.search.mapper.orm.work.SearchIndexingPlan#purge(java.lang.String, java.lang.Object)}}. Let's just add a String parameter. |
|