After updating a specific document using docRef, how can I manually update its CDM value without enabling the “mgmtp.a12.dataservices.cdd.dirtyDocuments.sync.enabled” property?
This is what I attempted to do:
private void updateDocuments(String model) {
List<DocumentReference> documentReferences = documentRepository.findAllDocRefsForModel(model);
documentReferences.forEach((docRef) -> {
Optional<DataServicesDocument> optDocument = documentRepository.getByDocumentReference(docRef);
optDocument.ifPresent(dataServicesDocument -> documentService.update(dataServicesDocument.getDocRef(),
dataServicesDocument.getKernelDocument(), null));
dirtyDocumentsManager.markDocumentAsDirty(docRef);
cddDirtyDocumentsConsumer.process(docRef);
});
indexLoader.rebuildIndexForModel(model, 500);
}
If you look into the implementation of DirtyDocumentsManager, I believe using either
// sync or async depends on mgmtp.a12.dataservices.cdd.dirtyDocuments.sync.enabled
dirtyDocumentsManager.markDocumentAsDirty(docRef);
or
// sync
cddDirtyDocumentsConsumer.process(docRef);
should trigger updating cdm index for a docref.
For all cdm index, it should be done via
SearchIndexLoader#updateSearchIndex
In your case, it sounds like an immediate update match with sync.
Please be aware that DS has already emphasized the caution when using sync mode in production.
Hi @n.garryyev, it’s not possible. CDDs are processed either synchronously or asynchronously as you are aware. Synchronous processing will update the CDD in the calling thread, but it’s discouraged to use synchronous processing in production because it’s costly.
In async processing, it’s not possible to update CDD immediately.