bhabegger commented on code in PR #2938:
URL: https://github.com/apache/jackrabbit-oak/pull/2938#discussion_r3380145004


##########
oak-search/src/main/java/org/apache/jackrabbit/oak/plugins/index/search/spi/editor/FulltextIndexEditor.java:
##########
@@ -158,6 +164,19 @@ public void leave(NodeState before, NodeState after)
             }
         }
 
+        if (wasIndexable && !isIndexable()) {

Review Comment:
   [AI] Done — I've restructured `leave()` to use staged logic as suggested:
   
   ```java
   boolean toBeDeleted = wasIndexable && !isIndexable();
   boolean toBeAdded   = !wasIndexable && isIndexable();
   boolean toBeUpdated = wasIndexable && isIndexable() && propertiesChanged;
   
   if (toBeDeleted) {
       // deleteDocuments
   } else if (toBeAdded || toBeUpdated) {
       // addOrUpdate
   }
   ```
   
   The `else if` makes the mutual exclusivity explicit. I combined `toBeAdded` 
and `toBeUpdated` into a single branch since the action (`addOrUpdate`) is 
identical for both — the `before.exists()` flag already encodes the 
add-vs-update distinction passed into the writer.
   
   All 1242 oak-lucene tests still pass.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to