Allow to configure whether indexing in the ORM mapper should be synchronous or asynchronous

Description

See https://github.com/hibernate/hibernate-search-6-poc/commit/56ff5eee1dec23d89f0c538f50ea2fb0be76c508

Note that search queries are out of scope.

Essentially we will allow to register a "completion handler" which will define how to behave once indexing works have been sent:

  • wait until full completion (synchronous)

  • do not wait (asynchronous)

  • custom, for example wait for 1 second, and if it's not finished by then, fall back to some behavior that only makes sense for longer operations (notify with an UI message or an email when the operation ends, for example).

Note that we should be careful: when some backend enlists in the transaction (thus requiring to wait for the execution to end before we can proceed), we should always wait for completion, either before or after the user-configured completion handler. Maybe after would be better, since it would still allow custom blocking behaviors.

We might want to allow users to define a default behavior, applied by default to every session.

Also, we should think about allowing to configure the "level" of completion which is expected: in Elasticsearch for example, we might want to wait for works to be fully sent to the cluster, or to wait a bit more for the result of these works to be visible (refresh), potentially triggering the refresh manually. This would require deeper interaction with the backend, probably passing the "refresh_after_write" setting from the mapper instead of setting in the index configuration as we currently do.

Activity

Show:

Yoann Rodière January 8, 2019 at 9:31 AM

Moving this to alpha, as the part about "refresh_after_write" is rather important and should at least be documented before a beta.

Fixed

Details

Assignee

Reporter

Components

Sprint

Fix versions

Priority

Created September 4, 2018 at 12:46 PM
Updated May 24, 2019 at 1:38 PM
Resolved May 7, 2019 at 8:25 AM