Message Boards

Waiting for the Indexer when adding a new entity

thumbnail
Dominik Marks, modified 3 Years ago.

Waiting for the Indexer when adding a new entity

Regular Member Posts: 149 Join Date: 8/29/12 Recent Posts

Hello there,

I have the following problem.

I have a custom entity build using the service builder. The "add" method is annotated with @Indexable(type=REINDEX). So when adding a new entity it is added to the index, too. 

Adding the entity is started from an MVCActionCommand. After that an MVCRenderCommand is invoked to show all entities in a result page.The MVCRenderCommand invokes a search to find all entities. 

The search results in the MVCRenderCommand however does not contain the entity that was added in the current request. 

If I reload the page so that the MVCRenderCommand is invoked again the entity added before is found in the search result.

Is it possible to somehow "wait" for the entity to be fully indexed before returning from the "add" method in the service?