To Hardy Ferentschik Sanne Grinovero
Unless the entity is actually pushed to the database, the indexing queue remains empty. So in general, unless Session.flush() is called, there is no need to clean the indexing queue.
save() happens to be different if the id generation uses column id. In this case, ORM must persist the entity right away because save() returns the identifier. In this case, the entity is stored and the index operation is in the queue. Clearing the indexing queue in this case will make the index inconsistent with the database (unless the DB is rolled backed).
So in some ways, clear() is fine by not clearing the queue, or maybe it should force a queue flush before actually clearing.
All that to say that I am not sure we need clearIndexingQueue(), I don't think HSEARCH-1383 is a use case. The user would have to call clearIndexingQueue() often enough to not go above the queue threshold. Using clearIndexingQueue() for HSEARCH-1383 seems cranky.
|