Author: thomasm
Date: Mon May 11 17:13:49 2020
New Revision: 1877593

URL: http://svn.apache.org/viewvc?rev=1877593&view=rev
Log:
OAK-9035 LuceneIndexEditor should extend FulltextIndexEditor

Modified:
    
jackrabbit/oak/trunk/oak-lucene/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/LuceneIndexEditor.java
    
jackrabbit/oak/trunk/oak-lucene/src/test/java/org/apache/jackrabbit/oak/plugins/index/lucene/LuceneIndexEditor2Test.java
    
jackrabbit/oak/trunk/oak-lucene/src/test/java/org/apache/jackrabbit/oak/plugins/index/lucene/LuceneIndexEditorProviderTest.java
    
jackrabbit/oak/trunk/oak-search-elastic/src/main/java/org/apache/jackrabbit/oak/plugins/index/elasticsearch/index/ElasticsearchIndexEditor.java
    
jackrabbit/oak/trunk/oak-search-elastic/src/main/java/org/apache/jackrabbit/oak/plugins/index/elasticsearch/index/ElasticsearchIndexEditorProvider.java
    
jackrabbit/oak/trunk/oak-search/src/main/java/org/apache/jackrabbit/oak/plugins/index/search/spi/editor/FulltextIndexEditor.java

Modified: 
jackrabbit/oak/trunk/oak-lucene/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/LuceneIndexEditor.java
URL: 
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-lucene/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/LuceneIndexEditor.java?rev=1877593&r1=1877592&r2=1877593&view=diff
==============================================================================
--- 
jackrabbit/oak/trunk/oak-lucene/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/LuceneIndexEditor.java
 (original)
+++ 
jackrabbit/oak/trunk/oak-lucene/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/LuceneIndexEditor.java
 Mon May 11 17:13:49 2020
@@ -16,33 +16,10 @@
  */
 package org.apache.jackrabbit.oak.plugins.index.lucene;
 
-import java.io.IOException;
-import java.util.Collections;
-import java.util.List;
-import java.util.Set;
-
-import com.google.common.collect.Iterables;
-import com.google.common.collect.Lists;
-import com.google.common.collect.Sets;
-import org.apache.jackrabbit.oak.api.CommitFailedException;
-import org.apache.jackrabbit.oak.api.PropertyState;
-import org.apache.jackrabbit.oak.commons.PathUtils;
 import org.apache.jackrabbit.oak.plugins.index.IndexEditor;
-import org.apache.jackrabbit.oak.plugins.index.lucene.writer.LuceneIndexWriter;
-import org.apache.jackrabbit.oak.plugins.index.search.Aggregate;
-import org.apache.jackrabbit.oak.plugins.index.search.Aggregate.Matcher;
-import org.apache.jackrabbit.oak.plugins.index.search.IndexDefinition;
-import org.apache.jackrabbit.oak.plugins.index.search.PropertyDefinition;
-import org.apache.jackrabbit.oak.plugins.index.search.PropertyUpdateCallback;
-import org.apache.jackrabbit.oak.plugins.memory.EmptyNodeState;
-import org.apache.jackrabbit.oak.spi.commit.Editor;
-import org.apache.jackrabbit.oak.spi.filter.PathFilter;
-import org.apache.jackrabbit.oak.spi.state.NodeState;
+import 
org.apache.jackrabbit.oak.plugins.index.search.spi.editor.FulltextIndexEditor;
+import 
org.apache.jackrabbit.oak.plugins.index.search.spi.editor.FulltextIndexEditorContext;
 import org.apache.lucene.document.Document;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import static org.apache.jackrabbit.oak.commons.PathUtils.concat;
 
 /**
  * {@link IndexEditor} implementation that is responsible for keeping the
@@ -50,362 +27,9 @@ import static org.apache.jackrabbit.oak.
  *
  * @see LuceneIndex
  */
-public class LuceneIndexEditor implements IndexEditor, Aggregate.AggregateRoot 
{
-
-    private static final Logger log =
-            LoggerFactory.getLogger(LuceneIndexEditor.class);
-
-    private final LuceneIndexEditorContext context;
-
-    /**
-     * Name of this node, or {@code null} for the root node.
-     */
-    private final String name;
-
-    /**
-     * Parent editor or {@code null} if this is the root editor.
-     */
-    private final LuceneIndexEditor parent;
-
-    /**
-     * Path of this editor, built lazily in {@link #getPath()}.
-     */
-    private String path;
-
-    private boolean propertiesChanged = false;
-
-    private List<PropertyState> propertiesModified = Lists.newArrayList();
-
-    /**
-     * Flag indicating if the current tree being traversed has a deleted 
parent.
-     */
-    private final boolean isDeleted;
-
-    private IndexDefinition.IndexingRule indexingRule;
-
-    private List<Matcher> currentMatchers = Collections.emptyList();
-
-    private final MatcherState matcherState;
-
-    private final PathFilter.Result pathFilterResult;
-
-    LuceneIndexEditor(LuceneIndexEditorContext context) throws 
CommitFailedException {
-        this.parent = null;
-        this.name = null;
-        this.path = "/";
-        this.context = context;
-        this.isDeleted = false;
-        this.matcherState = MatcherState.NONE;
-        this.pathFilterResult = 
context.getDefinition().getPathFilter().filter(PathUtils.ROOT_PATH);
-    }
-
-    private LuceneIndexEditor(LuceneIndexEditor parent, String name,
-                              MatcherState matcherState,
-                              PathFilter.Result pathFilterResult,
-                              boolean isDeleted) {
-        this.parent = parent;
-        this.name = name;
-        this.path = null;
-        this.context = parent.context;
-        this.isDeleted = isDeleted;
-        this.matcherState = matcherState;
-        this.pathFilterResult = pathFilterResult;
-    }
-
-    public String getPath() {
-        if (path == null) { // => parent != null
-            path = concat(parent.getPath(), name);
-        }
-        return path;
-    }
-
-    @Override
-    public void enter(NodeState before, NodeState after)
-            throws CommitFailedException {
-        if (EmptyNodeState.MISSING_NODE == before && parent == null) {
-            context.enableReindexMode();
-        }
-
-        //Only check for indexing if the result is include.
-        //In case like TRAVERSE nothing needs to be indexed for those
-        //path
-        if (pathFilterResult == PathFilter.Result.INCLUDE) {
-            //For traversal in deleted sub tree before state has to be used
-            NodeState current = after.exists() ? after : before;
-            indexingRule = getDefinition().getApplicableIndexingRule(current);
-
-            if (indexingRule != null) {
-                currentMatchers = 
indexingRule.getAggregate().createMatchers(this);
-            }
-        }
-    }
-
-    @Override
-    public void leave(NodeState before, NodeState after)
-            throws CommitFailedException {
-        if (propertiesChanged || !before.exists()) {
-            String path = getPath();
-            if (addOrUpdate(path, after, before.exists())) {
-                long indexed = context.incIndexedNodes();
-                if (indexed % 1000 == 0) {
-                    log.debug("[{}] => Indexed {} nodes...", getIndexName(), 
indexed);
-                }
-            }
-        }
-
-        for (Matcher m : matcherState.affectedMatchers) {
-            m.markRootDirty();
-        }
-
-        if (parent == null) {
-            PropertyUpdateCallback callback = 
context.getPropertyUpdateCallback();
-            if (callback != null) {
-                callback.done();
-            }
-
-            try {
-                context.closeWriter();
-            } catch (IOException e) {
-                CommitFailedException ce = new CommitFailedException("Lucene", 
4,
-                        "Failed to close the Lucene index " + 
context.getIndexingContext().getIndexPath(), e);
-                context.getIndexingContext().indexUpdateFailed(ce);
-                throw ce;
-            }
-            if (context.getIndexedNodes() > 0) {
-                log.debug("[{}] => Indexed {} nodes, done.", getIndexName(), 
context.getIndexedNodes());
-            }
-        }
-    }
-
-    @Override
-    public void propertyAdded(PropertyState after) {
-        markPropertyChanged(after.getName());
-        checkAggregates(after.getName());
-        propertyUpdated(null, after);
-    }
-
-    @Override
-    public void propertyChanged(PropertyState before, PropertyState after) {
-        markPropertyChanged(before.getName());
-        propertiesModified.add(before);
-        checkAggregates(before.getName());
-        propertyUpdated(before, after);
-    }
-
-    @Override
-    public void propertyDeleted(PropertyState before) {
-        markPropertyChanged(before.getName());
-        propertiesModified.add(before);
-        checkAggregates(before.getName());
-        propertyUpdated(before, null);
-    }
-
-    @Override
-    public Editor childNodeAdded(String name, NodeState after) {
-        PathFilter.Result filterResult = getPathFilterResult(name);
-        if (filterResult != PathFilter.Result.EXCLUDE) {
-            return new LuceneIndexEditor(this, name, getMatcherState(name, 
after), filterResult, false);
-        }
-        return null;
-    }
-
-    @Override
-    public Editor childNodeChanged(
-            String name, NodeState before, NodeState after) {
-        PathFilter.Result filterResult = getPathFilterResult(name);
-        if (filterResult != PathFilter.Result.EXCLUDE) {
-            return new LuceneIndexEditor(this, name, getMatcherState(name, 
after), filterResult, false);
-        }
-        return null;
-    }
-
-    @Override
-    public Editor childNodeDeleted(String name, NodeState before)
-            throws CommitFailedException {
-        PathFilter.Result filterResult = getPathFilterResult(name);
-        if (filterResult == PathFilter.Result.EXCLUDE) {
-            return null;
-        }
-
-        if (!isDeleted) {
-            // tree deletion is handled on the parent node
-            String path = concat(getPath(), name);
-            try {
-                LuceneIndexWriter writer = context.getWriter();
-                // Remove all index entries in the removed subtree
-                writer.deleteDocuments(path);
-                this.context.indexUpdate();
-            } catch (IOException e) {
-                CommitFailedException ce = new CommitFailedException("Lucene", 
5, "Failed to remove the index entries of"
-                        + " the removed subtree " + path + "for index " + 
context.getIndexingContext().getIndexPath(), e);
-                context.getIndexingContext().indexUpdateFailed(ce);
-                throw ce;
-            }
-        }
-
-        MatcherState ms = getMatcherState(name, before);
-        if (!ms.isEmpty()) {
-            return new LuceneIndexEditor(this, name, ms, filterResult, true);
-        }
-        return null; // no need to recurse down the removed subtree
-    }
-
-    LuceneIndexEditorContext getContext() {
-        return context;
-    }
-
-    private boolean addOrUpdate(String path, NodeState state, boolean isUpdate)
-            throws CommitFailedException {
-        try {
-            Document d = makeDocument(path, state, isUpdate);
-            if (d != null) {
-                if (log.isTraceEnabled()) {
-                    log.trace("[{}] Indexed document for {} is {}", 
getIndexName(), path, d);
-                }
-                context.indexUpdate();
-                context.getWriter().updateDocument(path, d);
-                return true;
-            }
-        } catch (IOException e) {
-            log.warn("Failed to index the node [{}] due to {}", path, 
e.getMessage());
-            CommitFailedException ce = new CommitFailedException("Lucene", 3,
-                    "Failed to index the node " + path, e);
-            context.getIndexingContext().indexUpdateFailed(ce);
-            throw ce;
-        } catch (IllegalArgumentException ie) {
-            log.warn("Failed to index the node [{}]", path, ie);
-        }
-        return false;
-    }
-
-    private Document makeDocument(String path, NodeState state, boolean 
isUpdate) throws IOException {
-        if (!isIndexable()) {
-            return null;
-        }
-        return context.newDocumentMaker(indexingRule, 
path).makeDocument(state, isUpdate, propertiesModified);
-    }
-
-
-    //~-------------------------------------------------------< Aggregate >
-
-    @Override
-    public void markDirty() {
-        propertiesChanged = true;
-    }
-
-    private MatcherState getMatcherState(String name, NodeState after) {
-        List<Matcher> matched = Lists.newArrayList();
-        List<Matcher> inherited = Lists.newArrayList();
-        for (Matcher m : Iterables.concat(matcherState.inherited, 
currentMatchers)) {
-            Matcher result = m.match(name, after);
-            if (result.getStatus() == Matcher.Status.MATCH_FOUND) {
-                matched.add(result);
-            }
-
-            if (result.getStatus() != Matcher.Status.FAIL) {
-                inherited.addAll(result.nextSet());
-            }
-        }
-
-        if (!matched.isEmpty() || !inherited.isEmpty()) {
-            return new MatcherState(matched, inherited);
-        }
-        return MatcherState.NONE;
-    }
-
-
-    /**
-     * Determines which all matchers are affected by this property change
-     *
-     * @param name modified property name
-     */
-    private void checkAggregates(String name) {
-        for (Matcher m : matcherState.matched) {
-            if (!matcherState.affectedMatchers.contains(m)
-                    && m.aggregatesProperty(name)) {
-                matcherState.affectedMatchers.add(m);
-            }
-        }
-    }
-
-    private static class MatcherState {
-        final static MatcherState NONE = new 
MatcherState(Collections.<Matcher>emptyList(),
-                Collections.<Matcher>emptyList());
-
-        final List<Matcher> matched;
-        final List<Matcher> inherited;
-        final Set<Matcher> affectedMatchers;
-
-        public MatcherState(List<Matcher> matched,
-                            List<Matcher> inherited) {
-            this.matched = matched;
-            this.inherited = inherited;
-
-            //Affected matches would only be used when there are
-            //some matched matchers
-            if (matched.isEmpty()) {
-                affectedMatchers = Collections.emptySet();
-            } else {
-                affectedMatchers = Sets.newIdentityHashSet();
-            }
-        }
-
-        public boolean isEmpty() {
-            return matched.isEmpty() && inherited.isEmpty();
-        }
-    }
-
-    private void markPropertyChanged(String name) {
-        if (isIndexable()
-                && !propertiesChanged
-                && indexingRule.isIndexed(name)) {
-            propertiesChanged = true;
-        }
-    }
-
-    private void propertyUpdated(PropertyState before, PropertyState after) {
-        PropertyUpdateCallback callback = context.getPropertyUpdateCallback();
-
-        //Avoid further work if no callback is present
-        if (callback == null) {
-            return;
-        }
-
-        String propertyName = before != null ? before.getName() : 
after.getName();
-
-        if (isIndexable()) {
-            PropertyDefinition pd = indexingRule.getConfig(propertyName);
-            if (pd != null) {
-                callback.propertyUpdated(getPath(), propertyName, pd, before, 
after);
-            }
-        }
-
-        for (Matcher m : matcherState.matched) {
-            if (m.aggregatesProperty(propertyName)) {
-                Aggregate.Include i = m.getCurrentInclude();
-                if (i instanceof Aggregate.PropertyInclude) {
-                    PropertyDefinition pd = ((Aggregate.PropertyInclude) 
i).getPropertyDefinition();
-                    String propertyRelativePath = 
PathUtils.concat(m.getMatchedPath(), propertyName);
-
-                    callback.propertyUpdated(m.getRootPath(), 
propertyRelativePath, pd, before, after);
-                }
-            }
-        }
-    }
-
-    private IndexDefinition getDefinition() {
-        return context.getDefinition();
-    }
-
-    private boolean isIndexable() {
-        return indexingRule != null;
-    }
-
-    private PathFilter.Result getPathFilterResult(String childNodeName) {
-        return 
context.getDefinition().getPathFilter().filter(concat(getPath(), 
childNodeName));
-    }
+class LuceneIndexEditor extends FulltextIndexEditor<Document> {
 
-    private String getIndexName() {
-        return context.getDefinition().getIndexName();
+    LuceneIndexEditor(FulltextIndexEditorContext<Document> context) {
+        super(context);
     }
 }

Modified: 
jackrabbit/oak/trunk/oak-lucene/src/test/java/org/apache/jackrabbit/oak/plugins/index/lucene/LuceneIndexEditor2Test.java
URL: 
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-lucene/src/test/java/org/apache/jackrabbit/oak/plugins/index/lucene/LuceneIndexEditor2Test.java?rev=1877593&r1=1877592&r2=1877593&view=diff
==============================================================================
--- 
jackrabbit/oak/trunk/oak-lucene/src/test/java/org/apache/jackrabbit/oak/plugins/index/lucene/LuceneIndexEditor2Test.java
 (original)
+++ 
jackrabbit/oak/trunk/oak-lucene/src/test/java/org/apache/jackrabbit/oak/plugins/index/lucene/LuceneIndexEditor2Test.java
 Mon May 11 17:13:49 2020
@@ -33,9 +33,6 @@ import org.apache.jackrabbit.oak.plugins
 import org.apache.jackrabbit.oak.plugins.index.IndexUpdateCallback;
 import org.apache.jackrabbit.oak.plugins.index.IndexUpdateProvider;
 import org.apache.jackrabbit.oak.plugins.index.IndexingContext;
-import org.apache.jackrabbit.oak.plugins.index.lucene.LuceneIndexEditor;
-import org.apache.jackrabbit.oak.plugins.index.lucene.LuceneIndexEditorContext;
-import org.apache.jackrabbit.oak.plugins.index.lucene.TestUtil;
 import 
org.apache.jackrabbit.oak.plugins.index.lucene.util.IndexDefinitionBuilder;
 import org.apache.jackrabbit.oak.plugins.index.lucene.writer.LuceneIndexWriter;
 import org.apache.jackrabbit.oak.plugins.index.search.ExtractedTextCache;
@@ -201,8 +198,7 @@ public class LuceneIndexEditor2Test {
             @Nullable
             @Override
             public Editor getIndexEditor(@NotNull String type, @NotNull 
NodeBuilder definition,
-                                         @NotNull NodeState root, @NotNull 
IndexUpdateCallback callback)
-                    throws CommitFailedException {
+                                         @NotNull NodeState root, @NotNull 
IndexUpdateCallback callback) {
                 if (TYPE_LUCENE.equals(type)) {
                     return new LuceneIndexEditor(context);
                 }

Modified: 
jackrabbit/oak/trunk/oak-lucene/src/test/java/org/apache/jackrabbit/oak/plugins/index/lucene/LuceneIndexEditorProviderTest.java
URL: 
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-lucene/src/test/java/org/apache/jackrabbit/oak/plugins/index/lucene/LuceneIndexEditorProviderTest.java?rev=1877593&r1=1877592&r2=1877593&view=diff
==============================================================================
--- 
jackrabbit/oak/trunk/oak-lucene/src/test/java/org/apache/jackrabbit/oak/plugins/index/lucene/LuceneIndexEditorProviderTest.java
 (original)
+++ 
jackrabbit/oak/trunk/oak-lucene/src/test/java/org/apache/jackrabbit/oak/plugins/index/lucene/LuceneIndexEditorProviderTest.java
 Mon May 11 17:13:49 2020
@@ -27,14 +27,9 @@ import org.apache.jackrabbit.oak.plugins
 import org.apache.jackrabbit.oak.plugins.index.IndexCommitCallback;
 import org.apache.jackrabbit.oak.plugins.index.IndexUpdateCallback;
 import org.apache.jackrabbit.oak.plugins.index.IndexingContext;
-import org.apache.jackrabbit.oak.plugins.index.lucene.IndexTracker;
-import org.apache.jackrabbit.oak.plugins.index.lucene.LuceneIndexDefinition;
-import org.apache.jackrabbit.oak.plugins.index.lucene.LuceneIndexEditor;
-import org.apache.jackrabbit.oak.plugins.index.lucene.LuceneIndexEditorContext;
-import 
org.apache.jackrabbit.oak.plugins.index.lucene.LuceneIndexEditorProvider;
-import org.apache.jackrabbit.oak.plugins.index.lucene.TestUtil;
 import org.apache.jackrabbit.oak.plugins.index.lucene.hybrid.DocumentQueue;
 import org.apache.jackrabbit.oak.plugins.index.search.FulltextIndexConstants;
+import 
org.apache.jackrabbit.oak.plugins.index.search.spi.editor.FulltextIndexEditorContext;
 import org.apache.jackrabbit.oak.spi.commit.CommitContext;
 import org.apache.jackrabbit.oak.spi.commit.CommitInfo;
 import org.apache.jackrabbit.oak.spi.commit.Editor;
@@ -42,6 +37,7 @@ import org.apache.jackrabbit.oak.spi.com
 import org.apache.jackrabbit.oak.spi.mount.Mounts;
 import org.apache.jackrabbit.oak.spi.state.NodeBuilder;
 import org.apache.jackrabbit.oak.spi.state.NodeState;
+import org.apache.lucene.document.Document;
 import org.junit.Test;
 
 import static org.apache.jackrabbit.oak.InitialContentHelper.INITIAL_CONTENT;
@@ -102,7 +98,7 @@ public class LuceneIndexEditorProviderTe
         NodeBuilder defnBuilder = createIndexDefinition("fooIndex").builder();
         Editor editor = editorProvider.getIndexEditor(TYPE_LUCENE, 
defnBuilder, root, callback);
         LuceneIndexEditor luceneEditor = (LuceneIndexEditor) editor;
-        LuceneIndexEditorContext context = luceneEditor.getContext();
+        FulltextIndexEditorContext<Document> context = 
luceneEditor.getContext();
 
         //Definition should reflect the marker property
         assertEquals("bar", 
context.getDefinition().getDefinitionNodeState().getString("foo"));
@@ -191,4 +187,4 @@ public class LuceneIndexEditorProviderTe
         }
     }
 
-}
\ No newline at end of file
+}

Modified: 
jackrabbit/oak/trunk/oak-search-elastic/src/main/java/org/apache/jackrabbit/oak/plugins/index/elasticsearch/index/ElasticsearchIndexEditor.java
URL: 
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-search-elastic/src/main/java/org/apache/jackrabbit/oak/plugins/index/elasticsearch/index/ElasticsearchIndexEditor.java?rev=1877593&r1=1877592&r2=1877593&view=diff
==============================================================================
--- 
jackrabbit/oak/trunk/oak-search-elastic/src/main/java/org/apache/jackrabbit/oak/plugins/index/elasticsearch/index/ElasticsearchIndexEditor.java
 (original)
+++ 
jackrabbit/oak/trunk/oak-search-elastic/src/main/java/org/apache/jackrabbit/oak/plugins/index/elasticsearch/index/ElasticsearchIndexEditor.java
 Mon May 11 17:13:49 2020
@@ -16,7 +16,6 @@
  */
 package org.apache.jackrabbit.oak.plugins.index.elasticsearch.index;
 
-import org.apache.jackrabbit.oak.api.CommitFailedException;
 import org.apache.jackrabbit.oak.plugins.index.IndexEditor;
 import 
org.apache.jackrabbit.oak.plugins.index.search.spi.editor.FulltextIndexEditor;
 import 
org.apache.jackrabbit.oak.plugins.index.search.spi.editor.FulltextIndexEditorContext;
@@ -26,7 +25,7 @@ import org.apache.jackrabbit.oak.plugins
  * corresponding Elasticsearch index up to date
  */
 class ElasticsearchIndexEditor extends 
FulltextIndexEditor<ElasticsearchDocument> {
-    ElasticsearchIndexEditor(FulltextIndexEditorContext<ElasticsearchDocument> 
context) throws CommitFailedException {
+    ElasticsearchIndexEditor(FulltextIndexEditorContext<ElasticsearchDocument> 
context) {
         super(context);
     }
 }

Modified: 
jackrabbit/oak/trunk/oak-search-elastic/src/main/java/org/apache/jackrabbit/oak/plugins/index/elasticsearch/index/ElasticsearchIndexEditorProvider.java
URL: 
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-search-elastic/src/main/java/org/apache/jackrabbit/oak/plugins/index/elasticsearch/index/ElasticsearchIndexEditorProvider.java?rev=1877593&r1=1877592&r2=1877593&view=diff
==============================================================================
--- 
jackrabbit/oak/trunk/oak-search-elastic/src/main/java/org/apache/jackrabbit/oak/plugins/index/elasticsearch/index/ElasticsearchIndexEditorProvider.java
 (original)
+++ 
jackrabbit/oak/trunk/oak-search-elastic/src/main/java/org/apache/jackrabbit/oak/plugins/index/elasticsearch/index/ElasticsearchIndexEditorProvider.java
 Mon May 11 17:13:49 2020
@@ -16,7 +16,6 @@
  */
 package org.apache.jackrabbit.oak.plugins.index.elasticsearch.index;
 
-import org.apache.jackrabbit.oak.api.CommitFailedException;
 import org.apache.jackrabbit.oak.plugins.index.ContextAwareCallback;
 import org.apache.jackrabbit.oak.plugins.index.IndexEditorProvider;
 import org.apache.jackrabbit.oak.plugins.index.IndexUpdateCallback;
@@ -46,7 +45,7 @@ public class ElasticsearchIndexEditorPro
     @Override
     public @Nullable Editor getIndexEditor(@NotNull String type,
                                            @NotNull NodeBuilder definition, 
@NotNull NodeState root,
-                                           @NotNull IndexUpdateCallback 
callback) throws CommitFailedException {
+                                           @NotNull IndexUpdateCallback 
callback) {
         if (TYPE_ELASTICSEARCH.equals(type)) {
             if (!(callback instanceof ContextAwareCallback)) {
                 throw new IllegalStateException("callback instance not of type 
ContextAwareCallback [" + callback + "]");

Modified: 
jackrabbit/oak/trunk/oak-search/src/main/java/org/apache/jackrabbit/oak/plugins/index/search/spi/editor/FulltextIndexEditor.java
URL: 
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-search/src/main/java/org/apache/jackrabbit/oak/plugins/index/search/spi/editor/FulltextIndexEditor.java?rev=1877593&r1=1877592&r2=1877593&view=diff
==============================================================================
--- 
jackrabbit/oak/trunk/oak-search/src/main/java/org/apache/jackrabbit/oak/plugins/index/search/spi/editor/FulltextIndexEditor.java
 (original)
+++ 
jackrabbit/oak/trunk/oak-search/src/main/java/org/apache/jackrabbit/oak/plugins/index/search/spi/editor/FulltextIndexEditor.java
 Mon May 11 17:13:49 2020
@@ -59,7 +59,7 @@ public class FulltextIndexEditor<D> impl
   private final String name;
 
   /* Parent editor or {@code null} if this is the root editor. */
-  private final FulltextIndexEditor parent;
+  private final FulltextIndexEditor<D> parent;
 
   /* Path of this editor, built lazily in {@link #getPath()}. */
   private String path;
@@ -81,7 +81,7 @@ public class FulltextIndexEditor<D> impl
 
   private final PathFilter.Result pathFilterResult;
 
-  public FulltextIndexEditor(FulltextIndexEditorContext<D> context) throws 
CommitFailedException {
+  public FulltextIndexEditor(FulltextIndexEditorContext<D> context) {
     this.parent = null;
     this.name = null;
     this.path = "/";
@@ -222,7 +222,7 @@ public class FulltextIndexEditor<D> impl
       // tree deletion is handled on the parent node
       String path = concat(getPath(), name);
       try {
-        FulltextIndexWriter writer = context.getWriter();
+        FulltextIndexWriter<D> writer = context.getWriter();
         // Remove all index entries in the removed subtree
         writer.deleteDocuments(path);
         this.context.indexUpdate();
@@ -241,7 +241,7 @@ public class FulltextIndexEditor<D> impl
     return null; // no need to recurse down the removed subtree
   }
 
-  FulltextIndexEditorContext<D> getContext() {
+  public FulltextIndexEditorContext<D> getContext() {
     return context;
   }
 


Reply via email to