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 ng...@apache.org on 2020/04/13 05:39:45 UTC
svn commit: r1876444 -
/jackrabbit/oak/trunk/oak-benchmarks-lucene/src/main/java/org/apache/jackrabbit/oak/benchmark/LuceneFullTextWithGlobalIndexSearchTest.java
Author: ngupta
Date: Mon Apr 13 05:39:45 2020
New Revision: 1876444
URL: http://svn.apache.org/viewvc?rev=1876444&view=rev
Log:
OAK-9005 | Adding a file that was non versioned and got missed in the last commit.
Added:
jackrabbit/oak/trunk/oak-benchmarks-lucene/src/main/java/org/apache/jackrabbit/oak/benchmark/LuceneFullTextWithGlobalIndexSearchTest.java
Added: jackrabbit/oak/trunk/oak-benchmarks-lucene/src/main/java/org/apache/jackrabbit/oak/benchmark/LuceneFullTextWithGlobalIndexSearchTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-benchmarks-lucene/src/main/java/org/apache/jackrabbit/oak/benchmark/LuceneFullTextWithGlobalIndexSearchTest.java?rev=1876444&view=auto
==============================================================================
--- jackrabbit/oak/trunk/oak-benchmarks-lucene/src/main/java/org/apache/jackrabbit/oak/benchmark/LuceneFullTextWithGlobalIndexSearchTest.java (added)
+++ jackrabbit/oak/trunk/oak-benchmarks-lucene/src/main/java/org/apache/jackrabbit/oak/benchmark/LuceneFullTextWithGlobalIndexSearchTest.java Mon Apr 13 05:39:45 2020
@@ -0,0 +1,77 @@
+/*
+ * 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.benchmark;
+
+
+import org.apache.jackrabbit.oak.Oak;
+import org.apache.jackrabbit.oak.fixture.JcrCreator;
+import org.apache.jackrabbit.oak.fixture.OakRepositoryFixture;
+import org.apache.jackrabbit.oak.fixture.RepositoryFixture;
+import org.apache.jackrabbit.oak.jcr.Jcr;
+import org.apache.jackrabbit.oak.plugins.index.lucene.IndexCopier;
+import org.apache.jackrabbit.oak.plugins.index.lucene.LuceneIndexEditorProvider;
+import org.apache.jackrabbit.oak.plugins.index.lucene.LuceneIndexProvider;
+import org.apache.jackrabbit.oak.plugins.index.lucene.util.LuceneInitializerHelper;
+import org.apache.jackrabbit.oak.spi.commit.Observer;
+import org.apache.jackrabbit.oak.spi.query.QueryIndexProvider;
+
+import javax.jcr.Repository;
+import java.io.File;
+import java.io.IOException;
+
+public class LuceneFullTextWithGlobalIndexSearchTest extends SearchTest {
+
+ private final boolean disableCopyOnRead = Boolean.getBoolean("disableCopyOnRead");
+
+ public LuceneFullTextWithGlobalIndexSearchTest(File dump, boolean flat, boolean doReport, Boolean storageEnabled) {
+ super(dump, flat, doReport, storageEnabled);
+ }
+
+
+ @Override
+ protected Repository[] createRepository(RepositoryFixture fixture) throws Exception {
+ if (fixture instanceof OakRepositoryFixture) {
+ return ((OakRepositoryFixture) fixture).setUpCluster(1, new JcrCreator() {
+ @Override
+ public Jcr customize(Oak oak) {
+ LuceneIndexProvider provider = createLuceneIndexProvider();
+ oak.with((QueryIndexProvider) provider)
+ .with((Observer) provider)
+ .with(new LuceneIndexEditorProvider())
+ .with(new LuceneInitializerHelper("luceneGlobal", storageEnabled))
+ .with(new UUIDInitializer());
+ return new Jcr(oak);
+ }
+ });
+ }
+ return super.createRepository(fixture);
+ }
+
+ private LuceneIndexProvider createLuceneIndexProvider() {
+ if (!disableCopyOnRead) {
+ try {
+ IndexCopier copier = new IndexCopier(executorService, indexCopierDir, true);
+ return new LuceneIndexProvider(copier);
+ } catch (IOException e) {
+ throw new RuntimeException(e);
+ }
+ }
+ return new LuceneIndexProvider();
+ }
+}