You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oak-commits@jackrabbit.apache.org by al...@apache.org on 2013/04/04 16:14:53 UTC
svn commit: r1464563 -
/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/IndexHookManagerDiff.java
Author: alexparvulescu
Date: Thu Apr 4 14:14:53 2013
New Revision: 1464563
URL: http://svn.apache.org/r1464563
Log:
OAK-734 Refactor indexing code to use Editors - fixed reindex
Modified:
jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/IndexHookManagerDiff.java
Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/IndexHookManagerDiff.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/IndexHookManagerDiff.java?rev=1464563&r1=1464562&r2=1464563&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/IndexHookManagerDiff.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/IndexHookManagerDiff.java Thu Apr 4 14:14:53 2013
@@ -61,10 +61,11 @@ class IndexHookManagerDiff implements Ed
@Override
public void enter(NodeState before, NodeState after)
throws CommitFailedException {
- if (after != null && after.hasChildNode(INDEX_DEFINITIONS_NAME)) {
+ NodeState ref = node.getNodeState();
+ if (ref.hasChildNode(INDEX_DEFINITIONS_NAME)) {
Set<String> existingTypes = new HashSet<String>();
Set<String> reindexTypes = new HashSet<String>();
- NodeState index = after.getChildNode(INDEX_DEFINITIONS_NAME);
+ NodeState index = ref.getChildNode(INDEX_DEFINITIONS_NAME);
for (String indexName : index.getChildNodeNames()) {
NodeState indexChild = index.getChildNode(indexName);
if (isIndexNodeType(indexChild.getProperty(JCR_PRIMARYTYPE))) {
@@ -94,17 +95,19 @@ class IndexHookManagerDiff implements Ed
for (String type : existingTypes) {
List<? extends IndexHook> hooksTmp = provider.getIndexHooks(
type, node);
- hooks.addAll(hooksTmp);
if (reindexTypes.contains(type)) {
reindex.addAll(hooksTmp);
+ } else {
+ hooks.addAll(hooksTmp);
}
}
+ for (IndexHook ih : reindex) {
+ ih.enter(before, after);
+ ih.reindex(ref);
+ }
if (!hooks.isEmpty()) {
this.inner = new CompositeEditor(hooks);
this.inner.enter(before, after);
- for (IndexHook ih : reindex) {
- ih.reindex(after);
- }
}
}
}