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 to...@apache.org on 2013/10/10 10:53:33 UTC
svn commit: r1530880 [2/2] - in /jackrabbit/oak/trunk: oak-parent/
oak-solr-core/
oak-solr-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/solr/
oak-solr-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/solr/configuration/
oak-solr...
Added: jackrabbit/oak/trunk/oak-solr-core/src/main/resources/solr/oak/conf/solrconfig.xml
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-solr-core/src/main/resources/solr/oak/conf/solrconfig.xml?rev=1530880&view=auto
==============================================================================
--- jackrabbit/oak/trunk/oak-solr-core/src/main/resources/solr/oak/conf/solrconfig.xml (added)
+++ jackrabbit/oak/trunk/oak-solr-core/src/main/resources/solr/oak/conf/solrconfig.xml Thu Oct 10 08:53:31 2013
@@ -0,0 +1,373 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!--
+ 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.
+-->
+
+<!--
+ For more details about configurations options that may appear in
+ this file, see http://wiki.apache.org/solr/SolrConfigXml.
+-->
+<config>
+
+ <luceneMatchVersion>LUCENE_40</luceneMatchVersion>
+
+ <dataDir>${solr.data.dir:}</dataDir>
+
+ <directoryFactory name="DirectoryFactory"
+ class="${solr.directoryFactory:solr.MMapDirectoryFactory}"/>
+
+
+ <indexConfig>
+
+ <lockType>native</lockType>
+
+ </indexConfig>
+
+
+ <jmx/>
+
+ <updateHandler class="solr.DirectUpdateHandler2">
+
+ <updateLog>
+ <str name="dir">${solr.data.dir:}</str>
+ </updateLog>
+
+
+ </updateHandler>
+
+
+ <query>
+
+ <maxBooleanClauses>10240</maxBooleanClauses>
+
+
+ <filterCache class="solr.FastLRUCache"
+ size="512"
+ initialSize="512"
+ autowarmCount="0"/>
+
+ <queryResultCache class="solr.LRUCache"
+ size="512"
+ initialSize="512"
+ autowarmCount="0"/>
+
+ <documentCache class="solr.LRUCache"
+ size="512"
+ initialSize="512"
+ autowarmCount="0"/>
+
+
+ <enableLazyFieldLoading>true</enableLazyFieldLoading>
+
+ <queryResultWindowSize>20</queryResultWindowSize>
+
+ <queryResultMaxDocsCached>200</queryResultMaxDocsCached>
+
+ <useColdSearcher>true</useColdSearcher>
+
+ <maxWarmingSearchers>2</maxWarmingSearchers>
+
+ </query>
+
+
+ <requestDispatcher handleSelect="false">
+
+ <requestParsers enableRemoteStreaming="true"
+ multipartUploadLimitInKB="2048000"/>
+
+ <httpCaching never304="true"/>
+
+ </requestDispatcher>
+
+ <requestHandler name="/select" class="solr.SearchHandler">
+ <lst name="defaults">
+ <str name="echoParams">explicit</str>
+ <int name="rows">10</int>
+ <str name="df">text</str>
+ </lst>
+
+ </requestHandler>
+
+ <requestHandler name="/query" class="solr.SearchHandler">
+ <lst name="defaults">
+ <str name="echoParams">explicit</str>
+ <str name="wt">json</str>
+ <str name="indent">true</str>
+ <str name="df">text</str>
+ </lst>
+ </requestHandler>
+
+
+ <requestHandler name="/get" class="solr.RealTimeGetHandler">
+ <lst name="defaults">
+ <str name="omitHeader">true</str>
+ <str name="wt">json</str>
+ <str name="indent">true</str>
+ </lst>
+ </requestHandler>
+
+
+ <requestHandler name="/update" class="solr.UpdateRequestHandler">
+
+ </requestHandler>
+
+ <requestHandler name="/update/json" class="solr.JsonUpdateRequestHandler">
+ <lst name="defaults">
+ <str name="stream.contentType">application/json</str>
+ </lst>
+ </requestHandler>
+ <requestHandler name="/update/csv" class="solr.CSVRequestHandler">
+ <lst name="defaults">
+ <str name="stream.contentType">application/csv</str>
+ </lst>
+ </requestHandler>
+
+ <requestHandler name="/update/extract"
+ startup="lazy"
+ class="solr.extraction.ExtractingRequestHandler">
+ <lst name="defaults">
+ <str name="lowernames">true</str>
+ <str name="uprefix">ignored_</str>
+
+ <str name="captureAttr">true</str>
+ <str name="fmap.a">links</str>
+ <str name="fmap.div">ignored_</str>
+ </lst>
+ </requestHandler>
+
+
+ <requestHandler name="/analysis/field"
+ startup="lazy"
+ class="solr.FieldAnalysisRequestHandler"/>
+
+
+ <requestHandler name="/analysis/document"
+ class="solr.DocumentAnalysisRequestHandler"
+ startup="lazy"/>
+
+ <requestHandler name="/admin/"
+ class="solr.admin.AdminHandlers"/>
+
+ <requestHandler name="/admin/ping" class="solr.PingRequestHandler">
+ <lst name="invariants">
+ <str name="q">solrpingquery</str>
+ </lst>
+ <lst name="defaults">
+ <str name="echoParams">all</str>
+ </lst>
+ </requestHandler>
+
+ <requestHandler name="/debug/dump" class="solr.DumpRequestHandler">
+ <lst name="defaults">
+ <str name="echoParams">explicit</str>
+ <str name="echoHandler">true</str>
+ </lst>
+ </requestHandler>
+
+ <requestHandler name="/replication" class="solr.ReplicationHandler">
+ </requestHandler>
+
+
+ <searchComponent name="spellcheck" class="solr.SpellCheckComponent">
+
+ <str name="queryAnalyzerFieldType">textSpell</str>
+
+ <!-- a spellchecker built from a field of the main index -->
+ <lst name="spellchecker">
+ <str name="name">default</str>
+ <str name="field">name</str>
+ <str name="classname">solr.DirectSolrSpellChecker</str>
+ <!-- the spellcheck distance measure used, the default is the internal levenshtein -->
+ <str name="distanceMeasure">internal</str>
+ <!-- minimum accuracy needed to be considered a valid spellcheck suggestion -->
+ <float name="accuracy">0.5</float>
+ <!-- the maximum #edits we consider when enumerating terms: can be 1 or 2 -->
+ <int name="maxEdits">2</int>
+ <!-- the minimum shared prefix when enumerating terms -->
+ <int name="minPrefix">1</int>
+ <!-- maximum number of inspections per result. -->
+ <int name="maxInspections">5</int>
+ <!-- minimum length of a query term to be considered for correction -->
+ <int name="minQueryLength">4</int>
+ <!-- maximum threshold of documents a query term can appear to be considered for correction -->
+ <float name="maxQueryFrequency">0.01</float>
+ <!-- uncomment this to require suggestions to occur in 1% of the documents
+ <float name="thresholdTokenFrequency">.01</float>
+ -->
+ </lst>
+
+ <!-- a spellchecker that can break or combine words. See "/spell" handler below for usage -->
+ <lst name="spellchecker">
+ <str name="name">wordbreak</str>
+ <str name="classname">solr.WordBreakSolrSpellChecker</str>
+ <str name="field">name</str>
+ <str name="combineWords">true</str>
+ <str name="breakWords">true</str>
+ <int name="maxChanges">10</int>
+ </lst>
+
+
+ </searchComponent>
+
+
+ <searchComponent name="tvComponent" class="solr.TermVectorComponent"/>
+
+ <requestHandler name="/tvrh" class="solr.SearchHandler" startup="lazy">
+ <lst name="defaults">
+ <str name="df">text</str>
+ <bool name="tv">true</bool>
+ </lst>
+ <arr name="last-components">
+ <str>tvComponent</str>
+ </arr>
+ </requestHandler>
+
+
+ <searchComponent name="terms" class="solr.TermsComponent"/>
+
+ <requestHandler name="/terms" class="solr.SearchHandler" startup="lazy">
+ <lst name="defaults">
+ <bool name="terms">true</bool>
+ </lst>
+ <arr name="components">
+ <str>terms</str>
+ </arr>
+ </requestHandler>
+
+
+ <searchComponent class="solr.HighlightComponent" name="highlight">
+ <highlighting>
+ <!-- Configure the standard fragmenter -->
+ <!-- This could most likely be commented out in the "default" case -->
+ <fragmenter name="gap"
+ default="true"
+ class="solr.highlight.GapFragmenter">
+ <lst name="defaults">
+ <int name="hl.fragsize">100</int>
+ </lst>
+ </fragmenter>
+
+ <!-- A regular-expression-based fragmenter
+ (for sentence extraction)
+ -->
+ <fragmenter name="regex"
+ class="solr.highlight.RegexFragmenter">
+ <lst name="defaults">
+ <!-- slightly smaller fragsizes work better because of slop -->
+ <int name="hl.fragsize">70</int>
+ <!-- allow 50% slop on fragment sizes -->
+ <float name="hl.regex.slop">0.5</float>
+ <!-- a basic sentence pattern -->
+ <str name="hl.regex.pattern">[-\w
+ ,/\n\"']{20,200}
+ </str>
+ </lst>
+ </fragmenter>
+
+ <!-- Configure the standard formatter -->
+ <formatter name="html"
+ default="true"
+ class="solr.highlight.HtmlFormatter">
+ <lst name="defaults">
+ <str name="hl.simple.pre"><![CDATA[<em>]]></str>
+ <str name="hl.simple.post"><![CDATA[</em>]]></str>
+ </lst>
+ </formatter>
+
+ <!-- Configure the standard encoder -->
+ <encoder name="html"
+ class="solr.highlight.HtmlEncoder"/>
+
+ <!-- Configure the standard fragListBuilder -->
+ <fragListBuilder name="simple"
+ class="solr.highlight.SimpleFragListBuilder"/>
+
+ <!-- Configure the single fragListBuilder -->
+ <fragListBuilder name="single"
+ class="solr.highlight.SingleFragListBuilder"/>
+
+ <!-- Configure the weighted fragListBuilder -->
+ <fragListBuilder name="weighted"
+ default="true"
+ class="solr.highlight.WeightedFragListBuilder"/>
+
+ <!-- default tag FragmentsBuilder -->
+ <fragmentsBuilder name="default"
+ default="true"
+ class="solr.highlight.ScoreOrderFragmentsBuilder">
+ <!--
+ <lst name="defaults">
+ <str name="hl.multiValuedSeparatorChar">/</str>
+ </lst>
+ -->
+ </fragmentsBuilder>
+
+ <!-- multi-colored tag FragmentsBuilder -->
+ <fragmentsBuilder name="colored"
+ class="solr.highlight.ScoreOrderFragmentsBuilder">
+ <lst name="defaults">
+ <str name="hl.tag.pre"><![CDATA[
+ <b style="background:yellow">,<b style="background:lawgreen">,
+ <b style="background:aquamarine">,<b style="background:magenta">,
+ <b style="background:palegreen">,<b style="background:coral">,
+ <b style="background:wheat">,<b style="background:khaki">,
+ <b style="background:lime">,<b style="background:deepskyblue">]]></str>
+ <str name="hl.tag.post"><![CDATA[</b>]]></str>
+ </lst>
+ </fragmentsBuilder>
+
+ <boundaryScanner name="default"
+ default="true"
+ class="solr.highlight.SimpleBoundaryScanner">
+ <lst name="defaults">
+ <str name="hl.bs.maxScan">10</str>
+ <str name="hl.bs.chars">.,!? 	 </str>
+ </lst>
+ </boundaryScanner>
+
+ <boundaryScanner name="breakIterator"
+ class="solr.highlight.BreakIteratorBoundaryScanner">
+ <lst name="defaults">
+ <!-- type should be one of CHARACTER, WORD(default), LINE and SENTENCE -->
+ <str name="hl.bs.type">WORD</str>
+ <!-- language and country are used when constructing Locale object. -->
+ <!-- And the Locale object will be used when getting instance of BreakIterator -->
+ <str name="hl.bs.language">en</str>
+ <str name="hl.bs.country">US</str>
+ </lst>
+ </boundaryScanner>
+ </highlighting>
+ </searchComponent>
+
+
+ <queryResponseWriter name="json" class="solr.JSONResponseWriter">
+ <str name="content-type">text/plain; charset=UTF-8</str>
+ </queryResponseWriter>
+
+ <queryResponseWriter name="velocity" class="solr.VelocityResponseWriter"
+ startup="lazy"/>
+
+
+ <queryResponseWriter name="xslt" class="solr.XSLTResponseWriter">
+ <int name="xsltCacheLifetimeSeconds">5</int>
+ </queryResponseWriter>
+
+
+ <admin>
+ <defaultQuery>*:*</defaultQuery>
+ </admin>
+
+</config>
Propchange: jackrabbit/oak/trunk/oak-solr-core/src/main/resources/solr/oak/conf/solrconfig.xml
------------------------------------------------------------------------------
svn:eol-style = native
Added: jackrabbit/oak/trunk/oak-solr-core/src/main/resources/solr/solr.xml
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-solr-core/src/main/resources/solr/solr.xml?rev=1530880&view=auto
==============================================================================
--- jackrabbit/oak/trunk/oak-solr-core/src/main/resources/solr/solr.xml (added)
+++ jackrabbit/oak/trunk/oak-solr-core/src/main/resources/solr/solr.xml Thu Oct 10 08:53:31 2013
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!--
+ 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.
+-->
+
+<!--
+ All (relative) paths are relative to the installation path
+
+ persistent: Save changes made via the API to this file
+ sharedLib: path to a lib directory that will be shared across all cores
+-->
+<solr persistent="false">
+
+ <!--
+ adminPath: RequestHandler path to manage cores.
+ If 'null' (or absent), cores will not be manageable via request handler
+ -->
+ <cores adminPath="/admin/cores" defaultCoreName="oak"
+ host="127.0.0.1" hostPort="${hostPort:8080}" hostContext="solr"
+ zkClientTimeout="8000" numShards="${numShards:1}">
+ <core name="oak" instanceDir="oak" shard="${shard:shard1}"
+ collection="${collection:oak}"
+ config="${solrconfig:solrconfig.xml}"
+ schema="${schema:schema.xml}"/>
+ </cores>
+</solr>
Propchange: jackrabbit/oak/trunk/oak-solr-core/src/main/resources/solr/solr.xml
------------------------------------------------------------------------------
svn:eol-style = native
Added: jackrabbit/oak/trunk/oak-solr-core/src/main/resources/solr/zoo.cfg
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-solr-core/src/main/resources/solr/zoo.cfg?rev=1530880&view=auto
==============================================================================
--- jackrabbit/oak/trunk/oak-solr-core/src/main/resources/solr/zoo.cfg (added)
+++ jackrabbit/oak/trunk/oak-solr-core/src/main/resources/solr/zoo.cfg Thu Oct 10 08:53:31 2013
@@ -0,0 +1,32 @@
+# 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.
+
+# The number of milliseconds of each tick
+tickTime=2000
+# The number of ticks that the initial
+# synchronization phase can take
+initLimit=10
+# The number of ticks that can pass between
+# sending a request and getting an acknowledgement
+syncLimit=5
+
+# the directory where the snapshot is stored.
+# dataDir=/opt/zookeeper/data
+# NOTE: Solr defaults the dataDir to <solrHome>/zoo_data
+
+# the port at which the clients will connect
+# clientPort=2181
+# NOTE: Solr sets this based on zkRun / zkHost params
+
Modified: jackrabbit/oak/trunk/oak-solr-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/solr/SolrBaseTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-solr-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/solr/SolrBaseTest.java?rev=1530880&r1=1530879&r2=1530880&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-solr-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/solr/SolrBaseTest.java (original)
+++ jackrabbit/oak/trunk/oak-solr-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/solr/SolrBaseTest.java Thu Oct 10 08:53:31 2013
@@ -26,8 +26,10 @@ import org.apache.jackrabbit.oak.api.Con
import org.apache.jackrabbit.oak.api.Root;
import org.apache.jackrabbit.oak.kernel.KernelNodeStore;
import org.apache.jackrabbit.oak.plugins.index.IndexUpdateProvider;
+import org.apache.jackrabbit.oak.plugins.index.solr.configuration.OakSolrConfiguration;
import org.apache.jackrabbit.oak.plugins.index.solr.index.SolrIndexEditorProvider;
import org.apache.jackrabbit.oak.plugins.index.solr.query.SolrQueryIndexProvider;
+import org.apache.jackrabbit.oak.plugins.index.solr.util.SolrIndexInitializer;
import org.apache.jackrabbit.oak.plugins.nodetype.write.InitialContent;
import org.apache.jackrabbit.oak.spi.commit.EditorHook;
import org.apache.jackrabbit.oak.spi.security.OpenSecurityProvider;
Modified: jackrabbit/oak/trunk/oak-solr-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/solr/TestUtils.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-solr-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/solr/TestUtils.java?rev=1530880&r1=1530879&r2=1530880&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-solr-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/solr/TestUtils.java (original)
+++ jackrabbit/oak/trunk/oak-solr-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/solr/TestUtils.java Thu Oct 10 08:53:31 2013
@@ -17,18 +17,13 @@
package org.apache.jackrabbit.oak.plugins.index.solr;
import java.io.File;
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.annotation.Nonnull;
import org.apache.jackrabbit.oak.api.Type;
-import org.apache.jackrabbit.oak.plugins.index.solr.query.SolrQueryIndex;
-import org.apache.jackrabbit.oak.plugins.index.solr.query.SolrQueryIndexProvider;
+import org.apache.jackrabbit.oak.plugins.index.solr.configuration.CommitPolicy;
+import org.apache.jackrabbit.oak.plugins.index.solr.configuration.OakSolrConfiguration;
+import org.apache.jackrabbit.oak.plugins.index.solr.configuration.OakSolrConfigurationProvider;
+import org.apache.jackrabbit.oak.plugins.index.solr.server.SolrServerProvider;
import org.apache.jackrabbit.oak.spi.query.Filter;
-import org.apache.jackrabbit.oak.spi.query.QueryIndex;
-import org.apache.jackrabbit.oak.spi.query.QueryIndexProvider;
-import org.apache.jackrabbit.oak.spi.state.NodeState;
import org.apache.solr.client.solrj.SolrServer;
import org.apache.solr.client.solrj.embedded.EmbeddedSolrServer;
import org.apache.solr.core.CoreContainer;
@@ -85,6 +80,10 @@ public class TestUtils
fieldName = "path_anc";
break;
}
+ case NO_RESTRICTION:
+ break;
+ default:
+ break;
}
return fieldName;
Added: jackrabbit/oak/trunk/oak-solr-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/solr/configuration/FixedNodeStateConfigurationTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-solr-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/solr/configuration/FixedNodeStateConfigurationTest.java?rev=1530880&view=auto
==============================================================================
--- jackrabbit/oak/trunk/oak-solr-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/solr/configuration/FixedNodeStateConfigurationTest.java (added)
+++ jackrabbit/oak/trunk/oak-solr-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/solr/configuration/FixedNodeStateConfigurationTest.java Thu Oct 10 08:53:31 2013
@@ -0,0 +1,73 @@
+/*
+ * 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.solr.configuration;
+
+import org.apache.jackrabbit.mk.api.MicroKernel;
+import org.apache.jackrabbit.mk.core.MicroKernelImpl;
+import org.apache.jackrabbit.oak.kernel.KernelNodeStore;
+import org.apache.jackrabbit.oak.spi.state.NodeState;
+import org.apache.jackrabbit.oak.spi.state.NodeStore;
+import org.junit.Before;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+
+/**
+ * Testcase for {@link org.apache.jackrabbit.oak.plugins.index.solr.configuration.FixedNodeStateConfiguration}
+ */
+public class FixedNodeStateConfigurationTest {
+
+ private NodeStore store;
+
+ @Before
+ public void setUp() throws Exception {
+ MicroKernel microKernel = new MicroKernelImpl();
+ String jsop = "^\"a\":1 ^\"b\":2 ^\"c\":3 +\"x\":{} +\"y\":{} +\"z\":{} " +
+ "+\"oak:index\":{\"solrIdx\":{\"coreName\":\"cn\", \"solrHomePath\":\"sh\", \"solrConfigPath\":\"sc\"}} ";
+ microKernel.commit("/", jsop, microKernel.getHeadRevision(), "test data");
+ store = new KernelNodeStore(microKernel);
+ }
+
+ @Test
+ public void testExistingPath() throws Exception {
+ NodeState idxDef = store.getRoot().getChildNode("oak:index").getChildNode("solrIdx");
+ FixedNodeStateConfiguration fixedNodeStateConfiguration = new FixedNodeStateConfiguration(idxDef);
+ SolrServerConfiguration solrServerConfiguration = fixedNodeStateConfiguration.getSolrServerConfiguration();
+ assertNotNull(solrServerConfiguration);
+ assertEquals("sh", solrServerConfiguration.getSolrHomePath()); // property defined in the node state
+ assertEquals("cn", solrServerConfiguration.getCoreName()); // property defined in the node state
+ assertEquals("sc", solrServerConfiguration.getSolrConfigPath()); // property defined in the node state
+ assertEquals("path_exact", fixedNodeStateConfiguration.getPathField()); // using default as this property is not defined in the node state
+ }
+
+ @Test
+ public void testNonExistingPath() throws Exception {
+ NodeState idxDef = store.getRoot().getChildNode("oak:index").getChildNode("a");
+ FixedNodeStateConfiguration fixedNodeStateConfiguration = new FixedNodeStateConfiguration(idxDef);
+ assertNotNull(fixedNodeStateConfiguration.getSolrServerConfiguration());
+ }
+
+ @Test
+ public void testWrongNodeState() throws Exception {
+ NodeState idxDef = store.getRoot().getChildNode("a");
+ FixedNodeStateConfiguration fixedNodeStateConfiguration = new FixedNodeStateConfiguration(idxDef);
+ assertFalse(fixedNodeStateConfiguration.getConfigurationNodeState().exists());
+ assertNotNull(fixedNodeStateConfiguration.getSolrServerConfiguration()); // defaults are used
+ }
+}
Propchange: jackrabbit/oak/trunk/oak-solr-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/solr/configuration/FixedNodeStateConfigurationTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: jackrabbit/oak/trunk/oak-solr-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/solr/configuration/UpToDateNodeStateConfigurationTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-solr-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/solr/configuration/UpToDateNodeStateConfigurationTest.java?rev=1530880&view=auto
==============================================================================
--- jackrabbit/oak/trunk/oak-solr-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/solr/configuration/UpToDateNodeStateConfigurationTest.java (added)
+++ jackrabbit/oak/trunk/oak-solr-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/solr/configuration/UpToDateNodeStateConfigurationTest.java Thu Oct 10 08:53:31 2013
@@ -0,0 +1,72 @@
+/*
+ * 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.solr.configuration;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+
+import org.apache.jackrabbit.mk.api.MicroKernel;
+import org.apache.jackrabbit.mk.core.MicroKernelImpl;
+import org.apache.jackrabbit.oak.kernel.KernelNodeStore;
+import org.apache.jackrabbit.oak.spi.state.NodeStore;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * Testcase for {@link org.apache.jackrabbit.oak.plugins.index.solr.configuration.UpToDateNodeStateConfiguration}
+ */
+public class UpToDateNodeStateConfigurationTest {
+
+ private NodeStore store;
+
+ @Before
+ public void setUp() throws Exception {
+ MicroKernel microKernel = new MicroKernelImpl();
+ String jsop = "^\"a\":1 ^\"b\":2 ^\"c\":3 +\"x\":{} +\"y\":{} +\"z\":{} " +
+ "+\"oak:index\":{\"solrIdx\":{\"coreName\":\"cn\", \"solrHomePath\":\"sh\", \"solrConfigPath\":\"sc\"}} ";
+ microKernel.commit("/", jsop, microKernel.getHeadRevision(), "test data");
+ store = new KernelNodeStore(microKernel);
+ }
+
+ @Test
+ public void testExistingPath() throws Exception {
+ String path = "oak:index/solrIdx";
+ UpToDateNodeStateConfiguration upToDateNodeStateConfiguration = new UpToDateNodeStateConfiguration(store, path);
+ SolrServerConfiguration solrServerConfiguration = upToDateNodeStateConfiguration.getSolrServerConfiguration();
+ assertNotNull(solrServerConfiguration);
+ assertEquals("sh", solrServerConfiguration.getSolrHomePath()); // property defined in the node state
+ assertEquals("cn", solrServerConfiguration.getCoreName()); // property defined in the node state
+ assertEquals("sc", solrServerConfiguration.getSolrConfigPath()); // property defined in the node state
+ assertEquals("path_exact", upToDateNodeStateConfiguration.getPathField()); // using default as this property not defined in the node state
+ }
+
+ @Test
+ public void testNonExistingPath() throws Exception {
+ String path = "some/path/to/oak:index/solrIdx";
+ UpToDateNodeStateConfiguration upToDateNodeStateConfiguration = new UpToDateNodeStateConfiguration(store, path);
+ assertNotNull(upToDateNodeStateConfiguration.getSolrServerConfiguration());
+ }
+
+ @Test
+ public void testWrongNodeState() throws Exception {
+ String path = "a";
+ UpToDateNodeStateConfiguration upToDateNodeStateConfiguration = new UpToDateNodeStateConfiguration(store, path);
+ assertFalse(upToDateNodeStateConfiguration.getConfigurationNodeState().exists());
+ assertNotNull(upToDateNodeStateConfiguration.getSolrServerConfiguration()); // defaults are used
+ }
+}
Propchange: jackrabbit/oak/trunk/oak-solr-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/solr/configuration/UpToDateNodeStateConfigurationTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: jackrabbit/oak/trunk/oak-solr-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/solr/index/SolrCommitHookIT.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-solr-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/solr/index/SolrCommitHookIT.java?rev=1530880&r1=1530879&r2=1530880&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-solr-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/solr/index/SolrCommitHookIT.java (original)
+++ jackrabbit/oak/trunk/oak-solr-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/solr/index/SolrCommitHookIT.java Thu Oct 10 08:53:31 2013
@@ -16,14 +16,14 @@
*/
package org.apache.jackrabbit.oak.plugins.index.solr.index;
-import static org.junit.Assert.assertTrue;
-
import org.apache.jackrabbit.oak.api.Root;
import org.apache.jackrabbit.oak.plugins.index.solr.SolrBaseTest;
import org.apache.solr.client.solrj.SolrQuery;
import org.apache.solr.client.solrj.response.QueryResponse;
import org.junit.Test;
+import static org.junit.Assert.assertTrue;
+
/**
* Integration test for {@link org.apache.jackrabbit.oak.plugins.index.solr.index.SolrCommitHook}
*/
Modified: jackrabbit/oak/trunk/oak-solr-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/solr/index/SolrIndexHookIT.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-solr-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/solr/index/SolrIndexHookIT.java?rev=1530880&r1=1530879&r2=1530880&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-solr-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/solr/index/SolrIndexHookIT.java (original)
+++ jackrabbit/oak/trunk/oak-solr-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/solr/index/SolrIndexHookIT.java Thu Oct 10 08:53:31 2013
@@ -16,12 +16,20 @@
*/
package org.apache.jackrabbit.oak.plugins.index.solr.index;
+import static com.google.common.collect.Sets.newHashSet;
+import static junit.framework.Assert.assertEquals;
+import static junit.framework.Assert.assertFalse;
+import static junit.framework.Assert.assertNotNull;
+import static junit.framework.Assert.assertTrue;
+import static org.apache.jackrabbit.JcrConstants.JCR_PRIMARYTYPE;
+import static org.apache.jackrabbit.oak.plugins.memory.EmptyNodeState.EMPTY_NODE;
+
import java.util.Set;
-import org.apache.jackrabbit.oak.query.ast.Operator;
-import org.apache.jackrabbit.oak.query.index.FilterImpl;
import org.apache.jackrabbit.oak.plugins.index.solr.SolrBaseTest;
import org.apache.jackrabbit.oak.plugins.index.solr.query.SolrQueryIndex;
+import org.apache.jackrabbit.oak.query.ast.Operator;
+import org.apache.jackrabbit.oak.query.index.FilterImpl;
import org.apache.jackrabbit.oak.spi.query.Cursor;
import org.apache.jackrabbit.oak.spi.query.Filter;
import org.apache.jackrabbit.oak.spi.query.IndexRow;
@@ -29,17 +37,8 @@ import org.apache.jackrabbit.oak.spi.que
import org.apache.jackrabbit.oak.spi.query.QueryIndex;
import org.apache.jackrabbit.oak.spi.state.NodeBuilder;
import org.apache.jackrabbit.oak.spi.state.NodeState;
-import org.apache.solr.client.solrj.SolrQuery;
import org.junit.Test;
-import static com.google.common.collect.Sets.newHashSet;
-import static junit.framework.Assert.assertEquals;
-import static junit.framework.Assert.assertFalse;
-import static junit.framework.Assert.assertNotNull;
-import static junit.framework.Assert.assertTrue;
-import static org.apache.jackrabbit.JcrConstants.JCR_PRIMARYTYPE;
-import static org.apache.jackrabbit.oak.plugins.memory.EmptyNodeState.EMPTY_NODE;
-
public class SolrIndexHookIT extends SolrBaseTest {
@Test
Modified: jackrabbit/oak/trunk/oak-solr-embedded/pom.xml
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-solr-embedded/pom.xml?rev=1530880&r1=1530879&r2=1530880&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-solr-embedded/pom.xml (original)
+++ jackrabbit/oak/trunk/oak-solr-embedded/pom.xml Thu Oct 10 08:53:31 2013
@@ -70,7 +70,6 @@
</plugin>
<plugin>
<artifactId>maven-failsafe-plugin</artifactId>
- <version>2.12</version>
<executions>
<execution>
<goals>
@@ -129,12 +128,12 @@
<version>${solr.version}</version>
<exclusions>
<exclusion>
- <groupId>org.slf4j</groupId>
- <artifactId>jcl-over-slf4j</artifactId>
+ <groupId>org.slf4j</groupId>
+ <artifactId>jcl-over-slf4j</artifactId>
</exclusion>
<exclusion>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-jdk14</artifactId>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-jdk14</artifactId>
</exclusion>
</exclusions>
</dependency>
@@ -301,6 +300,7 @@
<scope>runtime</scope>
</dependency>
+ <!-- Tests -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
Modified: jackrabbit/oak/trunk/oak-solr-embedded/src/main/java/org/apache/jackrabbit/oak/plugins/index/solr/embedded/EmbeddedSolrConfiguration.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-solr-embedded/src/main/java/org/apache/jackrabbit/oak/plugins/index/solr/embedded/EmbeddedSolrConfiguration.java?rev=1530880&r1=1530879&r2=1530880&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-solr-embedded/src/main/java/org/apache/jackrabbit/oak/plugins/index/solr/embedded/EmbeddedSolrConfiguration.java (original)
+++ jackrabbit/oak/trunk/oak-solr-embedded/src/main/java/org/apache/jackrabbit/oak/plugins/index/solr/embedded/EmbeddedSolrConfiguration.java Thu Oct 10 08:53:31 2013
@@ -17,8 +17,9 @@
package org.apache.jackrabbit.oak.plugins.index.solr.embedded;
import org.apache.jackrabbit.oak.api.Type;
-import org.apache.jackrabbit.oak.plugins.index.solr.CommitPolicy;
-import org.apache.jackrabbit.oak.plugins.index.solr.OakSolrConfiguration;
+import org.apache.jackrabbit.oak.plugins.index.solr.configuration.CommitPolicy;
+import org.apache.jackrabbit.oak.plugins.index.solr.configuration.OakSolrConfiguration;
+import org.apache.jackrabbit.oak.plugins.index.solr.configuration.SolrServerConfigurationDefaults;
import org.apache.jackrabbit.oak.spi.query.Filter;
/**
@@ -60,6 +61,10 @@ public class EmbeddedSolrConfiguration i
fieldName = SolrServerConfigurationDefaults.ANC_FIELD_NAME;
break;
}
+ case NO_RESTRICTION:
+ break;
+ default:
+ break;
}
return fieldName;
Modified: jackrabbit/oak/trunk/oak-solr-embedded/src/main/java/org/apache/jackrabbit/oak/plugins/index/solr/embedded/EmbeddedSolrConfigurationProvider.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-solr-embedded/src/main/java/org/apache/jackrabbit/oak/plugins/index/solr/embedded/EmbeddedSolrConfigurationProvider.java?rev=1530880&r1=1530879&r2=1530880&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-solr-embedded/src/main/java/org/apache/jackrabbit/oak/plugins/index/solr/embedded/EmbeddedSolrConfigurationProvider.java (original)
+++ jackrabbit/oak/trunk/oak-solr-embedded/src/main/java/org/apache/jackrabbit/oak/plugins/index/solr/embedded/EmbeddedSolrConfigurationProvider.java Thu Oct 10 08:53:31 2013
@@ -16,8 +16,8 @@
*/
package org.apache.jackrabbit.oak.plugins.index.solr.embedded;
-import org.apache.jackrabbit.oak.plugins.index.solr.OakSolrConfiguration;
-import org.apache.jackrabbit.oak.plugins.index.solr.OakSolrConfigurationProvider;
+import org.apache.jackrabbit.oak.plugins.index.solr.configuration.OakSolrConfiguration;
+import org.apache.jackrabbit.oak.plugins.index.solr.configuration.OakSolrConfigurationProvider;
/**
* An {@link OakSolrConfigurationProvider} for the embedded Solr server
Modified: jackrabbit/oak/trunk/oak-solr-embedded/src/main/java/org/apache/jackrabbit/oak/plugins/index/solr/embedded/EmbeddedSolrServerProvider.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-solr-embedded/src/main/java/org/apache/jackrabbit/oak/plugins/index/solr/embedded/EmbeddedSolrServerProvider.java?rev=1530880&r1=1530879&r2=1530880&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-solr-embedded/src/main/java/org/apache/jackrabbit/oak/plugins/index/solr/embedded/EmbeddedSolrServerProvider.java (original)
+++ jackrabbit/oak/trunk/oak-solr-embedded/src/main/java/org/apache/jackrabbit/oak/plugins/index/solr/embedded/EmbeddedSolrServerProvider.java Thu Oct 10 08:53:31 2013
@@ -22,14 +22,18 @@ import java.io.IOException;
import java.io.InputStream;
import java.util.Arrays;
+import org.apache.felix.scr.annotations.Deactivate;
import org.apache.jackrabbit.mk.util.IOUtils;
-import org.apache.jackrabbit.oak.plugins.index.solr.OakSolrUtils;
-import org.apache.jackrabbit.oak.plugins.index.solr.SolrServerProvider;
+import org.apache.jackrabbit.oak.plugins.index.solr.configuration.SolrServerConfiguration;
+import org.apache.jackrabbit.oak.plugins.index.solr.configuration.SolrServerConfigurationDefaults;
+import org.apache.jackrabbit.oak.plugins.index.solr.server.SolrServerProvider;
import org.apache.solr.client.solrj.SolrServer;
import org.apache.solr.client.solrj.embedded.EmbeddedSolrServer;
import org.apache.solr.client.solrj.embedded.JettySolrRunner;
import org.apache.solr.client.solrj.impl.HttpSolrServer;
import org.apache.solr.core.CoreContainer;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* Default implementation of {@link SolrServerProvider} which uses an
@@ -37,6 +41,8 @@ import org.apache.solr.core.CoreContaine
*/
public class EmbeddedSolrServerProvider implements SolrServerProvider {
+ private final Logger log = LoggerFactory.getLogger(getClass());
+
private final SolrServerConfiguration solrServerConfiguration;
public EmbeddedSolrServerProvider(SolrServerConfiguration solrServerConfiguration) {
@@ -45,6 +51,13 @@ public class EmbeddedSolrServerProvider
private SolrServer solrServer;
+ @Deactivate
+ protected void deactivate() throws Exception {
+ if (solrServer != null) {
+ solrServer.shutdown();
+ }
+ }
+
private SolrServer createSolrServer() throws Exception {
String solrHomePath = solrServerConfiguration.getSolrHomePath();
@@ -56,26 +69,51 @@ public class EmbeddedSolrServerProvider
if (solrConfigPath != null && solrHomePath != null && coreName != null) {
checkSolrConfiguration(solrHomePath, solrConfigPath, coreName);
if (httpConfiguration != null) {
+ if (log.isInfoEnabled()) {
+ log.info("starting embedded Solr server with http bindings");
+ }
ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
Thread.currentThread().setContextClassLoader(JettySolrRunner.class.getClassLoader());
Integer httpPort = httpConfiguration.getHttpPort();
String context = httpConfiguration.getContext();
+ JettySolrRunner jettySolrRunner = null;
try {
- JettySolrRunner jettySolrRunner = new JettySolrRunner(solrHomePath, context, httpPort, "solrconfig.xml", "schema.xml", true);
+ jettySolrRunner = new JettySolrRunner(solrHomePath, context, httpPort, "solrconfig.xml", "schema.xml", true);
+ if (log.isInfoEnabled()) {
+ log.info("Jetty runner instantiated");
+ }
jettySolrRunner.start(true);
+ if (log.isInfoEnabled()) {
+ log.info("Jetty runner started");
+ }
+ } catch (Exception t) {
+ if (log.isErrorEnabled()) {
+ log.error("an error has occurred while starting Solr Jetty", t);
+ }
} finally {
+ if (jettySolrRunner != null && !jettySolrRunner.isRunning()) {
+ try {
+ jettySolrRunner.stop();
+ if (log.isInfoEnabled()) {
+ log.info("Jetty runner stopped");
+ }
+ } catch (Exception e) {
+ if (log.isErrorEnabled()) {
+ log.error("error while stopping the Jetty runner", e);
+ }
+ }
+ }
Thread.currentThread().setContextClassLoader(classLoader);
}
- HttpSolrServer httpSolrServer = new HttpSolrServer(new StringBuilder(SolrServerConfigurationDefaults.LOCAL_BASE_URL)
- .append(':').append(httpPort).append(coreName).toString());
- if (OakSolrUtils.checkServerAlive(httpSolrServer)) {
- return httpSolrServer;
- } else {
- throw new IOException("the spawn HTTP Solr server is not alive");
+ if (log.isInfoEnabled()) {
+ log.info("starting HTTP Solr server");
}
-
-
+ HttpSolrServer httpSolrServer = new HttpSolrServer(new StringBuilder(
+ SolrServerConfigurationDefaults.LOCAL_BASE_URL).append(':')
+ .append(httpPort).append(context).append('/').append(coreName)
+ .toString());
+ return httpSolrServer;
} else {
ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
Thread.currentThread().setContextClassLoader(CoreContainer.class.getClassLoader());
@@ -88,7 +126,7 @@ public class EmbeddedSolrServerProvider
}
EmbeddedSolrServer server = new EmbeddedSolrServer(coreContainer, coreName);
- if (OakSolrUtils.checkServerAlive(server)) {
+ if (server.ping().getStatus() == 0) {
return server;
} else {
throw new IOException("the embedded Solr server is not alive");
@@ -110,32 +148,34 @@ public class EmbeddedSolrServerProvider
// copy all the needed files to the just created directory
copy("/solr/solr.xml", solrHomePath);
copy("/solr/zoo.cfg", solrHomePath);
- if (!new File(solrHomePath + "/oak/conf").mkdirs()) {
+ if (!new File(solrHomePath + "/" + coreName + "/conf").mkdirs()) {
throw new IOException("could not create nested core directory in solrHomePath");
}
- String coreDir = solrHomePath + "/oak/conf/";
+ String coreDir = solrHomePath + "/" + coreName + "/conf/";
copy("/solr/oak/conf/currency.xml", coreDir);
copy("/solr/oak/conf/schema.xml", coreDir);
copy("/solr/oak/conf/solrconfig.xml", coreDir);
}
} else if (!solrHomePathFile.isDirectory()) {
- throw new IOException("a non directory file with the specified name already exists for the given solrHomePath");
+ throw new IOException("a non directory file with the specified name already exists for the given solrHomePath '"+solrHomePath);
}
- File solrConfigPathFile = new File(solrConfigPath);
+ // TODO : improve this check
// check if solrConfigPath exists
- if (!solrConfigPathFile.exists()) {
- if (solrConfigPathFile.createNewFile()) {
- copy("/solr/solr.xml", solrConfigPathFile.getAbsolutePath());
- }
- }
+// File solrConfigPathFile = new File(solrConfigPath);
+// if (!solrConfigPathFile.exists()) {
+// if (solrConfigPathFile.createNewFile()) {
+// copy("/solr/solr.xml", solrConfigPathFile.getAbsolutePath());
+// }
+// }
// check if the a core with the given coreName exists
// TODO : improve this check
String[] files = new File(solrHomePath).list();
Arrays.sort(files);
if (Arrays.binarySearch(files, coreName) < 0) {
- throw new IOException("could not find a directory with the given coreName in the solrHomePath");
+ throw new IOException("could not find a directory with the coreName '" + coreName
+ + "' in the solrHomePath '" + solrHomePath + "'");
}
@@ -173,8 +213,10 @@ public class EmbeddedSolrServerProvider
@Override
public SolrServer getSolrServer() throws Exception {
- if (solrServer == null) {
- solrServer = createSolrServer();
+ synchronized (this) {
+ if (solrServer == null) {
+ solrServer = createSolrServer();
+ }
}
return solrServer;
}
Modified: jackrabbit/oak/trunk/oak-solr-embedded/src/main/java/org/apache/jackrabbit/oak/plugins/index/solr/embedded/osgi/EmbeddedSolrProviderService.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-solr-embedded/src/main/java/org/apache/jackrabbit/oak/plugins/index/solr/embedded/osgi/EmbeddedSolrProviderService.java?rev=1530880&r1=1530879&r2=1530880&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-solr-embedded/src/main/java/org/apache/jackrabbit/oak/plugins/index/solr/embedded/osgi/EmbeddedSolrProviderService.java (original)
+++ jackrabbit/oak/trunk/oak-solr-embedded/src/main/java/org/apache/jackrabbit/oak/plugins/index/solr/embedded/osgi/EmbeddedSolrProviderService.java Thu Oct 10 08:53:31 2013
@@ -21,14 +21,13 @@ import org.apache.felix.scr.annotations.
import org.apache.felix.scr.annotations.Property;
import org.apache.felix.scr.annotations.Reference;
import org.apache.felix.scr.annotations.Service;
-import org.apache.felix.scr.annotations.Services;
-import org.apache.jackrabbit.oak.plugins.index.solr.OakSolrConfiguration;
-import org.apache.jackrabbit.oak.plugins.index.solr.OakSolrConfigurationProvider;
-import org.apache.jackrabbit.oak.plugins.index.solr.SolrServerProvider;
+import org.apache.jackrabbit.oak.plugins.index.solr.configuration.OakSolrConfiguration;
+import org.apache.jackrabbit.oak.plugins.index.solr.configuration.OakSolrConfigurationProvider;
+import org.apache.jackrabbit.oak.plugins.index.solr.configuration.SolrServerConfigurationProvider;
+import org.apache.jackrabbit.oak.plugins.index.solr.configuration.UpToDateNodeStateConfiguration;
import org.apache.jackrabbit.oak.plugins.index.solr.embedded.EmbeddedSolrConfigurationProvider;
import org.apache.jackrabbit.oak.plugins.index.solr.embedded.EmbeddedSolrServerProvider;
-import org.apache.jackrabbit.oak.plugins.index.solr.embedded.SolrServerConfigurationProvider;
-import org.apache.jackrabbit.oak.plugins.index.solr.embedded.UpToDateNodeStateConfiguration;
+import org.apache.jackrabbit.oak.plugins.index.solr.server.SolrServerProvider;
import org.apache.jackrabbit.oak.spi.state.NodeStore;
import org.apache.solr.client.solrj.SolrServer;
import org.osgi.service.component.ComponentContext;
@@ -36,17 +35,12 @@ import org.osgi.service.component.Compon
/**
* OSGi service for the embedded Solr server module.
*/
-@Component(metatype = true,
- label = "Embedded SolrServer provider")
-@Services({
- @Service(value = SolrServerProvider.class),
- @Service(value = OakSolrConfigurationProvider.class)
-})
-public class EmbeddedSolrProviderService implements SolrServerProvider, OakSolrConfigurationProvider {
+@Component(metatype = true, label = "Embedded SolrServer provider")
+@Service(value = { SolrServerProvider.class, OakSolrConfigurationProvider.class })
+public class EmbeddedSolrProviderService implements SolrServerProvider,
+ OakSolrConfigurationProvider {
-
- @Property(value = "/oak:index/solrIdx", name = "configuration path",
- description = "path to node holding Solr configuration")
+ @Property(value = "/oak:index/solrIdx", name = "configuration path", description = "path to node holding Solr configuration")
private static final String CONFIGURATION_PATH = "solr.configuration.node.path";
@Reference
@@ -63,13 +57,17 @@ public class EmbeddedSolrProviderService
public void activate(ComponentContext context) throws Exception {
try {
// try reading configuration from the configured repository path
- UpToDateNodeStateConfiguration nodeStateConfiguration = new UpToDateNodeStateConfiguration(nodeStore, String.valueOf(
- context.getProperties().get(CONFIGURATION_PATH)));
- solrServerProvider = new EmbeddedSolrServerProvider(nodeStateConfiguration.getSolrServerConfiguration());
- oakSolrConfigurationProvider = new EmbeddedSolrConfigurationProvider(nodeStateConfiguration);
+ UpToDateNodeStateConfiguration nodeStateConfiguration = new UpToDateNodeStateConfiguration(
+ nodeStore, String.valueOf(context.getProperties().get(
+ CONFIGURATION_PATH)));
+ solrServerProvider = new EmbeddedSolrServerProvider(
+ nodeStateConfiguration.getSolrServerConfiguration());
+ oakSolrConfigurationProvider = new EmbeddedSolrConfigurationProvider(
+ nodeStateConfiguration);
} catch (Exception e) {
// use the default config and the OSGi based server configuration
- solrServerProvider = new EmbeddedSolrServerProvider(solrServerConfigurationProvider.getSolrServerConfiguration());
+ solrServerProvider = new EmbeddedSolrServerProvider(
+ solrServerConfigurationProvider.getSolrServerConfiguration());
oakSolrConfigurationProvider = new EmbeddedSolrConfigurationProvider();
}
}
Modified: jackrabbit/oak/trunk/oak-solr-embedded/src/main/java/org/apache/jackrabbit/oak/plugins/index/solr/embedded/osgi/OsgiSolrServerConfigurationProvider.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-solr-embedded/src/main/java/org/apache/jackrabbit/oak/plugins/index/solr/embedded/osgi/OsgiSolrServerConfigurationProvider.java?rev=1530880&r1=1530879&r2=1530880&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-solr-embedded/src/main/java/org/apache/jackrabbit/oak/plugins/index/solr/embedded/osgi/OsgiSolrServerConfigurationProvider.java (original)
+++ jackrabbit/oak/trunk/oak-solr-embedded/src/main/java/org/apache/jackrabbit/oak/plugins/index/solr/embedded/osgi/OsgiSolrServerConfigurationProvider.java Thu Oct 10 08:53:31 2013
@@ -23,9 +23,9 @@ import org.apache.felix.scr.annotations.
import org.apache.felix.scr.annotations.Deactivate;
import org.apache.felix.scr.annotations.Property;
import org.apache.felix.scr.annotations.Service;
-import org.apache.jackrabbit.oak.plugins.index.solr.embedded.SolrServerConfiguration;
-import org.apache.jackrabbit.oak.plugins.index.solr.embedded.SolrServerConfigurationDefaults;
-import org.apache.jackrabbit.oak.plugins.index.solr.embedded.SolrServerConfigurationProvider;
+import org.apache.jackrabbit.oak.plugins.index.solr.configuration.SolrServerConfiguration;
+import org.apache.jackrabbit.oak.plugins.index.solr.configuration.SolrServerConfigurationDefaults;
+import org.apache.jackrabbit.oak.plugins.index.solr.configuration.SolrServerConfigurationProvider;
import org.apache.solr.client.solrj.SolrServer;
import org.osgi.service.component.ComponentContext;
@@ -33,7 +33,7 @@ import org.osgi.service.component.Compon
* An OSGi service {@link SolrServerConfigurationProvider}
*/
@Component(metatype = true,
- label = "OSGi Solr server configuration provider")
+ label = "OSGi Embedded Solr server configuration provider")
@Service(value = SolrServerConfigurationProvider.class)
public class OsgiSolrServerConfigurationProvider implements SolrServerConfigurationProvider {
Modified: jackrabbit/oak/trunk/oak-solr-embedded/src/test/java/org/apache/jackrabbit/oak/plugins/index/solr/embedded/EmbeddedSolrServerProviderTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-solr-embedded/src/test/java/org/apache/jackrabbit/oak/plugins/index/solr/embedded/EmbeddedSolrServerProviderTest.java?rev=1530880&r1=1530879&r2=1530880&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-solr-embedded/src/test/java/org/apache/jackrabbit/oak/plugins/index/solr/embedded/EmbeddedSolrServerProviderTest.java (original)
+++ jackrabbit/oak/trunk/oak-solr-embedded/src/test/java/org/apache/jackrabbit/oak/plugins/index/solr/embedded/EmbeddedSolrServerProviderTest.java Thu Oct 10 08:53:31 2013
@@ -16,6 +16,7 @@
*/
package org.apache.jackrabbit.oak.plugins.index.solr.embedded;
+import org.apache.jackrabbit.oak.plugins.index.solr.configuration.SolrServerConfiguration;
import org.apache.solr.client.solrj.SolrServer;
import org.junit.Test;
Modified: jackrabbit/oak/trunk/oak-solr-remote/pom.xml
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-solr-remote/pom.xml?rev=1530880&r1=1530879&r2=1530880&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-solr-remote/pom.xml (original)
+++ jackrabbit/oak/trunk/oak-solr-remote/pom.xml Thu Oct 10 08:53:31 2013
@@ -44,6 +44,7 @@
<Export-Package>
org.apache.jackrabbit.oak.plugins.index.solr.http
</Export-Package>
+ <Embed-Dependency>solr-solrj</Embed-Dependency>
</instructions>
</configuration>
</plugin>
Modified: jackrabbit/oak/trunk/oak-solr-remote/src/main/java/org/apache/jackrabbit/oak/plugins/index/solr/http/RemoteSolrConfigurationProvider.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-solr-remote/src/main/java/org/apache/jackrabbit/oak/plugins/index/solr/http/RemoteSolrConfigurationProvider.java?rev=1530880&r1=1530879&r2=1530880&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-solr-remote/src/main/java/org/apache/jackrabbit/oak/plugins/index/solr/http/RemoteSolrConfigurationProvider.java (original)
+++ jackrabbit/oak/trunk/oak-solr-remote/src/main/java/org/apache/jackrabbit/oak/plugins/index/solr/http/RemoteSolrConfigurationProvider.java Thu Oct 10 08:53:31 2013
@@ -20,9 +20,9 @@ import org.apache.felix.scr.annotations.
import org.apache.felix.scr.annotations.Property;
import org.apache.felix.scr.annotations.Service;
import org.apache.jackrabbit.oak.api.Type;
-import org.apache.jackrabbit.oak.plugins.index.solr.CommitPolicy;
-import org.apache.jackrabbit.oak.plugins.index.solr.OakSolrConfiguration;
-import org.apache.jackrabbit.oak.plugins.index.solr.OakSolrConfigurationProvider;
+import org.apache.jackrabbit.oak.plugins.index.solr.configuration.CommitPolicy;
+import org.apache.jackrabbit.oak.plugins.index.solr.configuration.OakSolrConfiguration;
+import org.apache.jackrabbit.oak.plugins.index.solr.configuration.OakSolrConfigurationProvider;
import org.apache.jackrabbit.oak.spi.query.Filter;
import org.osgi.service.component.ComponentContext;
@@ -122,6 +122,10 @@ public class RemoteSolrConfigurationProv
fieldName = pathParentFieldName;
break;
}
+ case NO_RESTRICTION:
+ break;
+ default:
+ break;
}
return fieldName;
Modified: jackrabbit/oak/trunk/oak-solr-remote/src/main/java/org/apache/jackrabbit/oak/plugins/index/solr/http/RemoteSolrServerProvider.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-solr-remote/src/main/java/org/apache/jackrabbit/oak/plugins/index/solr/http/RemoteSolrServerProvider.java?rev=1530880&r1=1530879&r2=1530880&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-solr-remote/src/main/java/org/apache/jackrabbit/oak/plugins/index/solr/http/RemoteSolrServerProvider.java (original)
+++ jackrabbit/oak/trunk/oak-solr-remote/src/main/java/org/apache/jackrabbit/oak/plugins/index/solr/http/RemoteSolrServerProvider.java Thu Oct 10 08:53:31 2013
@@ -24,8 +24,8 @@ import org.apache.felix.scr.annotations.
import org.apache.felix.scr.annotations.Deactivate;
import org.apache.felix.scr.annotations.Property;
import org.apache.felix.scr.annotations.Service;
-import org.apache.jackrabbit.oak.plugins.index.solr.OakSolrUtils;
-import org.apache.jackrabbit.oak.plugins.index.solr.SolrServerProvider;
+import org.apache.jackrabbit.oak.plugins.index.solr.server.SolrServerProvider;
+import org.apache.jackrabbit.oak.plugins.index.solr.util.OakSolrUtils;
import org.apache.solr.client.solrj.SolrServer;
import org.apache.solr.client.solrj.SolrServerException;
import org.apache.solr.client.solrj.impl.CloudSolrServer;
@@ -175,7 +175,9 @@ public class RemoteSolrServerProvider im
} catch (Exception e) {
// wait a bit
try {
- log.warn("wait a bit", e);
+ if (log.isWarnEnabled()) {
+ log.warn("wait a bit", e);
+ }
Thread.sleep(3000);
} catch (InterruptedException e1) {
// do nothing
Modified: jackrabbit/oak/trunk/oak-solr-remote/src/test/java/org/apache/jackrabbit/oak/plugins/index/solr/http/RemoteSolrServerProviderIT.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-solr-remote/src/test/java/org/apache/jackrabbit/oak/plugins/index/solr/http/RemoteSolrServerProviderIT.java?rev=1530880&r1=1530879&r2=1530880&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-solr-remote/src/test/java/org/apache/jackrabbit/oak/plugins/index/solr/http/RemoteSolrServerProviderIT.java (original)
+++ jackrabbit/oak/trunk/oak-solr-remote/src/test/java/org/apache/jackrabbit/oak/plugins/index/solr/http/RemoteSolrServerProviderIT.java Thu Oct 10 08:53:31 2013
@@ -43,7 +43,6 @@ public class RemoteSolrServerProviderIT
req.setParam("collection.configName", "myconf");
CloudSolrServer cloudSolrServer = new CloudSolrServer(host);
NamedList<Object> request = cloudSolrServer.request(req);
-// cloudSolrServer.shutdown();
return request != null && request.get("success") != null;
}