bhabegger commented on code in PR #2817: URL: https://github.com/apache/jackrabbit-oak/pull/2817#discussion_r4255259210
########## oak-search-lucene-ng/src/main/java/org/apache/jackrabbit/oak/plugins/index/luceneNg/LuceneNgIndexEditorProvider.java: ########## @@ -0,0 +1,94 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.jackrabbit.oak.plugins.index.luceneNg; + +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; +import org.apache.jackrabbit.oak.plugins.index.IndexingContext; +import org.apache.jackrabbit.oak.plugins.index.luceneNg.internal.editor.LuceneNgIndexEditorContext; +import org.apache.jackrabbit.oak.plugins.index.luceneNg.directory.LuceneNgIndexCopier; +import org.apache.jackrabbit.oak.spi.commit.Editor; +import org.apache.jackrabbit.oak.spi.state.NodeBuilder; +import org.apache.jackrabbit.oak.spi.state.NodeState; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * IndexEditorProvider for Lucene 9 indexes. + * Routes index write operations to Lucene 9 editor for luceneNg type indexes. + */ +public class LuceneNgIndexEditorProvider implements IndexEditorProvider { + private static final Logger LOG = LoggerFactory.getLogger(LuceneNgIndexEditorProvider.class); + + private final LuceneNgIndexTracker indexTracker; + @Nullable + private final LuceneNgIndexCopier copier; + + /** + * Creates a new LuceneNgIndexEditorProvider. + * + * @param indexTracker the index tracker for managing index lifecycle + */ + public LuceneNgIndexEditorProvider(@NotNull LuceneNgIndexTracker indexTracker) { + this(indexTracker, null); + } + + public LuceneNgIndexEditorProvider(@NotNull LuceneNgIndexTracker indexTracker, + @Nullable LuceneNgIndexCopier copier) { + this.indexTracker = indexTracker; + this.copier = copier; + } + + @Override + @Nullable + public Editor getIndexEditor(@NotNull String type, + @NotNull NodeBuilder definition, + @NotNull NodeState root, + @NotNull IndexUpdateCallback callback) + throws CommitFailedException { + + // Only handle luceneNg type indexes + if (!LuceneNgIndexConstants.TYPE_LUCENE_NG.equals(type)) { + return null; + } Review Comment: Yes, indeed we should ignore the nested indices both at index and query time. On it -- 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]
