diff --git a/backend/elasticsearch/src/main/java/org/hibernate/search/backend/elasticsearch/work/execution/impl/ElasticsearchIndexIndexer.java b/backend/elasticsearch/src/main/java/org/hibernate/search/backend/elasticsearch/work/execution/impl/ElasticsearchIndexIndexer.java
index 576650dbfda..d09ccde2872 100644
--- a/backend/elasticsearch/src/main/java/org/hibernate/search/backend/elasticsearch/work/execution/impl/ElasticsearchIndexIndexer.java
+++ b/backend/elasticsearch/src/main/java/org/hibernate/search/backend/elasticsearch/work/execution/impl/ElasticsearchIndexIndexer.java
@@ -45,7 +45,7 @@ public CompletableFuture> add(DocumentReferenceProvider referenceProvider,
}
@Override
- public CompletableFuture> update(DocumentReferenceProvider referenceProvider,
+ public CompletableFuture> addOrUpdate(DocumentReferenceProvider referenceProvider,
DocumentContributor documentContributor,
DocumentCommitStrategy commitStrategy, DocumentRefreshStrategy refreshStrategy) {
return index( referenceProvider, documentContributor, refreshStrategy );
diff --git a/backend/elasticsearch/src/main/java/org/hibernate/search/backend/elasticsearch/work/execution/impl/ElasticsearchIndexIndexingPlan.java b/backend/elasticsearch/src/main/java/org/hibernate/search/backend/elasticsearch/work/execution/impl/ElasticsearchIndexIndexingPlan.java
index 10c2a8f0bfb..8d4dd4aaaaf 100644
--- a/backend/elasticsearch/src/main/java/org/hibernate/search/backend/elasticsearch/work/execution/impl/ElasticsearchIndexIndexingPlan.java
+++ b/backend/elasticsearch/src/main/java/org/hibernate/search/backend/elasticsearch/work/execution/impl/ElasticsearchIndexIndexingPlan.java
@@ -57,7 +57,7 @@ public void add(DocumentReferenceProvider referenceProvider,
}
@Override
- public void update(DocumentReferenceProvider referenceProvider,
+ public void addOrUpdate(DocumentReferenceProvider referenceProvider,
DocumentContributor documentContributor) {
index( referenceProvider, documentContributor );
}
diff --git a/backend/lucene/src/main/java/org/hibernate/search/backend/lucene/work/execution/impl/LuceneIndexIndexer.java b/backend/lucene/src/main/java/org/hibernate/search/backend/lucene/work/execution/impl/LuceneIndexIndexer.java
index 4529810ce93..1c4007842bf 100644
--- a/backend/lucene/src/main/java/org/hibernate/search/backend/lucene/work/execution/impl/LuceneIndexIndexer.java
+++ b/backend/lucene/src/main/java/org/hibernate/search/backend/lucene/work/execution/impl/LuceneIndexIndexer.java
@@ -58,7 +58,7 @@ public CompletableFuture> add(DocumentReferenceProvider referenceProvider,
}
@Override
- public CompletableFuture> update(DocumentReferenceProvider referenceProvider,
+ public CompletableFuture> addOrUpdate(DocumentReferenceProvider referenceProvider,
DocumentContributor documentContributor,
DocumentCommitStrategy commitStrategy,
DocumentRefreshStrategy refreshStrategy) {
diff --git a/backend/lucene/src/main/java/org/hibernate/search/backend/lucene/work/execution/impl/LuceneIndexIndexingPlan.java b/backend/lucene/src/main/java/org/hibernate/search/backend/lucene/work/execution/impl/LuceneIndexIndexingPlan.java
index 00fe7631602..5b43235a077 100644
--- a/backend/lucene/src/main/java/org/hibernate/search/backend/lucene/work/execution/impl/LuceneIndexIndexingPlan.java
+++ b/backend/lucene/src/main/java/org/hibernate/search/backend/lucene/work/execution/impl/LuceneIndexIndexingPlan.java
@@ -68,7 +68,7 @@ public void add(DocumentReferenceProvider referenceProvider,
}
@Override
- public void update(DocumentReferenceProvider referenceProvider,
+ public void addOrUpdate(DocumentReferenceProvider referenceProvider,
DocumentContributor documentContributor) {
String id = referenceProvider.identifier();
String routingKey = referenceProvider.routingKey();
diff --git a/engine/src/main/java/org/hibernate/search/engine/backend/work/execution/spi/IndexIndexer.java b/engine/src/main/java/org/hibernate/search/engine/backend/work/execution/spi/IndexIndexer.java
index b64315b22d6..0a2ab3f8200 100644
--- a/engine/src/main/java/org/hibernate/search/engine/backend/work/execution/spi/IndexIndexer.java
+++ b/engine/src/main/java/org/hibernate/search/engine/backend/work/execution/spi/IndexIndexer.java
@@ -37,7 +37,7 @@ CompletableFuture> add(DocumentReferenceProvider referenceProvider, DocumentCo
* @param refreshStrategy How to handle the refresh.
* @return A {@link CompletableFuture} that completes once the document is updated.
*/
- CompletableFuture> update(DocumentReferenceProvider referenceProvider, DocumentContributor documentContributor,
+ CompletableFuture> addOrUpdate(DocumentReferenceProvider referenceProvider, DocumentContributor documentContributor,
DocumentCommitStrategy commitStrategy, DocumentRefreshStrategy refreshStrategy);
/**
diff --git a/engine/src/main/java/org/hibernate/search/engine/backend/work/execution/spi/IndexIndexingPlan.java b/engine/src/main/java/org/hibernate/search/engine/backend/work/execution/spi/IndexIndexingPlan.java
index 8a7e6da9a5d..af9f6a8e1f2 100644
--- a/engine/src/main/java/org/hibernate/search/engine/backend/work/execution/spi/IndexIndexingPlan.java
+++ b/engine/src/main/java/org/hibernate/search/engine/backend/work/execution/spi/IndexIndexingPlan.java
@@ -14,7 +14,7 @@
* A set of works to be executed on a single index.
*
* Works are accumulated when methods such as {@link #add(DocumentReferenceProvider, DocumentContributor)}
- * or {@link #update(DocumentReferenceProvider, DocumentContributor)} are called,
+ * or {@link #addOrUpdate(DocumentReferenceProvider, DocumentContributor)} are called,
* and executed only when {@link #execute()} is called.
*
* Relative ordering of works within a plan will be preserved.
@@ -39,7 +39,7 @@ public interface IndexIndexingPlan {
* @param documentReferenceProvider A source of information about the identity of the document to update.
* @param documentContributor A contributor to the document, adding fields to the indexed document.
*/
- void update(DocumentReferenceProvider documentReferenceProvider, DocumentContributor documentContributor);
+ void addOrUpdate(DocumentReferenceProvider documentReferenceProvider, DocumentContributor documentContributor);
/**
* Delete a document from the index.
diff --git a/integrationtest/backend/elasticsearch/src/test/java/org/hibernate/search/integrationtest/backend/elasticsearch/work/ElasticsearchIndexingIT.java b/integrationtest/backend/elasticsearch/src/test/java/org/hibernate/search/integrationtest/backend/elasticsearch/work/ElasticsearchIndexingIT.java
index f94047cb4ec..b3ae5b77d2a 100644
--- a/integrationtest/backend/elasticsearch/src/test/java/org/hibernate/search/integrationtest/backend/elasticsearch/work/ElasticsearchIndexingIT.java
+++ b/integrationtest/backend/elasticsearch/src/test/java/org/hibernate/search/integrationtest/backend/elasticsearch/work/ElasticsearchIndexingIT.java
@@ -102,7 +102,7 @@ public void addUpdateDelete_noRouting() {
plan.execute().join();
clientSpy.verifyExpectationsMet();
- plan.update( referenceProvider( "1" ), document -> {
+ plan.addOrUpdate( referenceProvider( "1" ), document -> {
document.addValue( index.binding().string, "text2" );
} );
clientSpy.expectNext(
@@ -156,7 +156,7 @@ public void addUpdateDelete_routing() {
plan.execute().join();
clientSpy.verifyExpectationsMet();
- plan.update( referenceProvider( "1", routingKey ), document -> {
+ plan.addOrUpdate( referenceProvider( "1", routingKey ), document -> {
document.addValue( index.binding().string, "text2" );
} );
clientSpy.expectNext(
diff --git a/integrationtest/backend/lucene/src/test/java/org/hibernate/search/integrationtest/backend/lucene/work/LuceneIndexingNestedIT.java b/integrationtest/backend/lucene/src/test/java/org/hibernate/search/integrationtest/backend/lucene/work/LuceneIndexingNestedIT.java
index 04d21a00012..7c5d57a0c27 100644
--- a/integrationtest/backend/lucene/src/test/java/org/hibernate/search/integrationtest/backend/lucene/work/LuceneIndexingNestedIT.java
+++ b/integrationtest/backend/lucene/src/test/java/org/hibernate/search/integrationtest/backend/lucene/work/LuceneIndexingNestedIT.java
@@ -57,7 +57,7 @@ public void update_byTerm() throws IOException {
setup( MultiTenancyStrategyName.NONE );
IndexIndexingPlan> plan = index.createIndexingPlan( sessionContext );
- plan.update( referenceProvider( "1" ), document -> {
+ plan.addOrUpdate( referenceProvider( "1" ), document -> {
DocumentElement nested = document.addObject( index.binding().nestedObject.self );
nested.addValue( index.binding().nestedObject.field2, "value" );
} );
@@ -75,7 +75,7 @@ public void update_byQuery() throws IOException {
setup( MultiTenancyStrategyName.DISCRIMINATOR );
IndexIndexingPlan> plan = index.createIndexingPlan( sessionContext );
- plan.update( referenceProvider( "1" ), document -> {
+ plan.addOrUpdate( referenceProvider( "1" ), document -> {
DocumentElement nested = document.addObject( index.binding().nestedObject.self );
nested.addValue( index.binding().nestedObject.field2, "value" );
} );
diff --git a/integrationtest/backend/tck/src/main/java/org/hibernate/search/integrationtest/backend/tck/multitenancy/MultiTenancyBaseIT.java b/integrationtest/backend/tck/src/main/java/org/hibernate/search/integrationtest/backend/tck/multitenancy/MultiTenancyBaseIT.java
index 58337d70137..990920e8421 100644
--- a/integrationtest/backend/tck/src/main/java/org/hibernate/search/integrationtest/backend/tck/multitenancy/MultiTenancyBaseIT.java
+++ b/integrationtest/backend/tck/src/main/java/org/hibernate/search/integrationtest/backend/tck/multitenancy/MultiTenancyBaseIT.java
@@ -222,7 +222,7 @@ public void update_only_updates_elements_of_the_tenant() {
assertThatQuery( checkQuery )
.hasDocRefHitsAnyOrder( index.typeName(), DOCUMENT_ID_1, DOCUMENT_ID_2 );
- plan.update( referenceProvider( DOCUMENT_ID_2 ), document -> {
+ plan.addOrUpdate( referenceProvider( DOCUMENT_ID_2 ), document -> {
document.addValue( index.binding().string, UPDATED_STRING );
document.addValue( index.binding().integer, INTEGER_VALUE_4 );
@@ -355,7 +355,7 @@ public void not_using_multi_tenancy_for_update_while_enabled_throws_exception()
assertThatThrownBy( () -> {
IndexIndexingPlan> plan = index.createIndexingPlan( new StubBackendSessionContext() );
- plan.update( referenceProvider( DOCUMENT_ID_2 ), document -> {
+ plan.addOrUpdate( referenceProvider( DOCUMENT_ID_2 ), document -> {
document.addValue( index.binding().string, UPDATED_STRING );
document.addValue( index.binding().integer, INTEGER_VALUE_4 );
diff --git a/integrationtest/backend/tck/src/main/java/org/hibernate/search/integrationtest/backend/tck/multitenancy/MultiTenancyMismatchIT.java b/integrationtest/backend/tck/src/main/java/org/hibernate/search/integrationtest/backend/tck/multitenancy/MultiTenancyMismatchIT.java
index 61225c1343d..0e0a12ed4e1 100644
--- a/integrationtest/backend/tck/src/main/java/org/hibernate/search/integrationtest/backend/tck/multitenancy/MultiTenancyMismatchIT.java
+++ b/integrationtest/backend/tck/src/main/java/org/hibernate/search/integrationtest/backend/tck/multitenancy/MultiTenancyMismatchIT.java
@@ -74,7 +74,7 @@ public void using_multi_tenancy_for_add_while_disabled_throws_exception() {
assertThatThrownBy( () -> {
IndexIndexingPlan> plan = index.createIndexingPlan( tenant1SessionContext );
- plan.update( referenceProvider( "1" ), document -> { } );
+ plan.addOrUpdate( referenceProvider( "1" ), document -> { } );
plan.execute().join();
} )
.isInstanceOf( SearchException.class )
@@ -90,7 +90,7 @@ public void using_multi_tenancy_for_update_while_disabled_throws_exception() {
assertThatThrownBy( () -> {
IndexIndexingPlan> plan = index.createIndexingPlan( tenant1SessionContext );
- plan.update( referenceProvider( "1" ), document -> { } );
+ plan.addOrUpdate( referenceProvider( "1" ), document -> { } );
plan.execute().join();
} )
.isInstanceOf( SearchException.class )
diff --git a/integrationtest/backend/tck/src/main/java/org/hibernate/search/integrationtest/backend/tck/work/IndexIndexerIT.java b/integrationtest/backend/tck/src/main/java/org/hibernate/search/integrationtest/backend/tck/work/IndexIndexerIT.java
index caeed9f85b4..1b72b10cbbe 100644
--- a/integrationtest/backend/tck/src/main/java/org/hibernate/search/integrationtest/backend/tck/work/IndexIndexerIT.java
+++ b/integrationtest/backend/tck/src/main/java/org/hibernate/search/integrationtest/backend/tck/work/IndexIndexerIT.java
@@ -107,7 +107,7 @@ public void success() {
tasks = new CompletableFuture>[booksToUpdate];
for ( int i = 0; i < booksToUpdate; i++ ) {
final String id = String.valueOf( i );
- tasks[i] = indexer.update(
+ tasks[i] = indexer.addOrUpdate(
referenceProvider( id ),
document -> document.addValue( index.binding().title, "The Boss of the Rings chap. " + id ),
commitStrategy, refreshStrategy
@@ -175,13 +175,13 @@ public void add_failure() {
}
@Test
- public void update_failure() {
+ public void addOrUpdate_failure() {
IndexIndexer indexer = index.createIndexer();
// Trigger failures in the next operations
setupHelper.getBackendAccessor().ensureIndexingOperationsFail( index.name() );
- CompletableFuture> future = indexer.update(
+ CompletableFuture> future = indexer.addOrUpdate(
referenceProvider( "1" ),
document -> document.addValue( index.binding().title, "Document #1" ),
commitStrategy, refreshStrategy
diff --git a/integrationtest/backend/tck/src/main/java/org/hibernate/search/integrationtest/backend/tck/work/IndexIndexingPlanIT.java b/integrationtest/backend/tck/src/main/java/org/hibernate/search/integrationtest/backend/tck/work/IndexIndexingPlanIT.java
index d711dcbb969..448fff4d72e 100644
--- a/integrationtest/backend/tck/src/main/java/org/hibernate/search/integrationtest/backend/tck/work/IndexIndexingPlanIT.java
+++ b/integrationtest/backend/tck/src/main/java/org/hibernate/search/integrationtest/backend/tck/work/IndexIndexingPlanIT.java
@@ -99,7 +99,7 @@ public void success() {
.hasDocRefHitsAnyOrder( index.typeName(), "1", "2", "3" );
// Update
- plan.update( referenceProvider( "2" ), document -> document.addValue( index.binding().title, "The Boss of the Rings chap. 2" ) );
+ plan.addOrUpdate( referenceProvider( "2" ), document -> document.addValue( index.binding().title, "The Boss of the Rings chap. 2" ) );
future = plan.execute();
Awaitility.await().until( future::isDone );
// The operations should succeed.
@@ -167,12 +167,12 @@ public void add_failure() {
}
@Test
- public void update_failure() {
+ public void addOrUpdate_failure() {
setup();
IndexIndexingPlan> plan = index.createIndexingPlan( sessionContext );
- plan.update( referenceProvider( "1" ), document -> document.addValue( index.binding().title, "Title of Book 1" ) );
- plan.update( referenceProvider( "2" ), document -> document.addValue( index.binding().title, "Title of Book 2" ) );
+ plan.addOrUpdate( referenceProvider( "1" ), document -> document.addValue( index.binding().title, "Title of Book 1" ) );
+ plan.addOrUpdate( referenceProvider( "2" ), document -> document.addValue( index.binding().title, "Title of Book 2" ) );
// Trigger failures in the next operations
setupHelper.getBackendAccessor().ensureIndexingOperationsFail( index.name() );
diff --git a/integrationtest/mapper/orm-envers/src/test/java/org/hibernate/search/integrationtest/mapper/orm/envers/EnversIT.java b/integrationtest/mapper/orm-envers/src/test/java/org/hibernate/search/integrationtest/mapper/orm/envers/EnversIT.java
index 7b1ae266270..2257126b6ba 100644
--- a/integrationtest/mapper/orm-envers/src/test/java/org/hibernate/search/integrationtest/mapper/orm/envers/EnversIT.java
+++ b/integrationtest/mapper/orm-envers/src/test/java/org/hibernate/search/integrationtest/mapper/orm/envers/EnversIT.java
@@ -107,7 +107,7 @@ public void test() {
indexed.setText( "updated" );
backendMock.expectWorks( IndexedEntity.NAME )
- .update( "1", b -> b
+ .addOrUpdate( "1", b -> b
.field( "text", "updated" )
.objectField( "contained", b2 -> b2
.field( "text", "initial" )
@@ -128,7 +128,7 @@ public void test() {
contained.setText( "updated" );
backendMock.expectWorks( IndexedEntity.NAME )
- .update( "1", b -> b
+ .addOrUpdate( "1", b -> b
.field( "text", "updated" )
.objectField( "contained", b2 -> b2
.field( "text", "updated" )
diff --git a/integrationtest/mapper/orm-spring/src/test/java/org/hibernate/search/integrationtest/spring/jta/JtaAndSpringMoreComplexIT.java b/integrationtest/mapper/orm-spring/src/test/java/org/hibernate/search/integrationtest/spring/jta/JtaAndSpringMoreComplexIT.java
index 26b4d361399..a55450ce5b8 100644
--- a/integrationtest/mapper/orm-spring/src/test/java/org/hibernate/search/integrationtest/spring/jta/JtaAndSpringMoreComplexIT.java
+++ b/integrationtest/mapper/orm-spring/src/test/java/org/hibernate/search/integrationtest/spring/jta/JtaAndSpringMoreComplexIT.java
@@ -80,7 +80,7 @@ public void testMuffins() {
box.addMuffin( muffin );
backendMock.expectWorks( "Box" )
- .update( "1", b -> b
+ .addOrUpdate( "1", b -> b
.field( "color", "red-and-white" )
.objectField( "muffinSet", b2 -> b2
.field( "kind", "blueberry" ) ) )
@@ -90,7 +90,7 @@ public void testMuffins() {
// Test lazy-loading a set of muffins
backendMock.expectWorks( "Box" )
- .update( "1", b -> b
+ .addOrUpdate( "1", b -> b
.field( "color", "blue" )
.objectField( "muffinSet", b2 -> b2
.field( "kind", "blueberry" ) ) )
@@ -123,7 +123,7 @@ public void testDoughnuts() {
.add( "2", b -> b.field( "kind", "glazed" ) )
.processedThenExecuted();
backendMock.expectWorks( "Box" )
- .update( "2", b -> b
+ .addOrUpdate( "2", b -> b
.field( "color", "red-and-white" )
.objectField( "doughnutSet", b2 -> b2
.field( "kind", "glazed" ) ) )
@@ -133,7 +133,7 @@ public void testDoughnuts() {
// Test lazy-loading a set of doughnuts
backendMock.expectWorks( "Box" )
- .update( "2", b -> b
+ .addOrUpdate( "2", b -> b
.field( "color", "blue" )
.objectField( "doughnutSet", b2 -> b2
.field( "kind", "glazed" ) ) )
diff --git a/integrationtest/mapper/orm/src/test/java/org/hibernate/search/integrationtest/mapper/orm/automaticindexing/AbstractAutomaticIndexingBridgeIT.java b/integrationtest/mapper/orm/src/test/java/org/hibernate/search/integrationtest/mapper/orm/automaticindexing/AbstractAutomaticIndexingBridgeIT.java
index e82a08ee3fe..caf0e234c01 100644
--- a/integrationtest/mapper/orm/src/test/java/org/hibernate/search/integrationtest/mapper/orm/automaticindexing/AbstractAutomaticIndexingBridgeIT.java
+++ b/integrationtest/mapper/orm/src/test/java/org/hibernate/search/integrationtest/mapper/orm/automaticindexing/AbstractAutomaticIndexingBridgeIT.java
@@ -76,7 +76,7 @@ public void directPersistUpdateDelete() {
entity1.setDirectField( "updatedValue" );
backendMock.expectWorks( IndexedEntity.INDEX )
- .update( "1", b -> b
+ .addOrUpdate( "1", b -> b
.objectField( "typeBridge", b2 -> b2
.field( "directField", entity1.getDirectField() )
.objectField( "child", b3 -> b3
@@ -148,7 +148,7 @@ public void indirectAssociationUpdate_typeBridge() {
session.persist( containedEntity );
backendMock.expectWorks( IndexedEntity.INDEX )
- .update( "1", b -> b
+ .addOrUpdate( "1", b -> b
.objectField( "typeBridge", b2 -> b2
.field( "directField", null )
.objectField( "child", b3 -> b3
@@ -174,7 +174,7 @@ public void indirectAssociationUpdate_typeBridge() {
session.persist( containedEntity );
backendMock.expectWorks( IndexedEntity.INDEX )
- .update( "1", b -> b
+ .addOrUpdate( "1", b -> b
.objectField( "typeBridge", b2 -> b2
.field( "directField", null )
.objectField( "child", b3 -> b3
@@ -209,7 +209,7 @@ public void indirectAssociationUpdate_typeBridge() {
containingEntity1.setContainedSingle( null );
backendMock.expectWorks( IndexedEntity.INDEX )
- .update( "1", b -> b
+ .addOrUpdate( "1", b -> b
.objectField( "typeBridge", b2 -> b2
.field( "directField", null )
.objectField( "child", b3 -> b3
@@ -277,7 +277,7 @@ public void indirectValueUpdate_typeBridge() {
containedEntity.setIncludedInTypeBridge( "updatedValue" );
backendMock.expectWorks( IndexedEntity.INDEX )
- .update( "1", b -> b
+ .addOrUpdate( "1", b -> b
.objectField( "typeBridge", b2 -> b2
.field( "directField", null )
.objectField( "child", b3 -> b3
@@ -353,7 +353,7 @@ public void indirectAssociationUpdate_singleValuedPropertyBridge() {
session.persist( containedEntity );
backendMock.expectWorks( IndexedEntity.INDEX )
- .update( "1", b -> b
+ .addOrUpdate( "1", b -> b
.objectField( "singleValuedPropertyBridge", b2 -> b2
.field( "includedInSingleValuedPropertyBridge", "initialValue" )
)
@@ -376,7 +376,7 @@ public void indirectAssociationUpdate_singleValuedPropertyBridge() {
session.persist( containedEntity );
backendMock.expectWorks( IndexedEntity.INDEX )
- .update( "1", b -> b
+ .addOrUpdate( "1", b -> b
.objectField( "singleValuedPropertyBridge", b2 -> b2
.field( "includedInSingleValuedPropertyBridge", "updatedValue" )
)
@@ -408,7 +408,7 @@ public void indirectAssociationUpdate_singleValuedPropertyBridge() {
containingEntity1.setContainedSingle( null );
backendMock.expectWorks( IndexedEntity.INDEX )
- .update( "1", b -> b
+ .addOrUpdate( "1", b -> b
.objectField( "singleValuedPropertyBridge", b2 -> b2
.field( "includedInSingleValuedPropertyBridge", null )
)
@@ -471,7 +471,7 @@ public void indirectValueUpdate_singleValuedPropertyBridge() {
containedEntity.setIncludedInSingleValuedPropertyBridge( "updatedValue" );
backendMock.expectWorks( IndexedEntity.INDEX )
- .update( "1", b -> b
+ .addOrUpdate( "1", b -> b
.objectField( "singleValuedPropertyBridge", b2 -> b2
.field( "includedInSingleValuedPropertyBridge", "updatedValue" )
)
@@ -539,7 +539,7 @@ public void directAssociationUpdate_multiValuedPropertyBridge() {
session.persist( containedEntity );
backendMock.expectWorks( IndexedEntity.INDEX )
- .update( "1", b -> b
+ .addOrUpdate( "1", b -> b
.objectField( "multiValuedPropertyBridge", b2 -> b2
.field( "includedInMultiValuedPropertyBridge", "value1" )
)
@@ -567,7 +567,7 @@ public void directAssociationUpdate_multiValuedPropertyBridge() {
session.persist( containedEntity );
backendMock.expectWorks( IndexedEntity.INDEX )
- .update( "1", b -> b
+ .addOrUpdate( "1", b -> b
.objectField( "multiValuedPropertyBridge", b2 -> b2
.field( "includedInMultiValuedPropertyBridge", "value1 value2" )
)
@@ -599,7 +599,7 @@ public void directAssociationUpdate_multiValuedPropertyBridge() {
session.persist( containedEntity );
backendMock.expectWorks( IndexedEntity.INDEX )
- .update( "1", b -> b
+ .addOrUpdate( "1", b -> b
.objectField( "multiValuedPropertyBridge", b2 -> b2
.field( "includedInMultiValuedPropertyBridge", "updatedValue" )
)
@@ -617,7 +617,7 @@ public void directAssociationUpdate_multiValuedPropertyBridge() {
entity1.getAssociation2().clear();
backendMock.expectWorks( IndexedEntity.INDEX )
- .update( "1", b -> b
+ .addOrUpdate( "1", b -> b
.objectField( "multiValuedPropertyBridge", b2 -> b2
.field( "includedInMultiValuedPropertyBridge", null )
)
diff --git a/integrationtest/mapper/orm/src/test/java/org/hibernate/search/integrationtest/mapper/orm/automaticindexing/AutomaticIndexingBasicIT.java b/integrationtest/mapper/orm/src/test/java/org/hibernate/search/integrationtest/mapper/orm/automaticindexing/AutomaticIndexingBasicIT.java
index ab5f046f321..83799870457 100644
--- a/integrationtest/mapper/orm/src/test/java/org/hibernate/search/integrationtest/mapper/orm/automaticindexing/AutomaticIndexingBasicIT.java
+++ b/integrationtest/mapper/orm/src/test/java/org/hibernate/search/integrationtest/mapper/orm/automaticindexing/AutomaticIndexingBasicIT.java
@@ -84,7 +84,7 @@ public void directPersistUpdateDelete() {
entity1.setIndexedField( "updatedValue" );
backendMock.expectWorks( IndexedEntity.INDEX )
- .update( "1", b -> b
+ .addOrUpdate( "1", b -> b
.field( "indexedField", entity1.getIndexedField() )
.field( "shallowReindexOnUpdateField", null )
.field( "noReindexOnUpdateField", null )
@@ -212,7 +212,7 @@ public void directValueUpdate_shallowReindexOnUpdateField() {
entity1.setShallowReindexOnUpdateField( "updatedValue" );
backendMock.expectWorks( IndexedEntity.INDEX )
- .update( "1", b -> b
+ .addOrUpdate( "1", b -> b
.field( "indexedField", null )
.field( "shallowReindexOnUpdateField", entity1.getShallowReindexOnUpdateField() )
.field( "noReindexOnUpdateField", null )
@@ -226,7 +226,7 @@ public void directValueUpdate_shallowReindexOnUpdateField() {
entity1.setShallowReindexOnUpdateField( null );
backendMock.expectWorks( IndexedEntity.INDEX )
- .update( "1", b -> b
+ .addOrUpdate( "1", b -> b
.field( "indexedField", null )
.field( "shallowReindexOnUpdateField", null )
.field( "noReindexOnUpdateField", null )
@@ -398,7 +398,7 @@ public void sessionUpdate_directValueUpdate_indexedField() {
// Hibernate ORM does not track dirtiness on merges: we assume everything is dirty.
backendMock.expectWorks( IndexedEntity.INDEX )
- .update( "1", b -> b
+ .addOrUpdate( "1", b -> b
.field( "indexedField", entity1.getIndexedField() )
.field( "shallowReindexOnUpdateField", null )
.field( "noReindexOnUpdateField", null )
@@ -441,7 +441,7 @@ public void sessionUpdate_directValueUpdate_nonIndexedField() {
// Hibernate ORM does not track dirtiness on calls to update(): we assume everything is dirty.
backendMock.expectWorks( IndexedEntity.INDEX )
- .update( "1", b -> b
+ .addOrUpdate( "1", b -> b
.field( "indexedField", entity1.getIndexedField() )
.field( "shallowReindexOnUpdateField", null )
.field( "noReindexOnUpdateField", null )
diff --git a/integrationtest/mapper/orm/src/test/java/org/hibernate/search/integrationtest/mapper/orm/automaticindexing/AutomaticIndexingConcurrentModificationInDifferentTypeIT.java b/integrationtest/mapper/orm/src/test/java/org/hibernate/search/integrationtest/mapper/orm/automaticindexing/AutomaticIndexingConcurrentModificationInDifferentTypeIT.java
index dbdb843eace..41b92aad900 100644
--- a/integrationtest/mapper/orm/src/test/java/org/hibernate/search/integrationtest/mapper/orm/automaticindexing/AutomaticIndexingConcurrentModificationInDifferentTypeIT.java
+++ b/integrationtest/mapper/orm/src/test/java/org/hibernate/search/integrationtest/mapper/orm/automaticindexing/AutomaticIndexingConcurrentModificationInDifferentTypeIT.java
@@ -102,7 +102,7 @@ public void updateTriggeringReindexingOfPreviouslyUnknownEntityType() {
backendMock.expectWorksAnyOrder(
ParentEntity.NAME, DocumentCommitStrategy.FORCE, DocumentRefreshStrategy.NONE
)
- .update( entity2.getId().toString(), b -> b
+ .addOrUpdate( entity2.getId().toString(), b -> b
.field( "name", entity2.getName() )
.objectField( "child", b2 -> b2
.field( "name", entity1.getName() )
@@ -112,14 +112,14 @@ public void updateTriggeringReindexingOfPreviouslyUnknownEntityType() {
backendMock.expectWorksAnyOrder(
ChildEntity.NAME, DocumentCommitStrategy.FORCE, DocumentRefreshStrategy.NONE
)
- .update( entity1.getId().toString(), b -> b
+ .addOrUpdate( entity1.getId().toString(), b -> b
.field( "name", entity1.getName() )
)
.processedThenExecuted();
backendMock.expectWorksAnyOrder(
OtherEntity.NAME, DocumentCommitStrategy.FORCE, DocumentRefreshStrategy.NONE
)
- .update( entity3.getId().toString(), b -> b
+ .addOrUpdate( entity3.getId().toString(), b -> b
.field( "name", entity3.getName() )
)
.processedThenExecuted();
diff --git a/integrationtest/mapper/orm/src/test/java/org/hibernate/search/integrationtest/mapper/orm/automaticindexing/AutomaticIndexingConcurrentModificationInSameTypeIT.java b/integrationtest/mapper/orm/src/test/java/org/hibernate/search/integrationtest/mapper/orm/automaticindexing/AutomaticIndexingConcurrentModificationInSameTypeIT.java
index 18be75c2f93..fd093c39759 100644
--- a/integrationtest/mapper/orm/src/test/java/org/hibernate/search/integrationtest/mapper/orm/automaticindexing/AutomaticIndexingConcurrentModificationInSameTypeIT.java
+++ b/integrationtest/mapper/orm/src/test/java/org/hibernate/search/integrationtest/mapper/orm/automaticindexing/AutomaticIndexingConcurrentModificationInSameTypeIT.java
@@ -98,11 +98,11 @@ public void updateTriggeringReindexingOfPreviouslyUnknownEntity() {
backendMock.expectWorksAnyOrder(
IndexedEntity.INDEX, DocumentCommitStrategy.FORCE, DocumentRefreshStrategy.NONE )
- .update( entity1.getId().toString(), b -> b
+ .addOrUpdate( entity1.getId().toString(), b -> b
.field( "name", entity1.getName() )
.field( "firstName", entity1.getFirstName() )
)
- .update( entity2.getId().toString(), b -> b
+ .addOrUpdate( entity2.getId().toString(), b -> b
.field( "name", entity2.getName() )
.field( "firstName", entity2.getFirstName() )
.objectField( "child", b2 -> b2
@@ -110,7 +110,7 @@ public void updateTriggeringReindexingOfPreviouslyUnknownEntity() {
.field( "name", entity1.getName() )
)
)
- .update( entity3.getId().toString(), b -> b
+ .addOrUpdate( entity3.getId().toString(), b -> b
.field( "name", entity3.getName() )
.field( "firstName", entity3.getFirstName() )
)
diff --git a/integrationtest/mapper/orm/src/test/java/org/hibernate/search/integrationtest/mapper/orm/automaticindexing/AutomaticIndexingElementCollectionIT.java b/integrationtest/mapper/orm/src/test/java/org/hibernate/search/integrationtest/mapper/orm/automaticindexing/AutomaticIndexingElementCollectionIT.java
index 33da18fbaaf..b4d57776b3a 100644
--- a/integrationtest/mapper/orm/src/test/java/org/hibernate/search/integrationtest/mapper/orm/automaticindexing/AutomaticIndexingElementCollectionIT.java
+++ b/integrationtest/mapper/orm/src/test/java/org/hibernate/search/integrationtest/mapper/orm/automaticindexing/AutomaticIndexingElementCollectionIT.java
@@ -82,7 +82,7 @@ public void directValueUpdate_indexedElementCollectionField() {
entity1.getIndexedElementCollectionField().add( "secondValue" );
backendMock.expectWorks( IndexedEntity.INDEX )
- .update( "1", b -> b
+ .addOrUpdate( "1", b -> b
.field(
"indexedElementCollectionField",
entity1.getIndexedElementCollectionField().get( 0 ),
@@ -99,7 +99,7 @@ public void directValueUpdate_indexedElementCollectionField() {
entity1.getIndexedElementCollectionField().remove( 1 );
backendMock.expectWorks( IndexedEntity.INDEX )
- .update( "1", b -> b
+ .addOrUpdate( "1", b -> b
.field(
"indexedElementCollectionField",
entity1.getIndexedElementCollectionField().get( 0 )
@@ -145,7 +145,7 @@ public void directValueReplace_indexedElementCollectionField() {
) ) );
backendMock.expectWorks( IndexedEntity.INDEX )
- .update( "1", b -> b
+ .addOrUpdate( "1", b -> b
.field(
"indexedElementCollectionField",
entity1.getIndexedElementCollectionField().get( 0 ),
@@ -227,7 +227,7 @@ public void directValueReplace_nonIndexedElementCollectionField() {
// TODO HSEARCH-3204: remove the statement below to not expect any work
backendMock.expectWorks( IndexedEntity.INDEX )
- .update( "1", b -> { } )
+ .addOrUpdate( "1", b -> { } )
.processedThenExecuted();
} );
backendMock.verifyExpectationsMet();
@@ -264,7 +264,7 @@ public void directValueUpdate_shallowReindexOnUpdateElementCollectionField() {
entity1.getShallowReindexOnUpdateElementCollectionField().add( "secondValue" );
backendMock.expectWorks( IndexedEntity.INDEX )
- .update( "1", b -> b
+ .addOrUpdate( "1", b -> b
.field( "shallowReindexOnUpdateElementCollectionField",
"firstValue", "secondValue" )
)
@@ -278,7 +278,7 @@ public void directValueUpdate_shallowReindexOnUpdateElementCollectionField() {
entity1.getShallowReindexOnUpdateElementCollectionField().remove( 1 );
backendMock.expectWorks( IndexedEntity.INDEX )
- .update( "1", b -> b
+ .addOrUpdate( "1", b -> b
.field( "shallowReindexOnUpdateElementCollectionField", "firstValue" )
)
.processedThenExecuted();
@@ -321,7 +321,7 @@ public void directValueReplace_shallowReindexOnUpdateElementCollectionField() {
) ) );
backendMock.expectWorks( IndexedEntity.INDEX )
- .update( "1", b -> b
+ .addOrUpdate( "1", b -> b
.field( "shallowReindexOnUpdateElementCollectionField",
"newFirstValue", "newSecondValue" )
)
@@ -404,7 +404,7 @@ public void directValueReplace_noReindexOnUpdateElementCollectionField() {
// TODO HSEARCH-3204: remove the statement below to not expect any work
backendMock.expectWorks( IndexedEntity.INDEX )
- .update( "1", b -> b
+ .addOrUpdate( "1", b -> b
.field(
"noReindexOnUpdateElementCollectionField",
"newFirstValue", "newSecondValue"
diff --git a/integrationtest/mapper/orm/src/test/java/org/hibernate/search/integrationtest/mapper/orm/automaticindexing/AutomaticIndexingEmbeddableIT.java b/integrationtest/mapper/orm/src/test/java/org/hibernate/search/integrationtest/mapper/orm/automaticindexing/AutomaticIndexingEmbeddableIT.java
index 9155cf0c348..4433975d03e 100644
--- a/integrationtest/mapper/orm/src/test/java/org/hibernate/search/integrationtest/mapper/orm/automaticindexing/AutomaticIndexingEmbeddableIT.java
+++ b/integrationtest/mapper/orm/src/test/java/org/hibernate/search/integrationtest/mapper/orm/automaticindexing/AutomaticIndexingEmbeddableIT.java
@@ -133,7 +133,7 @@ public void indirectEmbeddedUpdate_embeddedSingle() {
session.persist( containedEntity );
backendMock.expectWorks( IndexedEntity.INDEX )
- .update( "1", b -> b
+ .addOrUpdate( "1", b -> b
.objectField( "child", b2 -> b2
.objectField( "containedEmbeddedSingle", b3 -> b3
.objectField( "containedSingle", b4 -> b4
@@ -162,7 +162,7 @@ public void indirectEmbeddedUpdate_embeddedSingle() {
session.persist( containedEntity );
backendMock.expectWorks( IndexedEntity.INDEX )
- .update( "1", b -> b
+ .addOrUpdate( "1", b -> b
.objectField( "child", b2 -> b2
.objectField( "containedEmbeddedSingle", b3 -> b3
.objectField( "containedSingle", b4 -> b4
@@ -184,7 +184,7 @@ public void indirectEmbeddedUpdate_embeddedSingle() {
containingEntity1.setContainedEmbeddedSingle( null );
backendMock.expectWorks( IndexedEntity.INDEX )
- .update( "1", b -> b
+ .addOrUpdate( "1", b -> b
.objectField( "child", b2 -> b2
.objectField( "containedEmbeddedList", b3 -> { } )
.objectField( "containedBidirectionalEmbedded", b3 -> { } )
@@ -246,7 +246,7 @@ public void indirectAssociationUpdate_embeddedSingle() {
session.persist( containedEntity );
backendMock.expectWorks( IndexedEntity.INDEX )
- .update( "1", b -> b
+ .addOrUpdate( "1", b -> b
.objectField( "child", b2 -> b2
.objectField( "containedEmbeddedSingle", b3 -> b3
.objectField( "containedSingle", b4 -> b4
@@ -268,7 +268,7 @@ public void indirectAssociationUpdate_embeddedSingle() {
containingEntity1.getContainedEmbeddedSingle().setContainedSingle( null );
backendMock.expectWorks( IndexedEntity.INDEX )
- .update( "1", b -> b
+ .addOrUpdate( "1", b -> b
.objectField( "child", b2 -> b2
.objectField( "containedEmbeddedSingle", b3 -> { } )
.objectField( "containedEmbeddedList", b3 -> { } )
@@ -323,7 +323,7 @@ public void indirectValueUpdate_embeddedSingle() {
containedEntity.setIncludedInEmbeddedSingle( "updatedValue" );
backendMock.expectWorks( IndexedEntity.INDEX )
- .update( "1", b -> b
+ .addOrUpdate( "1", b -> b
.objectField( "child", b2 -> b2
.objectField( "containedEmbeddedSingle", b3 -> b3
.objectField( "containedSingle", b4 -> b4
@@ -387,7 +387,7 @@ public void indirectEmbeddedUpdate_embeddedList() {
session.persist( containedEntity );
backendMock.expectWorks( IndexedEntity.INDEX )
- .update( "1", b -> b
+ .addOrUpdate( "1", b -> b
.objectField( "child", b2 -> b2
.objectField( "containedEmbeddedSingle", b3 -> { } )
.objectField( "containedEmbeddedList", b3 -> b3
@@ -416,7 +416,7 @@ public void indirectEmbeddedUpdate_embeddedList() {
session.persist( containedEntity );
backendMock.expectWorks( IndexedEntity.INDEX )
- .update( "1", b -> b
+ .addOrUpdate( "1", b -> b
.objectField( "child", b2 -> b2
.objectField( "containedEmbeddedSingle", b3 -> { } )
.objectField( "containedEmbeddedList", b3 -> b3
@@ -438,7 +438,7 @@ public void indirectEmbeddedUpdate_embeddedList() {
containingEntity1.setContainedEmbeddedList( null );
backendMock.expectWorks( IndexedEntity.INDEX )
- .update( "1", b -> b
+ .addOrUpdate( "1", b -> b
.objectField( "child", b2 -> b2
.objectField( "containedEmbeddedSingle", b3 -> { } )
.objectField( "containedBidirectionalEmbedded", b3 -> { } )
@@ -488,7 +488,7 @@ public void indirectAssociationUpdate_embeddedList() {
session.persist( containedEntity );
backendMock.expectWorks( IndexedEntity.INDEX )
- .update( "1", b -> b
+ .addOrUpdate( "1", b -> b
.objectField( "child", b2 -> b2
.objectField( "containedEmbeddedSingle", b3 -> { } )
.objectField( "containedEmbeddedList", b3 -> b3
@@ -516,7 +516,7 @@ public void indirectAssociationUpdate_embeddedList() {
session.persist( containedEntity );
backendMock.expectWorks( IndexedEntity.INDEX )
- .update( "1", b -> b
+ .addOrUpdate( "1", b -> b
.objectField( "child", b2 -> b2
.objectField( "containedEmbeddedSingle", b3 -> { } )
.objectField( "containedEmbeddedList", b3 -> b3
@@ -542,7 +542,7 @@ public void indirectAssociationUpdate_embeddedList() {
containingEntity1.getContainedEmbeddedList().getContainedList().remove( containedEntity );
backendMock.expectWorks( IndexedEntity.INDEX )
- .update( "1", b -> b
+ .addOrUpdate( "1", b -> b
.objectField( "child", b2 -> b2
.objectField( "containedEmbeddedSingle", b3 -> { } )
.objectField( "containedEmbeddedList", b3 -> b3
@@ -601,7 +601,7 @@ public void indirectValueUpdate_embeddedList() {
containedEntity.setIncludedInEmbeddedList( "updatedValue" );
backendMock.expectWorks( IndexedEntity.INDEX )
- .update( "1", b -> b
+ .addOrUpdate( "1", b -> b
.objectField( "child", b2 -> b2
.objectField( "containedEmbeddedSingle", b3 -> { } )
.objectField( "containedEmbeddedList", b3 -> b3
@@ -665,7 +665,7 @@ public void indirectEmbeddedUpdate_elementCollection() {
session.persist( containedEntity );
backendMock.expectWorks( IndexedEntity.INDEX )
- .update( "1", b -> b
+ .addOrUpdate( "1", b -> b
.objectField( "child", b2 -> b2
.objectField( "containedEmbeddedSingle", b3 -> { } )
.objectField( "containedEmbeddedList", b3 -> { } )
@@ -694,7 +694,7 @@ public void indirectEmbeddedUpdate_elementCollection() {
session.persist( containedEntity );
backendMock.expectWorks( IndexedEntity.INDEX )
- .update( "1", b -> b
+ .addOrUpdate( "1", b -> b
.objectField( "child", b2 -> b2
.objectField( "containedEmbeddedSingle", b3 -> { } )
.objectField( "containedEmbeddedList", b3 -> { } )
@@ -723,7 +723,7 @@ public void indirectEmbeddedUpdate_elementCollection() {
containingEntity1.getContainedElementCollection().remove( embeddable );
backendMock.expectWorks( IndexedEntity.INDEX )
- .update( "1", b -> b
+ .addOrUpdate( "1", b -> b
.objectField( "child", b2 -> b2
.objectField( "containedEmbeddedSingle", b3 -> { } )
.objectField( "containedEmbeddedList", b3 -> { } )
@@ -787,7 +787,7 @@ public void indirectAssociationUpdate_elementCollection() {
session.persist( containedEntity );
backendMock.expectWorks( IndexedEntity.INDEX )
- .update( "1", b -> b
+ .addOrUpdate( "1", b -> b
.objectField( "child", b2 -> b2
.objectField( "containedEmbeddedSingle", b3 -> { } )
.objectField( "containedEmbeddedList", b3 -> { } )
@@ -818,7 +818,7 @@ public void indirectAssociationUpdate_elementCollection() {
session.persist( containedEntity );
backendMock.expectWorks( IndexedEntity.INDEX )
- .update( "1", b -> b
+ .addOrUpdate( "1", b -> b
.objectField( "child", b2 -> b2
.objectField( "containedEmbeddedSingle", b3 -> { } )
.objectField( "containedEmbeddedList", b3 -> { } )
@@ -842,7 +842,7 @@ public void indirectAssociationUpdate_elementCollection() {
embeddable.setContainedSingle( null );
backendMock.expectWorks( IndexedEntity.INDEX )
- .update( "1", b -> b
+ .addOrUpdate( "1", b -> b
.objectField( "child", b2 -> b2
.objectField( "containedEmbeddedSingle", b3 -> { } )
.objectField( "containedEmbeddedList", b3 -> { } )
@@ -899,7 +899,7 @@ public void indirectValueUpdate_elementCollection() {
containedEntity.setIncludedInElementCollection( "updatedValue" );
backendMock.expectWorks( IndexedEntity.INDEX )
- .update( "1", b -> b
+ .addOrUpdate( "1", b -> b
.objectField( "child", b2 -> b2
.objectField( "containedEmbeddedSingle", b3 -> { } )
.objectField( "containedEmbeddedList", b3 -> { } )
@@ -976,7 +976,7 @@ public void indirectAssociationUpdate_inverseSideEmbedded() {
session.persist( containedEntity );
backendMock.expectWorks( IndexedEntity.INDEX )
- .update( "1", b -> b
+ .addOrUpdate( "1", b -> b
.objectField( "child", b2 -> b2
.objectField( "containedEmbeddedSingle", b3 -> { } )
.objectField( "containedEmbeddedList", b3 -> { } )
@@ -998,7 +998,7 @@ public void indirectAssociationUpdate_inverseSideEmbedded() {
containingEntity1.setContainedSingleWithInverseSideEmbedded( null );
backendMock.expectWorks( IndexedEntity.INDEX )
- .update( "1", b -> b
+ .addOrUpdate( "1", b -> b
.objectField( "child", b2 -> b2
.objectField( "containedEmbeddedSingle", b3 -> { } )
.objectField( "containedEmbeddedList", b3 -> { } )
@@ -1052,7 +1052,7 @@ public void indirectValueUpdate_inverseSideEmbedded() {
containedEntity.setIncludedInContainedSingleWithInverseSideEmbedded( "updatedValue" );
backendMock.expectWorks( IndexedEntity.INDEX )
- .update( "1", b -> b
+ .addOrUpdate( "1", b -> b
.objectField( "child", b2 -> b2
.objectField( "containedEmbeddedSingle", b3 -> { } )
.objectField( "containedEmbeddedList", b3 -> { } )
@@ -1115,7 +1115,7 @@ public void indirectEmbeddedUpdate_bidirectionalEmbedded() {
session.persist( containedEntity );
backendMock.expectWorks( IndexedEntity.INDEX )
- .update( "1", b -> b
+ .addOrUpdate( "1", b -> b
.objectField( "child", b2 -> b2
.objectField( "containedEmbeddedSingle", b3 -> { } )
.objectField( "containedEmbeddedList", b3 -> { } )
@@ -1145,7 +1145,7 @@ public void indirectEmbeddedUpdate_bidirectionalEmbedded() {
session.persist( containedEntity );
backendMock.expectWorks( IndexedEntity.INDEX )
- .update( "1", b -> b
+ .addOrUpdate( "1", b -> b
.objectField( "child", b2 -> b2
.objectField( "containedEmbeddedSingle", b3 -> { } )
.objectField( "containedEmbeddedList", b3 -> { } )
@@ -1168,7 +1168,7 @@ public void indirectEmbeddedUpdate_bidirectionalEmbedded() {
containingEntity1.setContainedBidirectionalEmbedded( null );
backendMock.expectWorks( IndexedEntity.INDEX )
- .update( "1", b -> b
+ .addOrUpdate( "1", b -> b
.objectField( "child", b2 -> b2
.objectField( "containedEmbeddedSingle", b3 -> { } )
.objectField( "containedEmbeddedList", b3 -> { } )
@@ -1231,7 +1231,7 @@ public void indirectAssociationUpdate_bidirectionalEmbedded() {
session.persist( containedEntity );
backendMock.expectWorks( IndexedEntity.INDEX )
- .update( "1", b -> b
+ .addOrUpdate( "1", b -> b
.objectField( "child", b2 -> b2
.objectField( "containedEmbeddedSingle", b3 -> { } )
.objectField( "containedEmbeddedList", b3 -> { } )
@@ -1254,7 +1254,7 @@ public void indirectAssociationUpdate_bidirectionalEmbedded() {
containingEntity1.getContainedBidirectionalEmbedded().setContainedSingle( null );
backendMock.expectWorks( IndexedEntity.INDEX )
- .update( "1", b -> b
+ .addOrUpdate( "1", b -> b
.objectField( "child", b2 -> b2
.objectField( "containedEmbeddedSingle", b3 -> { } )
.objectField( "containedEmbeddedList", b3 -> { } )
@@ -1309,7 +1309,7 @@ public void indirectValueUpdate_bidirectionalEmbedded() {
containedEntity.setIncludedInBidirectionalEmbedded( "updatedValue" );
backendMock.expectWorks( IndexedEntity.INDEX )
- .update( "1", b -> b
+ .addOrUpdate( "1", b -> b
.objectField( "child", b2 -> b2
.objectField( "containedEmbeddedSingle", b3 -> { } )
.objectField( "containedEmbeddedList", b3 -> { } )
diff --git a/integrationtest/mapper/orm/src/test/java/org/hibernate/search/integrationtest/mapper/orm/automaticindexing/AutomaticIndexingMappedSuperclassIT.java b/integrationtest/mapper/orm/src/test/java/org/hibernate/search/integrationtest/mapper/orm/automaticindexing/AutomaticIndexingMappedSuperclassIT.java
index 3964f2263cb..dca8fb4c525 100644
--- a/integrationtest/mapper/orm/src/test/java/org/hibernate/search/integrationtest/mapper/orm/automaticindexing/AutomaticIndexingMappedSuperclassIT.java
+++ b/integrationtest/mapper/orm/src/test/java/org/hibernate/search/integrationtest/mapper/orm/automaticindexing/AutomaticIndexingMappedSuperclassIT.java
@@ -97,7 +97,7 @@ public void inversePathHandlesMappedSuperclassDefinedAssociations() {
containedEntity.setIncludedInSingle( "updatedValue" );
backendMock.expectWorks( IndexedEntity.INDEX )
- .update( "1", b -> b
+ .addOrUpdate( "1", b -> b
.objectField( "containedSingle", b3 -> b3
.field( "includedInSingle", "updatedValue" )
)
diff --git a/integrationtest/mapper/orm/src/test/java/org/hibernate/search/integrationtest/mapper/orm/automaticindexing/AutomaticIndexingNonEntityIdDocumentIdIT.java b/integrationtest/mapper/orm/src/test/java/org/hibernate/search/integrationtest/mapper/orm/automaticindexing/AutomaticIndexingNonEntityIdDocumentIdIT.java
index 1228a3984c2..b9a0e4b4544 100644
--- a/integrationtest/mapper/orm/src/test/java/org/hibernate/search/integrationtest/mapper/orm/automaticindexing/AutomaticIndexingNonEntityIdDocumentIdIT.java
+++ b/integrationtest/mapper/orm/src/test/java/org/hibernate/search/integrationtest/mapper/orm/automaticindexing/AutomaticIndexingNonEntityIdDocumentIdIT.java
@@ -83,7 +83,7 @@ public void directPersistUpdateDelete() {
entity1.setIndexedField( "updatedValue" );
backendMock.expectWorks( IndexedEntity.INDEX )
- .update( "42", b -> b
+ .addOrUpdate( "42", b -> b
.field( "indexedField", entity1.getIndexedField() )
.field(
"indexedElementCollectionField",
@@ -135,7 +135,7 @@ public void directValueUpdate_indexedElementCollectionField() {
entity1.getIndexedElementCollectionField().add( "secondValue" );
backendMock.expectWorks( IndexedEntity.INDEX )
- .update( "42", b -> b
+ .addOrUpdate( "42", b -> b
.field( "indexedField", null )
.field(
"indexedElementCollectionField",
@@ -153,7 +153,7 @@ public void directValueUpdate_indexedElementCollectionField() {
entity1.getIndexedElementCollectionField().remove( 1 );
backendMock.expectWorks( IndexedEntity.INDEX )
- .update( "42", b -> b
+ .addOrUpdate( "42", b -> b
.field( "indexedField", null )
.field(
"indexedElementCollectionField",
@@ -202,7 +202,7 @@ public void directValueReplace_indexedElementCollectionField() {
) ) );
backendMock.expectWorks( IndexedEntity.INDEX )
- .update( "42", b -> b
+ .addOrUpdate( "42", b -> b
.field( "indexedField", null )
.field(
"indexedElementCollectionField",
diff --git a/integrationtest/mapper/orm/src/test/java/org/hibernate/search/integrationtest/mapper/orm/automaticindexing/AutomaticIndexingOutOfTransactionIT.java b/integrationtest/mapper/orm/src/test/java/org/hibernate/search/integrationtest/mapper/orm/automaticindexing/AutomaticIndexingOutOfTransactionIT.java
index 5e18b43fb30..4b0b3a49cad 100644
--- a/integrationtest/mapper/orm/src/test/java/org/hibernate/search/integrationtest/mapper/orm/automaticindexing/AutomaticIndexingOutOfTransactionIT.java
+++ b/integrationtest/mapper/orm/src/test/java/org/hibernate/search/integrationtest/mapper/orm/automaticindexing/AutomaticIndexingOutOfTransactionIT.java
@@ -81,7 +81,7 @@ public void clear() {
// only entity 2 is supposed to be flushed here
backendMock.expectWorks( IndexedEntity.INDEX_NAME )
- .update( "2", b -> b.field( "text", "number2" ) )
+ .addOrUpdate( "2", b -> b.field( "text", "number2" ) )
.processedThenExecuted();
session.flush();
diff --git a/integrationtest/mapper/orm/src/test/java/org/hibernate/search/integrationtest/mapper/orm/automaticindexing/AutomaticIndexingOverReindexingIT.java b/integrationtest/mapper/orm/src/test/java/org/hibernate/search/integrationtest/mapper/orm/automaticindexing/AutomaticIndexingOverReindexingIT.java
index e4d6733c37d..08c32cf14fd 100644
--- a/integrationtest/mapper/orm/src/test/java/org/hibernate/search/integrationtest/mapper/orm/automaticindexing/AutomaticIndexingOverReindexingIT.java
+++ b/integrationtest/mapper/orm/src/test/java/org/hibernate/search/integrationtest/mapper/orm/automaticindexing/AutomaticIndexingOverReindexingIT.java
@@ -149,7 +149,7 @@ public void test() {
level3.setProperty2( "updatedValue" );
backendMock.expectWorks( Level2Entity.INDEX )
- .update( "2", b -> b
+ .addOrUpdate( "2", b -> b
.objectField( "level3", b2 -> b2
.field( "property2", "updatedValue" )
)
@@ -165,7 +165,7 @@ public void test() {
level3.setProperty1( "updatedValue" );
backendMock.expectWorks( Level1Entity.INDEX )
- .update( "1", b -> b
+ .addOrUpdate( "1", b -> b
.field( "property1FromBridge", "updatedValue" )
)
.processedThenExecuted();
diff --git a/integrationtest/mapper/orm/src/test/java/org/hibernate/search/integrationtest/mapper/orm/automaticindexing/array/AbstractAutomaticIndexingArrayIT.java b/integrationtest/mapper/orm/src/test/java/org/hibernate/search/integrationtest/mapper/orm/automaticindexing/array/AbstractAutomaticIndexingArrayIT.java
index ded6dfe90c5..908c13770e4 100644
--- a/integrationtest/mapper/orm/src/test/java/org/hibernate/search/integrationtest/mapper/orm/automaticindexing/array/AbstractAutomaticIndexingArrayIT.java
+++ b/integrationtest/mapper/orm/src/test/java/org/hibernate/search/integrationtest/mapper/orm/automaticindexing/array/AbstractAutomaticIndexingArrayIT.java
@@ -79,7 +79,7 @@ public void serializedArray_replaceArray() {
primitives.setSerializedArray( entity1, array2 );
backendMock.expectWorks( primitives.getIndexName() )
- .update( "1", b -> b.field( "serializedArray",
+ .addOrUpdate( "1", b -> b.field( "serializedArray",
primitives.getExpectedIndexFieldValue( array2, 0 ),
primitives.getExpectedIndexFieldValue( array2, 1 ),
primitives.getExpectedIndexFieldValue( array2, 2 ) ) )
@@ -116,7 +116,7 @@ public void serializedArray_replaceElement() {
primitives.setElement( array, 1, 2 );
backendMock.expectWorks( primitives.getIndexName() )
- .update( "1", b -> b.field( "serializedArray",
+ .addOrUpdate( "1", b -> b.field( "serializedArray",
primitives.getExpectedIndexFieldValue( array, 0 ),
primitives.getExpectedIndexFieldValue( array, 1 ) ) )
.processedThenExecuted();
@@ -155,7 +155,7 @@ public void elementCollectionArray_replaceArray() {
primitives.setElementCollectionArray( entity1, array2 );
backendMock.expectWorks( primitives.getIndexName() )
- .update( "1", b -> b.field( "elementCollectionArray",
+ .addOrUpdate( "1", b -> b.field( "elementCollectionArray",
primitives.getExpectedIndexFieldValue( array2, 0 ),
primitives.getExpectedIndexFieldValue( array2, 1 ),
primitives.getExpectedIndexFieldValue( array2, 2 ) ) )
@@ -192,7 +192,7 @@ public void elementCollectionArray_replaceElement() {
primitives.setElement( array, 1, 2 );
backendMock.expectWorks( primitives.getIndexName() )
- .update( "1", b -> b.field( "elementCollectionArray",
+ .addOrUpdate( "1", b -> b.field( "elementCollectionArray",
primitives.getExpectedIndexFieldValue( array, 0 ),
primitives.getExpectedIndexFieldValue( array, 1 ) ) )
.processedThenExecuted();
diff --git a/integrationtest/mapper/orm/src/test/java/org/hibernate/search/integrationtest/mapper/orm/automaticindexing/association/AbstractAutomaticIndexingAssociationIT.java b/integrationtest/mapper/orm/src/test/java/org/hibernate/search/integrationtest/mapper/orm/automaticindexing/association/AbstractAutomaticIndexingAssociationIT.java
index dbeb6376fa6..e12d38e52ac 100644
--- a/integrationtest/mapper/orm/src/test/java/org/hibernate/search/integrationtest/mapper/orm/automaticindexing/association/AbstractAutomaticIndexingAssociationIT.java
+++ b/integrationtest/mapper/orm/src/test/java/org/hibernate/search/integrationtest/mapper/orm/automaticindexing/association/AbstractAutomaticIndexingAssociationIT.java
@@ -222,7 +222,7 @@ public void indirectValueUpdate_indexedEmbedded_singleValue_indexed() {
primitives.setIndexedField( contained, "updatedValue" );
backendMock.expectWorks( primitives.getIndexName() )
- .update( "1", b -> b
+ .addOrUpdate( "1", b -> b
.objectField( "child", b2 -> b2
.objectField( "containedIndexedEmbedded", b3 -> b3
.field( "indexedField", "updatedValue" )
@@ -283,7 +283,7 @@ public void directValueUpdate_nonIndexed_then_indirectValueUpdate_indexedEmbedde
primitives.setIndexedField( contained, "updatedValue" );
backendMock.expectWorks( primitives.getIndexName() )
- .update( "1", b -> b
+ .addOrUpdate( "1", b -> b
.objectField( "child", b2 -> b2
.objectField( "containedIndexedEmbedded", b3 -> b3
.field( "indexedField", "updatedValue" )
@@ -392,7 +392,7 @@ public void indirectValueUpdate_indexedEmbedded_elementCollectionValue_indexed()
primitives.getIndexedElementCollectionField( contained ).add( "secondValue" );
backendMock.expectWorks( primitives.getIndexName() )
- .update( "1", b -> b
+ .addOrUpdate( "1", b -> b
.objectField( "child", b2 -> b2
.objectField( "containedIndexedEmbedded", b3 -> b3
.field( "indexedField", null )
@@ -413,7 +413,7 @@ public void indirectValueUpdate_indexedEmbedded_elementCollectionValue_indexed()
primitives.getIndexedElementCollectionField( contained ).remove( 0 );
backendMock.expectWorks( primitives.getIndexName() )
- .update( "1", b -> b
+ .addOrUpdate( "1", b -> b
.objectField( "child", b2 -> b2
.objectField( "containedIndexedEmbedded", b3 -> b3
.field( "indexedField", null )
@@ -500,7 +500,7 @@ public void indirectValueReplace_indexedEmbedded_elementCollectionValue_indexed(
) ) );
backendMock.expectWorks( primitives.getIndexName() )
- .update( "1", b -> b
+ .addOrUpdate( "1", b -> b
.objectField( "child", b2 -> b2
.objectField( "containedIndexedEmbedded", b3 -> b3
.field( "indexedField", null )
@@ -630,7 +630,7 @@ public void indirectValueReplace_indexedEmbedded_elementCollectionValue_nonIndex
// TODO HSEARCH-3204: remove the statement below to not expect any work
backendMock.expectWorks( primitives.getIndexName() )
- .update( "1", b -> b
+ .addOrUpdate( "1", b -> b
.objectField( "child", b2 -> b2
.objectField( "containedIndexedEmbedded", b3 -> b3
.field( "indexedField", null )
@@ -684,7 +684,7 @@ public void indirectValueUpdate_indexedEmbedded_containedDerivedValue_indexed()
primitives.setFieldUsedInContainedDerivedField1( contained, "field1_updatedValue" );
backendMock.expectWorks( primitives.getIndexName() )
- .update( "1", b -> b
+ .addOrUpdate( "1", b -> b
.objectField( "child", b2 -> b2
.objectField( "containedIndexedEmbedded", b3 -> b3
.field( "indexedField", null )
@@ -705,7 +705,7 @@ public void indirectValueUpdate_indexedEmbedded_containedDerivedValue_indexed()
primitives.setFieldUsedInContainedDerivedField2( contained, "field2_updatedValue" );
backendMock.expectWorks( primitives.getIndexName() )
- .update( "1", b -> b
+ .addOrUpdate( "1", b -> b
.objectField( "child", b2 -> b2
.objectField( "containedIndexedEmbedded", b3 -> b3
.field( "indexedField", null )
@@ -764,7 +764,7 @@ public void indirectValueUpdate_usedInCrossEntityDerivedProperty_crossEntityDeri
primitives.setFieldUsedInCrossEntityDerivedField1( contained, "field1_updatedValue" );
backendMock.expectWorks( primitives.getIndexName() )
- .update( "1", b -> b
+ .addOrUpdate( "1", b -> b
.objectField( "child", b2 -> b2
.field(
"crossEntityDerivedField",
@@ -782,7 +782,7 @@ public void indirectValueUpdate_usedInCrossEntityDerivedProperty_crossEntityDeri
primitives.setFieldUsedInCrossEntityDerivedField2( contained, "field2_updatedValue" );
backendMock.expectWorks( primitives.getIndexName() )
- .update( "1", b -> b
+ .addOrUpdate( "1", b -> b
.objectField( "child", b2 -> b2
.field(
"crossEntityDerivedField",
@@ -1151,7 +1151,7 @@ public void indirectValueUpdate_indexedEmbeddedWithCast_singleValue() {
primitives.setIndexedField( contained, "updatedValue" );
backendMock.expectWorks( primitives.getIndexName() )
- .update( "1", b -> b
+ .addOrUpdate( "1", b -> b
.objectField( "child", b2 -> b2
.objectField( "containedIndexedEmbeddedWithCast", b3 -> b3
.field( "indexedField", "updatedValue" )
diff --git a/integrationtest/mapper/orm/src/test/java/org/hibernate/search/integrationtest/mapper/orm/automaticindexing/association/AutomaticIndexingAssociationDeletionIT.java b/integrationtest/mapper/orm/src/test/java/org/hibernate/search/integrationtest/mapper/orm/automaticindexing/association/AutomaticIndexingAssociationDeletionIT.java
index a57f2136b00..a696701c806 100644
--- a/integrationtest/mapper/orm/src/test/java/org/hibernate/search/integrationtest/mapper/orm/automaticindexing/association/AutomaticIndexingAssociationDeletionIT.java
+++ b/integrationtest/mapper/orm/src/test/java/org/hibernate/search/integrationtest/mapper/orm/automaticindexing/association/AutomaticIndexingAssociationDeletionIT.java
@@ -107,7 +107,7 @@ public void optionalOneToOne_deleteNonOwner() {
// This update is caused by the call to owner1.setOptionalOneToOne;
// it has nothing to do with the deletion.
backendMock.expectWorks( AssociationOwner.NAME )
- .update( "1", b -> b.field( "basic", "text 1" )
+ .addOrUpdate( "1", b -> b.field( "basic", "text 1" )
.field( "elementCollection", 1001, 2001 ) )
.processedThenExecuted();
@@ -207,11 +207,11 @@ public void manyToOne_deleteNonOwner() {
backendMock.expectWorks( AssociationOwner.NAME )
// This update is caused by the call to owner1.setManyToOne;
// it has nothing to do with the deletion.
- .update( "1", b -> b.field( "basic", "text 1" )
+ .addOrUpdate( "1", b -> b.field( "basic", "text 1" )
.field( "elementCollection", 1001, 2001 ) )
// This update is caused by the call to owner3.setManyToOne;
// it has nothing to do with the deletion.
- .update( "3", b -> b.field( "basic", "text 3" )
+ .addOrUpdate( "3", b -> b.field( "basic", "text 3" )
.field( "elementCollection", 1003, 2003 ) )
.processedThenExecuted();
@@ -240,7 +240,7 @@ public void manyToOne_deleteBoth() {
backendMock.expectWorks( AssociationOwner.NAME )
// This update is caused by the call to owner3.setManyToOne;
// it has nothing to do with the deletion.
- .update( "3", b -> b.field( "basic", "text 3" )
+ .addOrUpdate( "3", b -> b.field( "basic", "text 3" )
.field( "elementCollection", 1003, 2003 ) )
.delete( "1" )
.processedThenExecuted();
@@ -331,14 +331,14 @@ public void manyToMany_deleteNonOwner() {
backendMock.expectWorks( AssociationOwner.NAME )
// This update is caused by the call to owner1.getManyToMany().remove();
// it has nothing to do with the deletion.
- .update( "1", b -> b.field( "basic", "text 1" )
+ .addOrUpdate( "1", b -> b.field( "basic", "text 1" )
.field( "elementCollection", 1001, 2001 )
.objectField( "manyToMany", b2 -> b2
.field( "basic", "text 4" )
.field( "elementCollection", 1004, 2004 ) ) )
// This update is caused by the call to owner3.getManyToMany().remove();
// it has nothing to do with the deletion.
- .update( "3", b -> b.field( "basic", "text 3" )
+ .addOrUpdate( "3", b -> b.field( "basic", "text 3" )
.field( "elementCollection", 1003, 2003 )
.objectField( "manyToMany", b2 -> b2
.field( "basic", "text 4" )
@@ -371,7 +371,7 @@ public void manyToMany_deleteBoth() {
.delete( "1" )
// This update is caused by the call to owner3.getManyToMany().remove;
// it has nothing to do with the deletion.
- .update( "3", b -> b.field( "basic", "text 3" )
+ .addOrUpdate( "3", b -> b.field( "basic", "text 3" )
.field( "elementCollection", 1003, 2003 )
.objectField( "manyToMany", b2 -> b2
.field( "basic", "text 4" )
diff --git a/integrationtest/mapper/orm/src/test/java/org/hibernate/search/integrationtest/mapper/orm/automaticindexing/association/AutomaticIndexingGenericPolymorphicAssociationIT.java b/integrationtest/mapper/orm/src/test/java/org/hibernate/search/integrationtest/mapper/orm/automaticindexing/association/AutomaticIndexingGenericPolymorphicAssociationIT.java
index f65fc4e5c71..e90bbaaa155 100644
--- a/integrationtest/mapper/orm/src/test/java/org/hibernate/search/integrationtest/mapper/orm/automaticindexing/association/AutomaticIndexingGenericPolymorphicAssociationIT.java
+++ b/integrationtest/mapper/orm/src/test/java/org/hibernate/search/integrationtest/mapper/orm/automaticindexing/association/AutomaticIndexingGenericPolymorphicAssociationIT.java
@@ -110,7 +110,7 @@ public void inversePathHandlesGenericTypes() {
containedEntity.setIncludedInSingle( "updatedValue" );
backendMock.expectWorks( IndexedEntity.INDEX )
- .update( "1", b -> b
+ .addOrUpdate( "1", b -> b
.objectField( "child", b2 -> b2
.objectField( "containedSingle", b3 -> b3
.field( "includedInSingle", "updatedValue" )
diff --git a/integrationtest/mapper/orm/src/test/java/org/hibernate/search/integrationtest/mapper/orm/automaticindexing/association/AutomaticIndexingPolymorphicInverseSideAssociationIT.java b/integrationtest/mapper/orm/src/test/java/org/hibernate/search/integrationtest/mapper/orm/automaticindexing/association/AutomaticIndexingPolymorphicInverseSideAssociationIT.java
index e30ab8fe99d..589facf8238 100644
--- a/integrationtest/mapper/orm/src/test/java/org/hibernate/search/integrationtest/mapper/orm/automaticindexing/association/AutomaticIndexingPolymorphicInverseSideAssociationIT.java
+++ b/integrationtest/mapper/orm/src/test/java/org/hibernate/search/integrationtest/mapper/orm/automaticindexing/association/AutomaticIndexingPolymorphicInverseSideAssociationIT.java
@@ -123,7 +123,7 @@ public void inversePathIgnoresUnrelatedTypes() {
containedEntity.setIncludedInSingle( "updatedValue" );
backendMock.expectWorks( IndexedEntity.INDEX )
- .update( "1", b -> b
+ .addOrUpdate( "1", b -> b
.objectField( "child", b2 -> b2
.objectField( "containedSingle", b3 -> b3
.field( "includedInSingle", "updatedValue" )
@@ -208,14 +208,14 @@ public void inversePathDependsOnConcreteType() {
containedEntity.setIncludedInSingle( "updatedValue" );
backendMock.expectWorks( IndexedEntity.INDEX )
- .update( "1", b -> b
+ .addOrUpdate( "1", b -> b
.objectField( "child", b2 -> b2
.objectField( "containedSingle", b3 -> b3
.field( "includedInSingle", "updatedValue" )
)
)
)
- .update( "3", b -> b
+ .addOrUpdate( "3", b -> b
.objectField( "child", b2 -> b2
.objectField( "containedSingle", b3 -> b3
.field( "includedInSingle", "updatedValue" )
diff --git a/integrationtest/mapper/orm/src/test/java/org/hibernate/search/integrationtest/mapper/orm/automaticindexing/association/AutomaticIndexingPolymorphicOriginalSideAssociationIT.java b/integrationtest/mapper/orm/src/test/java/org/hibernate/search/integrationtest/mapper/orm/automaticindexing/association/AutomaticIndexingPolymorphicOriginalSideAssociationIT.java
index 7c8d7540ce9..d2c0dc15b8f 100644
--- a/integrationtest/mapper/orm/src/test/java/org/hibernate/search/integrationtest/mapper/orm/automaticindexing/association/AutomaticIndexingPolymorphicOriginalSideAssociationIT.java
+++ b/integrationtest/mapper/orm/src/test/java/org/hibernate/search/integrationtest/mapper/orm/automaticindexing/association/AutomaticIndexingPolymorphicOriginalSideAssociationIT.java
@@ -141,14 +141,14 @@ public void inversePathDependsOnConcreteType() {
containedEntity.setIncludedInSingle( "updatedValue" );
backendMock.expectWorks( IndexedEntity.INDEX )
- .update( "1", b -> b
+ .addOrUpdate( "1", b -> b
.objectField( "child", b2 -> b2
.objectField( "containedSingle", b3 -> b3
.field( "includedInSingle", "updatedValue" )
)
)
)
- .update( "3", b -> b
+ .addOrUpdate( "3", b -> b
.objectField( "child", b2 -> b2
.objectField( "containedSingle", b3 -> b3
.field( "includedInSingle", "updatedValue" )
diff --git a/integrationtest/mapper/orm/src/test/java/org/hibernate/search/integrationtest/mapper/orm/automaticindexing/association/AutomaticIndexingSingleAssociationIT.java b/integrationtest/mapper/orm/src/test/java/org/hibernate/search/integrationtest/mapper/orm/automaticindexing/association/AutomaticIndexingSingleAssociationIT.java
index 1d931be926d..ee7727a1535 100644
--- a/integrationtest/mapper/orm/src/test/java/org/hibernate/search/integrationtest/mapper/orm/automaticindexing/association/AutomaticIndexingSingleAssociationIT.java
+++ b/integrationtest/mapper/orm/src/test/java/org/hibernate/search/integrationtest/mapper/orm/automaticindexing/association/AutomaticIndexingSingleAssociationIT.java
@@ -73,7 +73,7 @@ public void directAssociationUpdate_indexedEmbedded() {
session.persist( containedEntity );
backendMock.expectWorks( IndexedEntity.INDEX )
- .update( "1", b -> b
+ .addOrUpdate( "1", b -> b
.objectField( "containedIndexedEmbedded", b2 -> b2
.field( "indexedField", "initialValue" )
)
@@ -97,7 +97,7 @@ public void directAssociationUpdate_indexedEmbedded() {
session.persist( containedEntity );
backendMock.expectWorks( IndexedEntity.INDEX )
- .update( "1", b -> b
+ .addOrUpdate( "1", b -> b
.objectField( "containedIndexedEmbedded", b2 -> b2
.field( "indexedField", "updatedValue" )
)
@@ -114,7 +114,7 @@ public void directAssociationUpdate_indexedEmbedded() {
entity1.setContainedIndexedEmbedded( null );
backendMock.expectWorks( IndexedEntity.INDEX )
- .update( "1", b -> { } )
+ .addOrUpdate( "1", b -> { } )
.processedThenExecuted();
} );
backendMock.verifyExpectationsMet();
@@ -220,7 +220,7 @@ public void directAssociationUpdate_indexedEmbeddedShallowReindexOnUpdate() {
session.persist( containedEntity );
backendMock.expectWorks( IndexedEntity.INDEX )
- .update( "1", b -> b
+ .addOrUpdate( "1", b -> b
.objectField( "containedIndexedEmbeddedShallowReindexOnUpdate", b2 -> b2
.field( "indexedField", "initialValue" )
)
@@ -242,7 +242,7 @@ public void directAssociationUpdate_indexedEmbeddedShallowReindexOnUpdate() {
session.persist( containedEntity );
backendMock.expectWorks( IndexedEntity.INDEX )
- .update( "1", b -> b
+ .addOrUpdate( "1", b -> b
.objectField( "containedIndexedEmbeddedShallowReindexOnUpdate", b2 -> b2
.field( "indexedField", "updatedValue" )
)
@@ -258,7 +258,7 @@ public void directAssociationUpdate_indexedEmbeddedShallowReindexOnUpdate() {
entity1.setContainedIndexedEmbeddedShallowReindexOnUpdate( null );
backendMock.expectWorks( IndexedEntity.INDEX )
- .update( "1", b -> { } )
+ .addOrUpdate( "1", b -> { } )
.processedThenExecuted();
} );
backendMock.verifyExpectationsMet();
@@ -369,7 +369,7 @@ public void indirectAssociationUpdate_indexedEmbedded() {
session.persist( containedEntity );
backendMock.expectWorks( IndexedEntity.INDEX )
- .update( "1", b -> b
+ .addOrUpdate( "1", b -> b
.objectField( "child", b2 -> b2
.objectField( "containedIndexedEmbedded", b3 -> b3
.field( "indexedField", "initialValue" )
@@ -395,7 +395,7 @@ public void indirectAssociationUpdate_indexedEmbedded() {
session.persist( containedEntity );
backendMock.expectWorks( IndexedEntity.INDEX )
- .update( "1", b -> b
+ .addOrUpdate( "1", b -> b
.objectField( "child", b2 -> b2
.objectField( "containedIndexedEmbedded", b3 -> b3
.field( "indexedField", "updatedValue" )
@@ -431,7 +431,7 @@ public void indirectAssociationUpdate_indexedEmbedded() {
containingEntity1.setContainedIndexedEmbedded( null );
backendMock.expectWorks( IndexedEntity.INDEX )
- .update( "1", b -> b
+ .addOrUpdate( "1", b -> b
.objectField( "child", b2 -> { } )
)
.processedThenExecuted();
@@ -556,7 +556,7 @@ public void indirectAssociationUpdate_indexedEmbeddedShallowReindexOnUpdate() {
session.persist( containedEntity );
backendMock.expectWorks( IndexedEntity.INDEX )
- .update( "1", b -> b
+ .addOrUpdate( "1", b -> b
.objectField( "child", b2 -> b2
.objectField( "containedIndexedEmbeddedShallowReindexOnUpdate", b3 -> b3
.field( "indexedField", "initialValue" )
@@ -580,7 +580,7 @@ public void indirectAssociationUpdate_indexedEmbeddedShallowReindexOnUpdate() {
session.persist( containedEntity );
backendMock.expectWorks( IndexedEntity.INDEX )
- .update( "1", b -> b
+ .addOrUpdate( "1", b -> b
.objectField( "child", b2 -> b2
.objectField( "containedIndexedEmbeddedShallowReindexOnUpdate", b3 -> b3
.field( "indexedField", "updatedValue" )
@@ -598,7 +598,7 @@ public void indirectAssociationUpdate_indexedEmbeddedShallowReindexOnUpdate() {
containingEntity1.setContainedIndexedEmbeddedShallowReindexOnUpdate( null );
backendMock.expectWorks( IndexedEntity.INDEX )
- .update( "1", b -> b
+ .addOrUpdate( "1", b -> b
.objectField( "child", b2 -> { } )
)
.processedThenExecuted();
@@ -726,7 +726,7 @@ public void indirectAssociationUpdate_usedInCrossEntityDerivedProperty() {
session.persist( containedEntity );
backendMock.expectWorks( IndexedEntity.INDEX )
- .update( "1", b -> b
+ .addOrUpdate( "1", b -> b
.objectField( "child", b2 -> b2
.field(
"crossEntityDerivedField",
@@ -754,7 +754,7 @@ public void indirectAssociationUpdate_usedInCrossEntityDerivedProperty() {
session.persist( containedEntity );
backendMock.expectWorks( IndexedEntity.INDEX )
- .update( "1", b -> b
+ .addOrUpdate( "1", b -> b
.objectField( "child", b2 -> b2
.field(
"crossEntityDerivedField",
@@ -792,7 +792,7 @@ public void indirectAssociationUpdate_usedInCrossEntityDerivedProperty() {
containingEntity1.setContainedUsedInCrossEntityDerivedProperty( null );
backendMock.expectWorks( IndexedEntity.INDEX )
- .update( "1", b -> b
+ .addOrUpdate( "1", b -> b
.objectField( "child", b2 -> { } )
)
.processedThenExecuted();
diff --git a/integrationtest/mapper/orm/src/test/java/org/hibernate/search/integrationtest/mapper/orm/automaticindexing/association/multi/AbstractAutomaticIndexingMultiAssociationIT.java b/integrationtest/mapper/orm/src/test/java/org/hibernate/search/integrationtest/mapper/orm/automaticindexing/association/multi/AbstractAutomaticIndexingMultiAssociationIT.java
index e8c4faf5c4c..99334982887 100644
--- a/integrationtest/mapper/orm/src/test/java/org/hibernate/search/integrationtest/mapper/orm/automaticindexing/association/multi/AbstractAutomaticIndexingMultiAssociationIT.java
+++ b/integrationtest/mapper/orm/src/test/java/org/hibernate/search/integrationtest/mapper/orm/automaticindexing/association/multi/AbstractAutomaticIndexingMultiAssociationIT.java
@@ -69,7 +69,7 @@ public void directAssociationUpdate_indexedEmbedded() {
session.persist( contained );
backendMock.expectWorks( primitives.getIndexName() )
- .update( "1", b -> b
+ .addOrUpdate( "1", b -> b
.objectField( "containedIndexedEmbedded", b2 -> b2
.field( "indexedField", VALUE_1 )
)
@@ -91,7 +91,7 @@ public void directAssociationUpdate_indexedEmbedded() {
session.persist( contained );
backendMock.expectWorks( primitives.getIndexName() )
- .update( "1", b -> b
+ .addOrUpdate( "1", b -> b
.objectField( "containedIndexedEmbedded", b2 -> b2
.field( "indexedField", VALUE_1 )
)
@@ -113,7 +113,7 @@ public void directAssociationUpdate_indexedEmbedded() {
primitives.removeContained( primitives.getContainedIndexedEmbedded( entity1 ), contained );
backendMock.expectWorks( primitives.getIndexName() )
- .update( "1", b -> b
+ .addOrUpdate( "1", b -> b
.objectField( "containedIndexedEmbedded", b2 -> b2
.field( "indexedField", VALUE_2 )
)
@@ -171,7 +171,7 @@ public void directAssociationReplace_indexedEmbedded() {
session.persist( contained );
backendMock.expectWorks( primitives.getIndexName() )
- .update( "1", b -> b
+ .addOrUpdate( "1", b -> b
.objectField( "containedIndexedEmbedded", b2 -> b2
.field( "indexedField", VALUE_1 )
)
@@ -295,7 +295,7 @@ public void directAssociationReplace_nonIndexedEmbedded() {
// TODO HSEARCH-3204: remove the statement below to not expect any work
backendMock.expectWorks( primitives.getIndexName() )
- .update( "1", b -> { } )
+ .addOrUpdate( "1", b -> { } )
.processedThenExecuted();
} );
backendMock.verifyExpectationsMet();
@@ -332,7 +332,7 @@ public void directAssociationUpdate_indexedEmbeddedShallowReindexOnUpdate() {
session.persist( contained );
backendMock.expectWorks( primitives.getIndexName() )
- .update( "1", b -> b
+ .addOrUpdate( "1", b -> b
.objectField( "containedIndexedEmbeddedShallowReindexOnUpdate", b2 -> b2
.field( "indexedField", VALUE_1 )
)
@@ -353,7 +353,7 @@ public void directAssociationUpdate_indexedEmbeddedShallowReindexOnUpdate() {
session.persist( contained );
backendMock.expectWorks( primitives.getIndexName() )
- .update( "1", b -> b
+ .addOrUpdate( "1", b -> b
.objectField( "containedIndexedEmbeddedShallowReindexOnUpdate", b2 -> b2
.field( "indexedField", VALUE_1 )
)
@@ -374,7 +374,7 @@ public void directAssociationUpdate_indexedEmbeddedShallowReindexOnUpdate() {
primitives.removeContained( primitives.getContainedIndexedEmbeddedShallowReindexOnUpdate( entity1 ), contained );
backendMock.expectWorks( primitives.getIndexName() )
- .update( "1", b -> b
+ .addOrUpdate( "1", b -> b
.objectField( "containedIndexedEmbeddedShallowReindexOnUpdate", b2 -> b2
.field( "indexedField", VALUE_2 )
)
@@ -431,7 +431,7 @@ public void directAssociationReplace_indexedEmbeddedShallowReindexOnUpdate() {
session.persist( contained );
backendMock.expectWorks( primitives.getIndexName() )
- .update( "1", b -> b
+ .addOrUpdate( "1", b -> b
.objectField( "containedIndexedEmbeddedShallowReindexOnUpdate", b2 -> b2
.field( "indexedField", VALUE_1 )
)
@@ -554,7 +554,7 @@ public void directAssociationReplace_indexedEmbeddedNoReindexOnUpdate() {
// TODO HSEARCH-3204: remove the statement below to not expect any work
backendMock.expectWorks( primitives.getIndexName() )
- .update( "1", b -> b
+ .addOrUpdate( "1", b -> b
.objectField( "containedIndexedEmbeddedNoReindexOnUpdate", b2 -> b2
.field( "indexedField", VALUE_1 )
)
@@ -605,7 +605,7 @@ public void indirectAssociationUpdate_indexedEmbedded() {
session.persist( contained );
backendMock.expectWorks( primitives.getIndexName() )
- .update( "1", b -> b
+ .addOrUpdate( "1", b -> b
.objectField( "child", b2 -> b2
.objectField( "containedIndexedEmbedded", b3 -> b3
.field( "indexedField", VALUE_1 )
@@ -629,7 +629,7 @@ public void indirectAssociationUpdate_indexedEmbedded() {
session.persist( contained );
backendMock.expectWorks( primitives.getIndexName() )
- .update( "1", b -> b
+ .addOrUpdate( "1", b -> b
.objectField( "child", b2 -> b2
.objectField( "containedIndexedEmbedded", b3 -> b3
.field( "indexedField", VALUE_1 )
@@ -669,7 +669,7 @@ public void indirectAssociationUpdate_indexedEmbedded() {
primitives.removeContained( primitives.getContainedIndexedEmbedded( containingEntity1 ), contained );
backendMock.expectWorks( primitives.getIndexName() )
- .update( "1", b -> b
+ .addOrUpdate( "1", b -> b
.objectField( "child", b2 -> b2
.objectField( "containedIndexedEmbedded", b3 -> b3
.field( "indexedField", VALUE_2 )
@@ -736,7 +736,7 @@ public void indirectAssociationReplace_indexedEmbedded() {
session.persist( contained );
backendMock.expectWorks( primitives.getIndexName() )
- .update( "1", b -> b
+ .addOrUpdate( "1", b -> b
.objectField( "child", b2 -> b2
.objectField( "containedIndexedEmbedded", b3 -> b3
.field( "indexedField", VALUE_1 )
@@ -875,7 +875,7 @@ public void indirectAssociationReplace_nonIndexedEmbedded() {
// TODO HSEARCH-3204: remove the statement below to not expect any work
backendMock.expectWorks( primitives.getIndexName() )
- .update( "1", b -> b
+ .addOrUpdate( "1", b -> b
.objectField( "child", b2 -> { } )
)
.processedThenExecuted();
@@ -922,7 +922,7 @@ public void indirectAssociationUpdate_indexedEmbeddedShallowReindexOnUpdate() {
session.persist( contained );
backendMock.expectWorks( primitives.getIndexName() )
- .update( "1", b -> b
+ .addOrUpdate( "1", b -> b
.objectField( "child", b2 -> b2
.objectField( "containedIndexedEmbeddedShallowReindexOnUpdate", b3 -> b3
.field( "indexedField", VALUE_1 )
@@ -945,7 +945,7 @@ public void indirectAssociationUpdate_indexedEmbeddedShallowReindexOnUpdate() {
session.persist( contained );
backendMock.expectWorks( primitives.getIndexName() )
- .update( "1", b -> b
+ .addOrUpdate( "1", b -> b
.objectField( "child", b2 -> b2
.objectField( "containedIndexedEmbeddedShallowReindexOnUpdate", b3 -> b3
.field( "indexedField", VALUE_1 )
@@ -968,7 +968,7 @@ public void indirectAssociationUpdate_indexedEmbeddedShallowReindexOnUpdate() {
primitives.removeContained( primitives.getContainedIndexedEmbeddedShallowReindexOnUpdate( containingEntity1 ), contained );
backendMock.expectWorks( primitives.getIndexName() )
- .update( "1", b -> b
+ .addOrUpdate( "1", b -> b
.objectField( "child", b2 -> b2
.objectField( "containedIndexedEmbeddedShallowReindexOnUpdate", b3 -> b3
.field( "indexedField", VALUE_2 )
@@ -1036,7 +1036,7 @@ public void indirectAssociationReplace_indexedEmbeddedShallowReindexOnUpdate() {
session.persist( contained );
backendMock.expectWorks( primitives.getIndexName() )
- .update( "1", b -> b
+ .addOrUpdate( "1", b -> b
.objectField( "child", b2 -> b2
.objectField( "containedIndexedEmbeddedShallowReindexOnUpdate", b3 -> b3
.field( "indexedField", VALUE_1 )
@@ -1176,7 +1176,7 @@ public void indirectAssociationReplace_indexedEmbeddedNoReindexOnUpdate() {
// TODO HSEARCH-3204: remove the statement below to not expect any work
backendMock.expectWorks( primitives.getIndexName() )
- .update( "1", b -> b
+ .addOrUpdate( "1", b -> b
.objectField( "child", b2 -> b2
.objectField( "containedIndexedEmbeddedNoReindexOnUpdate", b3 -> b3
.field( "indexedField", VALUE_1 )
@@ -1238,7 +1238,7 @@ public void indirectValueUpdate_indexedEmbedded() {
primitives.setIndexedField( contained, "updatedValue" );
backendMock.expectWorks( primitives.getIndexName() )
- .update( "1", b -> b
+ .addOrUpdate( "1", b -> b
.objectField( "child", b2 -> b2
.objectField( "containedIndexedEmbedded", b3 -> b3
.field( "indexedField", "updatedValue" )
diff --git a/integrationtest/mapper/orm/src/test/java/org/hibernate/search/integrationtest/mapper/orm/automaticindexing/bridge/AutomaticIndexingBridgeExplicitReindexingFunctionalIT.java b/integrationtest/mapper/orm/src/test/java/org/hibernate/search/integrationtest/mapper/orm/automaticindexing/bridge/AutomaticIndexingBridgeExplicitReindexingFunctionalIT.java
index 2186f0c6198..f999207e4fc 100644
--- a/integrationtest/mapper/orm/src/test/java/org/hibernate/search/integrationtest/mapper/orm/automaticindexing/bridge/AutomaticIndexingBridgeExplicitReindexingFunctionalIT.java
+++ b/integrationtest/mapper/orm/src/test/java/org/hibernate/search/integrationtest/mapper/orm/automaticindexing/bridge/AutomaticIndexingBridgeExplicitReindexingFunctionalIT.java
@@ -105,7 +105,7 @@ public void test() {
containedEntity.setIncludedInTypeBridge( "value1" );
session.persist( containedEntity );
backendMock.expectWorks( IndexedEntity.INDEX )
- .update( "1", b -> b
+ .addOrUpdate( "1", b -> b
.objectField( "typeBridge", b2 -> b2
.field( "includedInTypeBridge", "value1" )
)
@@ -128,7 +128,7 @@ public void test() {
session.persist( containedEntity );
}
backendMock.expectWorks( IndexedEntity.INDEX )
- .update( "1", b -> b
+ .addOrUpdate( "1", b -> b
.objectField( "typeBridge", b2 -> b2
.field( "includedInTypeBridge", "value1" )
)
@@ -146,7 +146,7 @@ public void test() {
ContainedEntity containedEntity = session.getReference( ContainedEntity.class, 10 );
containedEntity.setIncludedInTypeBridge( "value2" );
backendMock.expectWorks( IndexedEntity.INDEX )
- .update( "1", b -> b
+ .addOrUpdate( "1", b -> b
.objectField( "typeBridge", b2 -> b2
.field( "includedInTypeBridge", "value1", "value2" )
)
diff --git a/integrationtest/mapper/orm/src/test/java/org/hibernate/search/integrationtest/mapper/orm/automaticindexing/bridge/AutomaticIndexingEmbeddedBridgeIT.java b/integrationtest/mapper/orm/src/test/java/org/hibernate/search/integrationtest/mapper/orm/automaticindexing/bridge/AutomaticIndexingEmbeddedBridgeIT.java
index a381461d15b..1d638a57ec8 100644
--- a/integrationtest/mapper/orm/src/test/java/org/hibernate/search/integrationtest/mapper/orm/automaticindexing/bridge/AutomaticIndexingEmbeddedBridgeIT.java
+++ b/integrationtest/mapper/orm/src/test/java/org/hibernate/search/integrationtest/mapper/orm/automaticindexing/bridge/AutomaticIndexingEmbeddedBridgeIT.java
@@ -118,7 +118,7 @@ public void indirectValueUpdate_embeddedBridge() {
containedEntity.setIncludedInFirstBridge( "updatedValue" );
backendMock.expectWorks( IndexedEntity.INDEX )
- .update( "1", b -> b
+ .addOrUpdate( "1", b -> b
.objectField( "child", b2 -> b2
.objectField( "firstBridge", b3 -> b3
.field( "value", "updatedValue" )
diff --git a/integrationtest/mapper/orm/src/test/java/org/hibernate/search/integrationtest/mapper/orm/model/BytecodeEnhancementIT.java b/integrationtest/mapper/orm/src/test/java/org/hibernate/search/integrationtest/mapper/orm/model/BytecodeEnhancementIT.java
index 129b69d49b1..a67856db530 100644
--- a/integrationtest/mapper/orm/src/test/java/org/hibernate/search/integrationtest/mapper/orm/model/BytecodeEnhancementIT.java
+++ b/integrationtest/mapper/orm/src/test/java/org/hibernate/search/integrationtest/mapper/orm/model/BytecodeEnhancementIT.java
@@ -183,7 +183,7 @@ public void test() {
// Expect all properties to be correctly loaded, even though we're using bytecode enhancement
backendMock.expectWorks( IndexedEntity.INDEX )
- .update( "1", b -> b
+ .addOrUpdate( "1", b -> b
.field( "mappedSuperClassText", "initialValue" )
.field( "entitySuperClassText", "initialValue" )
.field( "id", 1 )
diff --git a/integrationtest/mapper/orm/src/test/java/org/hibernate/search/integrationtest/mapper/orm/model/ProxyIT.java b/integrationtest/mapper/orm/src/test/java/org/hibernate/search/integrationtest/mapper/orm/model/ProxyIT.java
index 625088cdbef..f71de723086 100644
--- a/integrationtest/mapper/orm/src/test/java/org/hibernate/search/integrationtest/mapper/orm/model/ProxyIT.java
+++ b/integrationtest/mapper/orm/src/test/java/org/hibernate/search/integrationtest/mapper/orm/model/ProxyIT.java
@@ -88,7 +88,7 @@ public void proxyAccess() {
// ... the ID is correctly detected
backendMock.expectWorks( EntityWithPropertyAccessTypeForId.INDEX )
- .update( "1", b -> b
+ .addOrUpdate( "1", b -> b
.field( "text", proxy.getText() )
)
.processedThenExecuted();
diff --git a/integrationtest/mapper/orm/src/test/java/org/hibernate/search/integrationtest/mapper/orm/model/TransientPropertyIT.java b/integrationtest/mapper/orm/src/test/java/org/hibernate/search/integrationtest/mapper/orm/model/TransientPropertyIT.java
index c2c97b27104..200b834000b 100644
--- a/integrationtest/mapper/orm/src/test/java/org/hibernate/search/integrationtest/mapper/orm/model/TransientPropertyIT.java
+++ b/integrationtest/mapper/orm/src/test/java/org/hibernate/search/integrationtest/mapper/orm/model/TransientPropertyIT.java
@@ -98,7 +98,7 @@ public void withDerivedFrom() {
session.persist( entity1 );
backendMock.expectWorks( EntityWithDerivedFrom.INDEX )
- .update( "1", b -> b
+ .addOrUpdate( "1", b -> b
.field( "APlusB", 9 )
)
.processedThenExecuted();
@@ -149,7 +149,7 @@ public void withDerivedFromAndBridge() {
session.persist( entity1 );
backendMock.expectWorks( EntityWithDerivedFromAndBridge.INDEX )
- .update( "1", b -> b
+ .addOrUpdate( "1", b -> b
.field( "APlusB", 9 )
)
.processedThenExecuted();
diff --git a/integrationtest/mapper/orm/src/test/java/org/hibernate/search/integrationtest/mapper/orm/nonregression/automaticindexing/ContainedInThroughNonContainingIndexedTypeIT.java b/integrationtest/mapper/orm/src/test/java/org/hibernate/search/integrationtest/mapper/orm/nonregression/automaticindexing/ContainedInThroughNonContainingIndexedTypeIT.java
index df03286b7df..1e859058553 100644
--- a/integrationtest/mapper/orm/src/test/java/org/hibernate/search/integrationtest/mapper/orm/nonregression/automaticindexing/ContainedInThroughNonContainingIndexedTypeIT.java
+++ b/integrationtest/mapper/orm/src/test/java/org/hibernate/search/integrationtest/mapper/orm/nonregression/automaticindexing/ContainedInThroughNonContainingIndexedTypeIT.java
@@ -100,7 +100,7 @@ public void test() {
* the modified property.
*/
backendMock.expectWorks( Containing.INDEX )
- .update( "1", b -> b
+ .addOrUpdate( "1", b -> b
.field( "indexedInContaining", 42 )
)
.processedThenExecuted();
diff --git a/integrationtest/mapper/orm/src/test/java/org/hibernate/search/integrationtest/mapper/orm/nonregression/automaticindexing/ContainedInTriggerUnnecessaryCollectionInitializationIT.java b/integrationtest/mapper/orm/src/test/java/org/hibernate/search/integrationtest/mapper/orm/nonregression/automaticindexing/ContainedInTriggerUnnecessaryCollectionInitializationIT.java
index da0bb066c78..f5a1432185e 100644
--- a/integrationtest/mapper/orm/src/test/java/org/hibernate/search/integrationtest/mapper/orm/nonregression/automaticindexing/ContainedInTriggerUnnecessaryCollectionInitializationIT.java
+++ b/integrationtest/mapper/orm/src/test/java/org/hibernate/search/integrationtest/mapper/orm/nonregression/automaticindexing/ContainedInTriggerUnnecessaryCollectionInitializationIT.java
@@ -107,7 +107,7 @@ public void test() {
group.setSomeField( "updatedValue" );
backendMock.expectWorks( Group.INDEX )
- .update( "1", b -> b
+ .addOrUpdate( "1", b -> b
.field( "someField", "updatedValue" )
.field( "someInteger", 42 )
)
diff --git a/integrationtest/mapper/orm/src/test/java/org/hibernate/search/integrationtest/mapper/orm/nonregression/automaticindexing/IndexingProcessorProxiedAssociatedEntityIT.java b/integrationtest/mapper/orm/src/test/java/org/hibernate/search/integrationtest/mapper/orm/nonregression/automaticindexing/IndexingProcessorProxiedAssociatedEntityIT.java
index 03b626f0050..312face8a1c 100644
--- a/integrationtest/mapper/orm/src/test/java/org/hibernate/search/integrationtest/mapper/orm/nonregression/automaticindexing/IndexingProcessorProxiedAssociatedEntityIT.java
+++ b/integrationtest/mapper/orm/src/test/java/org/hibernate/search/integrationtest/mapper/orm/nonregression/automaticindexing/IndexingProcessorProxiedAssociatedEntityIT.java
@@ -93,7 +93,7 @@ public void toOne() {
indexed1.setText( "updatedValue" );
backendMock.expectWorks( IndexedEntity.NAME )
- .update( "1", b -> b
+ .addOrUpdate( "1", b -> b
.field( "text", "updatedValue" )
.objectField( "containedSingle", b2 -> b2
.field( "text", "initialValue" )
@@ -141,7 +141,7 @@ public void toMany() {
indexed1.setText( "updatedValue" );
backendMock.expectWorks( IndexedEntity.NAME )
- .update( "1", b -> b
+ .addOrUpdate( "1", b -> b
.field( "text", "updatedValue" )
.objectField( "containedList", b2 -> b2
.field( "text", "initialValue1" )
diff --git a/integrationtest/mapper/orm/src/test/java/org/hibernate/search/integrationtest/mapper/orm/nonregression/automaticindexing/ReindexingResolverProxiedAssociatedEntityIT.java b/integrationtest/mapper/orm/src/test/java/org/hibernate/search/integrationtest/mapper/orm/nonregression/automaticindexing/ReindexingResolverProxiedAssociatedEntityIT.java
index 3c9637b08ef..2e26dc773c8 100644
--- a/integrationtest/mapper/orm/src/test/java/org/hibernate/search/integrationtest/mapper/orm/nonregression/automaticindexing/ReindexingResolverProxiedAssociatedEntityIT.java
+++ b/integrationtest/mapper/orm/src/test/java/org/hibernate/search/integrationtest/mapper/orm/nonregression/automaticindexing/ReindexingResolverProxiedAssociatedEntityIT.java
@@ -100,7 +100,7 @@ public void toOne() {
contained2.setText( "updatedValue" );
backendMock.expectWorks( IndexedEntity.NAME )
- .update( "1", b -> b
+ .addOrUpdate( "1", b -> b
.objectField( "contained", b2 -> b2
.objectField( "containedSingle", b3 -> b3
.field( "text", "updatedValue" )
@@ -159,7 +159,7 @@ public void toMany() {
contained2.setText( "updatedValue" );
backendMock.expectWorks( IndexedEntity.NAME )
- .update( "1", b -> b
+ .addOrUpdate( "1", b -> b
.objectField( "contained", b2 -> b2
.objectField( "containedList", b3 -> b3
.field( "text", "updatedValue" )
diff --git a/integrationtest/mapper/orm/src/test/java/org/hibernate/search/integrationtest/mapper/orm/session/SearchIndexingPlanBaseIT.java b/integrationtest/mapper/orm/src/test/java/org/hibernate/search/integrationtest/mapper/orm/session/SearchIndexingPlanBaseIT.java
index ef9fea1d6a2..d23c7cf9fe7 100644
--- a/integrationtest/mapper/orm/src/test/java/org/hibernate/search/integrationtest/mapper/orm/session/SearchIndexingPlanBaseIT.java
+++ b/integrationtest/mapper/orm/src/test/java/org/hibernate/search/integrationtest/mapper/orm/session/SearchIndexingPlanBaseIT.java
@@ -74,8 +74,8 @@ public void simple() {
indexingPlan.purge( IndexedEntity1.class, 42, null ); // Does not exist in database, but may exist in the index
defaultBackendMock.expectWorks( IndexedEntity1.INDEX_NAME )
- .update( "1", b -> b.field( "text", "number1" ) )
- .update( "2", b -> b.field( "text", "number2" ) )
+ .addOrUpdate( "1", b -> b.field( "text", "number1" ) )
+ .addOrUpdate( "2", b -> b.field( "text", "number2" ) )
.delete( "3" )
.delete( "42" )
.processedThenExecuted();
@@ -137,13 +137,13 @@ public void mergedEvents() {
defaultBackendMock.expectWorks( IndexedEntity1.INDEX_NAME )
// multiple addOrUpdate => single update
- .update( "1", b -> b.field( "text", "number1" ) )
+ .addOrUpdate( "1", b -> b.field( "text", "number1" ) )
// multiple delete => single delete
.delete( "2" )
// addOrUpdate then delete => delete
.delete( "3" )
// delete then addOrUpdate => update
- .update( "4", b -> b.field( "text", "number4" ) )
+ .addOrUpdate( "4", b -> b.field( "text", "number4" ) )
// multiple purge => single delete
.delete( "42" )
// delete then purge => single delete
@@ -153,7 +153,7 @@ public void mergedEvents() {
// addOrUpdate then purge => delete
.delete( "7" )
// purge then addOrUpdate => update
- .update( "8", b -> b.field( "text", "number8" ) )
+ .addOrUpdate( "8", b -> b.field( "text", "number8" ) )
.processedThenExecuted();
} );
defaultBackendMock.verifyExpectationsMet();
@@ -348,7 +348,7 @@ public void mixedExplicitAndAutomaticIndexing() {
defaultBackendMock.expectWorks( IndexedEntity1.INDEX_NAME )
// Requested explicitly
- .update( "1", b -> b.field( "text", "number1" ) )
+ .addOrUpdate( "1", b -> b.field( "text", "number1" ) )
.delete( "2" )
// Automatic on persist
.add( "3", b -> b.field( "text", "number3" ) )
@@ -376,11 +376,11 @@ public void multiIndexMultiBackend() {
indexingPlan.delete( entity3 );
defaultBackendMock.expectWorks( IndexedEntity1.INDEX_NAME )
- .update( "1", b -> b.field( "text", "number1" ) )
+ .addOrUpdate( "1", b -> b.field( "text", "number1" ) )
.delete( "3" )
.processedThenExecuted();
backend2Mock.expectWorks( IndexedEntity2.INDEX_NAME )
- .update( "2", b -> b.field( "text", "number2" ) )
+ .addOrUpdate( "2", b -> b.field( "text", "number2" ) )
.processedThenExecuted();
} );
defaultBackendMock.verifyExpectationsMet();
diff --git a/integrationtest/mapper/orm/src/test/java/org/hibernate/search/integrationtest/mapper/orm/session/SearchIndexingPlanNonEntityIdDocumentIdIT.java b/integrationtest/mapper/orm/src/test/java/org/hibernate/search/integrationtest/mapper/orm/session/SearchIndexingPlanNonEntityIdDocumentIdIT.java
index 27630a81041..575302ae79a 100644
--- a/integrationtest/mapper/orm/src/test/java/org/hibernate/search/integrationtest/mapper/orm/session/SearchIndexingPlanNonEntityIdDocumentIdIT.java
+++ b/integrationtest/mapper/orm/src/test/java/org/hibernate/search/integrationtest/mapper/orm/session/SearchIndexingPlanNonEntityIdDocumentIdIT.java
@@ -58,8 +58,8 @@ public void simple() {
indexingPlan.purge( IndexedEntity.class, 47, null ); // Does not exist in database, but may exist in the index
backendMock.expectWorks( IndexedEntity.INDEX_NAME )
- .update( "41", b -> b.field( "text", "number1" ) )
- .update( "42", b -> b.field( "text", "number2" ) )
+ .addOrUpdate( "41", b -> b.field( "text", "number1" ) )
+ .addOrUpdate( "42", b -> b.field( "text", "number2" ) )
.delete( "43" )
.delete( "47" )
.processedThenExecuted();
diff --git a/integrationtest/mapper/pojo-base/src/test/java/org/hibernate/search/integrationtest/mapper/pojo/automaticindexing/DefaultReindexOnUpdateIT.java b/integrationtest/mapper/pojo-base/src/test/java/org/hibernate/search/integrationtest/mapper/pojo/automaticindexing/DefaultReindexOnUpdateIT.java
index 4d305f2f49f..ce014fbfec0 100644
--- a/integrationtest/mapper/pojo-base/src/test/java/org/hibernate/search/integrationtest/mapper/pojo/automaticindexing/DefaultReindexOnUpdateIT.java
+++ b/integrationtest/mapper/pojo-base/src/test/java/org/hibernate/search/integrationtest/mapper/pojo/automaticindexing/DefaultReindexOnUpdateIT.java
@@ -115,13 +115,13 @@ public void default_associationInverseSideKnown() {
session.indexingPlan().addOrUpdate( child );
backendMock.expectWorks( "ChildEntity" )
- .update( "2", b -> b
+ .addOrUpdate( "2", b -> b
.field( "value", "val2" )
)
.processedThenExecuted();
// The child was updated, thus the parent (which index-embeds the childs) is reindexed.
backendMock.expectWorks( "ParentEntity" )
- .update( "1", b -> b
+ .addOrUpdate( "1", b -> b
.field( "value", "val1" )
.objectField( "child", b2 -> b2
.field( "value", "val2" )
@@ -249,7 +249,7 @@ public void no_associationInverseSideUnknown() {
session.indexingPlan().addOrUpdate( child );
backendMock.expectWorks( "ChildEntity" )
- .update( "2", b -> b
+ .addOrUpdate( "2", b -> b
.field( "value", "val2" )
)
.processedThenExecuted();
diff --git a/integrationtest/mapper/pojo-base/src/test/java/org/hibernate/search/integrationtest/mapper/pojo/mapping/definition/PropertyBridgeBaseIT.java b/integrationtest/mapper/pojo-base/src/test/java/org/hibernate/search/integrationtest/mapper/pojo/mapping/definition/PropertyBridgeBaseIT.java
index 2cb73857635..9a08186cc93 100644
--- a/integrationtest/mapper/pojo-base/src/test/java/org/hibernate/search/integrationtest/mapper/pojo/mapping/definition/PropertyBridgeBaseIT.java
+++ b/integrationtest/mapper/pojo-base/src/test/java/org/hibernate/search/integrationtest/mapper/pojo/mapping/definition/PropertyBridgeBaseIT.java
@@ -124,7 +124,7 @@ class IndexedEntity {
session.indexingPlan().addOrUpdate( entity, new String[] { "stringProperty" } );
backendMock.expectWorks( INDEX_NAME )
- .update( "1", b -> b.field( "someField", entity.stringProperty ) )
+ .addOrUpdate( "1", b -> b.field( "someField", entity.stringProperty ) )
.processedThenExecuted();
}
backendMock.verifyExpectationsMet();
@@ -195,7 +195,7 @@ class IndexedEntity {
session.indexingPlan().addOrUpdate( entity, new String[] { "contained.stringProperty" } );
backendMock.expectWorks( INDEX_NAME )
- .update( "1", b -> b.field( "someField", contained.stringProperty ) )
+ .addOrUpdate( "1", b -> b.field( "someField", contained.stringProperty ) )
.processedThenExecuted();
}
backendMock.verifyExpectationsMet();
@@ -431,7 +431,7 @@ public void explicitReindexing() {
session.indexingPlan().addOrUpdate( containedLevel2Entity, new String[] { "stringProperty" } );
backendMock.expectWorks( INDEX_NAME )
- .update( "1", b -> b.field( "someField", "constant" ) )
+ .addOrUpdate( "1", b -> b.field( "someField", "constant" ) )
.processedThenExecuted();
}
backendMock.verifyExpectationsMet();
@@ -803,7 +803,7 @@ class IndexedEntity {
session.indexingPlan().addOrUpdate( entity, new String[] { "stringProperty" } );
backendMock.expectWorks( INDEX_NAME )
- .update( "1", b -> b.field( "someField", "value1", "value2" ) )
+ .addOrUpdate( "1", b -> b.field( "someField", "value1", "value2" ) )
.processedThenExecuted();
}
backendMock.verifyExpectationsMet();
diff --git a/integrationtest/mapper/pojo-base/src/test/java/org/hibernate/search/integrationtest/mapper/pojo/mapping/definition/RoutingBridgeBaseIT.java b/integrationtest/mapper/pojo-base/src/test/java/org/hibernate/search/integrationtest/mapper/pojo/mapping/definition/RoutingBridgeBaseIT.java
index 4ccbf0c7236..efc393de7de 100644
--- a/integrationtest/mapper/pojo-base/src/test/java/org/hibernate/search/integrationtest/mapper/pojo/mapping/definition/RoutingBridgeBaseIT.java
+++ b/integrationtest/mapper/pojo-base/src/test/java/org/hibernate/search/integrationtest/mapper/pojo/mapping/definition/RoutingBridgeBaseIT.java
@@ -332,7 +332,7 @@ public void previousRoutes(DocumentRoutes routes, Object entityIdentifier,
backendMock.expectWorks( INDEX_NAME )
.delete( b -> b.identifier( "1" ).routingKey( "some string" ) )
.delete( b -> b.identifier( "1" ).routingKey( "some string 3" ) )
- .update( b -> b.identifier( "1" ).routingKey( entity.stringProperty )
+ .addOrUpdate( b -> b.identifier( "1" ).routingKey( entity.stringProperty )
.document( StubDocumentNode.document().build() ) )
.processedThenExecuted();
}
@@ -446,7 +446,7 @@ public void previousRoutes(DocumentRoutes routes, Object entityIdentifier,
backendMock.expectWorks( INDEX_NAME )
.delete( b -> b.identifier( "1" ).routingKey( "some string" ) )
.delete( b -> b.identifier( "1" ).routingKey( "some string 3" ) )
- .update( b -> b.identifier( "1" ).routingKey( entity.stringProperty )
+ .addOrUpdate( b -> b.identifier( "1" ).routingKey( entity.stringProperty )
.document( StubDocumentNode.document().build() ) )
.processedThenExecuted();
}
@@ -610,7 +610,7 @@ public void previousRoutes(DocumentRoutes routes, Object entityIdentifier,
session.indexingPlan().addOrUpdate( entity );
backendMock.expectWorks( INDEX_NAME )
- .update( b -> b.identifier( "1" ).routingKey( "route/1" )
+ .addOrUpdate( b -> b.identifier( "1" ).routingKey( "route/1" )
.document( StubDocumentNode.document().build() ) )
.processedThenExecuted();
}
diff --git a/integrationtest/mapper/pojo-base/src/test/java/org/hibernate/search/integrationtest/mapper/pojo/mapping/definition/TypeBridgeBaseIT.java b/integrationtest/mapper/pojo-base/src/test/java/org/hibernate/search/integrationtest/mapper/pojo/mapping/definition/TypeBridgeBaseIT.java
index ac2ff6ecdb6..fc8a740aed4 100644
--- a/integrationtest/mapper/pojo-base/src/test/java/org/hibernate/search/integrationtest/mapper/pojo/mapping/definition/TypeBridgeBaseIT.java
+++ b/integrationtest/mapper/pojo-base/src/test/java/org/hibernate/search/integrationtest/mapper/pojo/mapping/definition/TypeBridgeBaseIT.java
@@ -118,7 +118,7 @@ class IndexedEntity {
session.indexingPlan().addOrUpdate( entity, new String[] { "stringProperty" } );
backendMock.expectWorks( INDEX_NAME )
- .update( "1", b -> b.field( "someField", entity.stringProperty ) )
+ .addOrUpdate( "1", b -> b.field( "someField", entity.stringProperty ) )
.processedThenExecuted();
}
backendMock.verifyExpectationsMet();
@@ -184,7 +184,7 @@ class IndexedEntity {
session.indexingPlan().addOrUpdate( entity, new String[] { "stringProperty" } );
backendMock.expectWorks( INDEX_NAME )
- .update( "1", b -> b.field( "someField", entity.stringProperty ) )
+ .addOrUpdate( "1", b -> b.field( "someField", entity.stringProperty ) )
.processedThenExecuted();
}
backendMock.verifyExpectationsMet();
@@ -294,7 +294,7 @@ class ContainedEntity {
session.indexingPlan().addOrUpdate( containedEntity, new String[] { "stringProperty" } );
backendMock.expectWorks( INDEX_NAME )
- .update( "1", b -> b.field( "someField", "constant" ) )
+ .addOrUpdate( "1", b -> b.field( "someField", "constant" ) )
.processedThenExecuted();
}
backendMock.verifyExpectationsMet();
@@ -629,7 +629,7 @@ class IndexedEntity {
session.indexingPlan().addOrUpdate( entity, new String[] { "enumProperty" } );
backendMock.expectWorks( INDEX_NAME )
- .update( "1", b -> b
+ .addOrUpdate( "1", b -> b
.objectField( "enumProperty", b2 -> b2
.field( "someField", entity.enumProperty.stringProperty )
)
diff --git a/integrationtest/mapper/pojo-base/src/test/java/org/hibernate/search/integrationtest/mapper/pojo/work/PojoIndexingAddOrUpdateIT.java b/integrationtest/mapper/pojo-base/src/test/java/org/hibernate/search/integrationtest/mapper/pojo/work/PojoIndexingAddOrUpdateIT.java
index d05217241b2..c25f8822606 100644
--- a/integrationtest/mapper/pojo-base/src/test/java/org/hibernate/search/integrationtest/mapper/pojo/work/PojoIndexingAddOrUpdateIT.java
+++ b/integrationtest/mapper/pojo-base/src/test/java/org/hibernate/search/integrationtest/mapper/pojo/work/PojoIndexingAddOrUpdateIT.java
@@ -17,7 +17,7 @@ public class PojoIndexingAddOrUpdateIT extends AbstractPojoIndexingOperationIT {
@Override
protected void expectOperation(BackendMock.DocumentWorkCallListContext context, String tenantId,
String id, String routingKey, String value) {
- context.update( b -> addWorkInfoAndDocument( b, tenantId, id, routingKey, value ) );
+ context.addOrUpdate( b -> addWorkInfoAndDocument( b, tenantId, id, routingKey, value ) );
}
@Override
diff --git a/integrationtest/mapper/pojo-base/src/test/java/org/hibernate/search/integrationtest/mapper/pojo/work/PojoIndexingPlanBaseIT.java b/integrationtest/mapper/pojo-base/src/test/java/org/hibernate/search/integrationtest/mapper/pojo/work/PojoIndexingPlanBaseIT.java
index c21094273d2..c20ba3302a5 100644
--- a/integrationtest/mapper/pojo-base/src/test/java/org/hibernate/search/integrationtest/mapper/pojo/work/PojoIndexingPlanBaseIT.java
+++ b/integrationtest/mapper/pojo-base/src/test/java/org/hibernate/search/integrationtest/mapper/pojo/work/PojoIndexingPlanBaseIT.java
@@ -80,7 +80,7 @@ public void success() {
.build()
)
)
- .update( b -> b
+ .addOrUpdate( b -> b
.identifier( "2" )
.document( StubDocumentNode.document()
.field( "value", entity2.value )
diff --git a/integrationtest/performance/backend/base/src/main/java/org/hibernate/search/integrationtest/performance/backend/base/AbstractOnTheFlyIndexingBenchmarks.java b/integrationtest/performance/backend/base/src/main/java/org/hibernate/search/integrationtest/performance/backend/base/AbstractOnTheFlyIndexingBenchmarks.java
index 00143f87d39..85fc681d5ea 100644
--- a/integrationtest/performance/backend/base/src/main/java/org/hibernate/search/integrationtest/performance/backend/base/AbstractOnTheFlyIndexingBenchmarks.java
+++ b/integrationtest/performance/backend/base/src/main/java/org/hibernate/search/integrationtest/performance/backend/base/AbstractOnTheFlyIndexingBenchmarks.java
@@ -131,7 +131,7 @@ public void indexingPlan(WriteCounters counters) {
}
for ( Long documentIdInThread : idsToUpdate ) {
long documentId = partition.toDocumentId( documentIdInThread );
- indexingPlan.update(
+ indexingPlan.addOrUpdate(
StubMapperUtils.referenceProvider( String.valueOf( documentId ) ),
document -> dataset.populate( index, document, documentId, invocationCount )
);
diff --git a/mapper/pojo-base/src/main/java/org/hibernate/search/mapper/pojo/work/impl/AbstractPojoTypeIndexingPlan.java b/mapper/pojo-base/src/main/java/org/hibernate/search/mapper/pojo/work/impl/AbstractPojoTypeIndexingPlan.java
index 731e411c26f..0996562a171 100644
--- a/mapper/pojo-base/src/main/java/org/hibernate/search/mapper/pojo/work/impl/AbstractPojoTypeIndexingPlan.java
+++ b/mapper/pojo-base/src/main/java/org/hibernate/search/mapper/pojo/work/impl/AbstractPojoTypeIndexingPlan.java
@@ -38,16 +38,16 @@ void add(Object providedId, String providedRoutingKey, Object entity) {
getState( identifier ).add( entitySupplier, providedRoutingKey );
}
- void update(Object providedId, String providedRoutingKey, Object entity) {
+ void addOrUpdate(Object providedId, String providedRoutingKey, Object entity) {
Supplier entitySupplier = typeContext().toEntitySupplier( sessionContext, entity );
I identifier = toIdentifier( providedId, entitySupplier );
- getState( identifier ).update( entitySupplier, providedRoutingKey );
+ getState( identifier ).addOrUpdate( entitySupplier, providedRoutingKey );
}
- void update(Object providedId, String providedRoutingKey, Object entity, BitSet dirtyPaths) {
+ void addOrUpdate(Object providedId, String providedRoutingKey, Object entity, BitSet dirtyPaths) {
Supplier entitySupplier = typeContext().toEntitySupplier( sessionContext, entity );
I identifier = toIdentifier( providedId, entitySupplier );
- getState( identifier ).update( entitySupplier, providedRoutingKey, dirtyPaths );
+ getState( identifier ).addOrUpdate( entitySupplier, providedRoutingKey, dirtyPaths );
}
void delete(Object providedId, String providedRoutingKey, Object entity) {
@@ -114,22 +114,22 @@ void add(Supplier entitySupplier, String providedRoutingKey) {
currentStatus = EntityStatus.PRESENT;
}
- void update(Supplier entitySupplier, String providedRoutingKey) {
- doUpdate( entitySupplier, providedRoutingKey );
+ void addOrUpdate(Supplier entitySupplier, String providedRoutingKey) {
+ doAddOrUpdate( entitySupplier, providedRoutingKey );
shouldResolveToReindex = true;
considerAllDirty = true;
dirtyPaths = null;
}
- void update(Supplier entitySupplier, String providedRoutingKey, BitSet dirtyPaths) {
- doUpdate( entitySupplier, providedRoutingKey );
+ void addOrUpdate(Supplier entitySupplier, String providedRoutingKey, BitSet dirtyPaths) {
+ doAddOrUpdate( entitySupplier, providedRoutingKey );
shouldResolveToReindex = true;
if ( !considerAllDirty ) {
addDirtyPaths( dirtyPaths );
}
}
- void doUpdate(Supplier entitySupplier, String providedRoutingKey) {
+ void doAddOrUpdate(Supplier entitySupplier, String providedRoutingKey) {
this.entitySupplier = entitySupplier;
if ( EntityStatus.UNKNOWN.equals( initialStatus ) ) {
initialStatus = EntityStatus.PRESENT;
diff --git a/mapper/pojo-base/src/main/java/org/hibernate/search/mapper/pojo/work/impl/PojoIndexedTypeIndexingPlan.java b/mapper/pojo-base/src/main/java/org/hibernate/search/mapper/pojo/work/impl/PojoIndexedTypeIndexingPlan.java
index 265b51509f2..03117fa6af6 100644
--- a/mapper/pojo-base/src/main/java/org/hibernate/search/mapper/pojo/work/impl/PojoIndexedTypeIndexingPlan.java
+++ b/mapper/pojo-base/src/main/java/org/hibernate/search/mapper/pojo/work/impl/PojoIndexedTypeIndexingPlan.java
@@ -122,8 +122,8 @@ void add(Supplier entitySupplier, String providedRoutingKey) {
}
@Override
- void doUpdate(Supplier entitySupplier, String providedRoutingKey) {
- super.doUpdate( entitySupplier, providedRoutingKey );
+ void doAddOrUpdate(Supplier entitySupplier, String providedRoutingKey) {
+ super.doAddOrUpdate( entitySupplier, providedRoutingKey );
this.providedRoutingKey = providedRoutingKey;
}
@@ -134,7 +134,7 @@ void updateBecauseOfContained(Supplier entitySupplier) {
// Just ignore the call.
return;
}
- doUpdate( entitySupplier, null );
+ doAddOrUpdate( entitySupplier, null );
updatedBecauseOfContained = true;
// We don't want contained entities that haven't been modified to trigger an update of their
// containing entities.
@@ -171,7 +171,7 @@ void sendCommandsToDelegate() {
case UNKNOWN:
if ( considerAllDirty || updatedBecauseOfContained
|| dirtyPaths != null && typeContext.dirtySelfFilter().test( dirtyPaths ) ) {
- delegateUpdate();
+ delegateAddOrUpdate();
}
return;
}
@@ -209,7 +209,7 @@ private void delegateAdd() {
typeContext.toDocumentContributor( sessionContext, identifier, entitySupplier ) );
}
- private void delegateUpdate() {
+ private void delegateAddOrUpdate() {
PojoWorkRouter router = typeContext.createRouter( sessionContext, identifier, entitySupplier );
DocumentRouteImpl currentRoute = router.currentRoute( providedRoutingKey );
List previousRoutes = router.previousRoutes( currentRoute );
@@ -226,7 +226,7 @@ private void delegateUpdate() {
}
DocumentReferenceProvider referenceProvider = new PojoDocumentReferenceProvider( documentIdentifier,
currentRoute.routingKey(), identifier );
- delegate.update( referenceProvider,
+ delegate.addOrUpdate( referenceProvider,
typeContext.toDocumentContributor( sessionContext, identifier, entitySupplier ) );
}
diff --git a/mapper/pojo-base/src/main/java/org/hibernate/search/mapper/pojo/work/impl/PojoIndexingPlanImpl.java b/mapper/pojo-base/src/main/java/org/hibernate/search/mapper/pojo/work/impl/PojoIndexingPlanImpl.java
index 6056a5b1fca..ce8a19384e7 100644
--- a/mapper/pojo-base/src/main/java/org/hibernate/search/mapper/pojo/work/impl/PojoIndexingPlanImpl.java
+++ b/mapper/pojo-base/src/main/java/org/hibernate/search/mapper/pojo/work/impl/PojoIndexingPlanImpl.java
@@ -65,14 +65,14 @@ public void add(PojoRawTypeIdentifier> typeIdentifier, Object providedId, Stri
@Override
public void addOrUpdate(PojoRawTypeIdentifier> typeIdentifier, Object providedId, String providedRoutingKey, Object entity) {
AbstractPojoTypeIndexingPlan, ?, ?> delegate = getDelegate( typeIdentifier );
- delegate.update( providedId, providedRoutingKey, entity );
+ delegate.addOrUpdate( providedId, providedRoutingKey, entity );
}
@Override
public void addOrUpdate(PojoRawTypeIdentifier> typeIdentifier, Object providedId, String providedRoutingKey,
Object entity, BitSet dirtyPaths) {
AbstractPojoTypeIndexingPlan, ?, ?> delegate = getDelegate( typeIdentifier );
- delegate.update( providedId, providedRoutingKey, entity, dirtyPaths );
+ delegate.addOrUpdate( providedId, providedRoutingKey, entity, dirtyPaths );
}
@Override
diff --git a/mapper/pojo-base/src/main/java/org/hibernate/search/mapper/pojo/work/impl/PojoTypeIndexer.java b/mapper/pojo-base/src/main/java/org/hibernate/search/mapper/pojo/work/impl/PojoTypeIndexer.java
index ad1b6e92f5a..2123d49b33c 100644
--- a/mapper/pojo-base/src/main/java/org/hibernate/search/mapper/pojo/work/impl/PojoTypeIndexer.java
+++ b/mapper/pojo-base/src/main/java/org/hibernate/search/mapper/pojo/work/impl/PojoTypeIndexer.java
@@ -79,7 +79,7 @@ CompletableFuture> addOrUpdate(Object providedId, String providedRoutingKey, O
// the backend is responsible for preserving relative order of works on the same index/shard + docId,
// and we don't care about relative order of works on different indexes/shards.
return deletePreviousFuture.thenCombine(
- delegate.update( referenceProvider,
+ delegate.addOrUpdate( referenceProvider,
typeContext.toDocumentContributor( sessionContext, identifier, entitySupplier ),
commitStrategy, refreshStrategy ),
(deletePreviousResult, updateResult) -> updateResult );
diff --git a/util/internal/integrationtest/common/src/main/java/org/hibernate/search/util/impl/integrationtest/common/rule/BackendMock.java b/util/internal/integrationtest/common/src/main/java/org/hibernate/search/util/impl/integrationtest/common/rule/BackendMock.java
index 57a2f3e2a99..1f9bbf39930 100644
--- a/util/internal/integrationtest/common/src/main/java/org/hibernate/search/util/impl/integrationtest/common/rule/BackendMock.java
+++ b/util/internal/integrationtest/common/src/main/java/org/hibernate/search/util/impl/integrationtest/common/rule/BackendMock.java
@@ -327,12 +327,12 @@ public DocumentWorkCallListContext add(String id, Consumer contributor) {
- return documentWork( StubDocumentWork.Type.UPDATE, contributor );
+ public DocumentWorkCallListContext addOrUpdate(Consumer contributor) {
+ return documentWork( StubDocumentWork.Type.ADD_OR_UPDATE, contributor );
}
- public DocumentWorkCallListContext update(String id, Consumer documentContributor) {
- return documentWork( StubDocumentWork.Type.UPDATE, id, documentContributor );
+ public DocumentWorkCallListContext addOrUpdate(String id, Consumer documentContributor) {
+ return documentWork( StubDocumentWork.Type.ADD_OR_UPDATE, id, documentContributor );
}
public DocumentWorkCallListContext delete(String id) {
diff --git a/util/internal/integrationtest/common/src/main/java/org/hibernate/search/util/impl/integrationtest/common/stub/backend/index/StubDocumentWork.java b/util/internal/integrationtest/common/src/main/java/org/hibernate/search/util/impl/integrationtest/common/stub/backend/index/StubDocumentWork.java
index adca41d2e73..ac2a0fbef6a 100644
--- a/util/internal/integrationtest/common/src/main/java/org/hibernate/search/util/impl/integrationtest/common/stub/backend/index/StubDocumentWork.java
+++ b/util/internal/integrationtest/common/src/main/java/org/hibernate/search/util/impl/integrationtest/common/stub/backend/index/StubDocumentWork.java
@@ -13,7 +13,7 @@
public final class StubDocumentWork {
public enum Type {
- ADD, UPDATE, DELETE
+ ADD, ADD_OR_UPDATE, DELETE
}
public static Builder builder(Type type) {
diff --git a/util/internal/integrationtest/common/src/main/java/org/hibernate/search/util/impl/integrationtest/common/stub/backend/index/impl/StubIndexIndexer.java b/util/internal/integrationtest/common/src/main/java/org/hibernate/search/util/impl/integrationtest/common/stub/backend/index/impl/StubIndexIndexer.java
index ea8b96de487..62f2bdebbce 100644
--- a/util/internal/integrationtest/common/src/main/java/org/hibernate/search/util/impl/integrationtest/common/stub/backend/index/impl/StubIndexIndexer.java
+++ b/util/internal/integrationtest/common/src/main/java/org/hibernate/search/util/impl/integrationtest/common/stub/backend/index/impl/StubIndexIndexer.java
@@ -51,13 +51,13 @@ public CompletableFuture> add(DocumentReferenceProvider referenceProvider,
}
@Override
- public CompletableFuture> update(DocumentReferenceProvider referenceProvider,
+ public CompletableFuture> addOrUpdate(DocumentReferenceProvider referenceProvider,
DocumentContributor documentContributor,
DocumentCommitStrategy commitStrategy, DocumentRefreshStrategy refreshStrategy) {
StubDocumentNode.Builder documentBuilder = StubDocumentNode.document();
documentContributor.contribute( new StubDocumentElement( documentBuilder ) );
- StubDocumentWork work = StubDocumentWork.builder( StubDocumentWork.Type.UPDATE )
+ StubDocumentWork work = StubDocumentWork.builder( StubDocumentWork.Type.ADD_OR_UPDATE )
.tenantIdentifier( sessionContext.tenantIdentifier() )
.identifier( referenceProvider.identifier() )
.routingKey( referenceProvider.routingKey() )
diff --git a/util/internal/integrationtest/common/src/main/java/org/hibernate/search/util/impl/integrationtest/common/stub/backend/index/impl/StubIndexIndexingPlan.java b/util/internal/integrationtest/common/src/main/java/org/hibernate/search/util/impl/integrationtest/common/stub/backend/index/impl/StubIndexIndexingPlan.java
index 742cb66ebb1..9e36d7dc714 100644
--- a/util/internal/integrationtest/common/src/main/java/org/hibernate/search/util/impl/integrationtest/common/stub/backend/index/impl/StubIndexIndexingPlan.java
+++ b/util/internal/integrationtest/common/src/main/java/org/hibernate/search/util/impl/integrationtest/common/stub/backend/index/impl/StubIndexIndexingPlan.java
@@ -66,9 +66,9 @@ public void add(DocumentReferenceProvider documentReferenceProvider,
}
@Override
- public void update(DocumentReferenceProvider documentReferenceProvider,
+ public void addOrUpdate(DocumentReferenceProvider documentReferenceProvider,
DocumentContributor documentContributor) {
- StubDocumentWork.Builder builder = StubDocumentWork.builder( StubDocumentWork.Type.UPDATE );
+ StubDocumentWork.Builder builder = StubDocumentWork.builder( StubDocumentWork.Type.ADD_OR_UPDATE );
populate( builder, documentReferenceProvider );
StubDocumentNode.Builder documentBuilder = StubDocumentNode.document();
StubDocumentElement documentElement = new StubDocumentElement( documentBuilder );