You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by cp...@apache.org on 2016/07/20 14:25:44 UTC

[1/3] lucene-solr:branch_5x: SOLR-9275: add defaultField protected field to queryparser/xml's CoreParser

Repository: lucene-solr
Updated Branches:
  refs/heads/branch_5x c7f1a5d6e -> bb2f70eab


SOLR-9275: add defaultField protected field to queryparser/xml's CoreParser


Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/d9dcd5a0
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/d9dcd5a0
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/d9dcd5a0

Branch: refs/heads/branch_5x
Commit: d9dcd5a0758b3526e08393b77b8a48adfedbf5a4
Parents: c7f1a5d
Author: Christine Poerschke <cp...@apache.org>
Authored: Mon Jul 18 14:25:22 2016 +0100
Committer: Christine Poerschke <cp...@apache.org>
Committed: Wed Jul 20 13:03:00 2016 +0100

----------------------------------------------------------------------
 .../src/java/org/apache/lucene/queryparser/xml/CoreParser.java     | 2 ++
 1 file changed, 2 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/d9dcd5a0/lucene/queryparser/src/java/org/apache/lucene/queryparser/xml/CoreParser.java
----------------------------------------------------------------------
diff --git a/lucene/queryparser/src/java/org/apache/lucene/queryparser/xml/CoreParser.java b/lucene/queryparser/src/java/org/apache/lucene/queryparser/xml/CoreParser.java
index 3553eb3..e6047fb 100644
--- a/lucene/queryparser/src/java/org/apache/lucene/queryparser/xml/CoreParser.java
+++ b/lucene/queryparser/src/java/org/apache/lucene/queryparser/xml/CoreParser.java
@@ -33,6 +33,7 @@ import java.io.InputStream;
  */
 public class CoreParser implements QueryBuilder {
 
+  protected String defaultField;
   protected Analyzer analyzer;
   protected QueryParser parser;
   protected QueryBuilderFactory queryFactory;
@@ -63,6 +64,7 @@ public class CoreParser implements QueryBuilder {
   }
 
   protected CoreParser(String defaultField, Analyzer analyzer, QueryParser parser) {
+    this.defaultField = defaultField;
     this.analyzer = analyzer;
     this.parser = parser;
     filterFactory = new FilterBuilderFactory();


[2/3] lucene-solr:branch_5x: SOLR-9275: make XML QueryParser support (defType=xmlparser) extensible via configuration

Posted by cp...@apache.org.
SOLR-9275: make XML QueryParser support (defType=xmlparser) extensible via configuration


Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/03eb44ad
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/03eb44ad
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/03eb44ad

Branch: refs/heads/branch_5x
Commit: 03eb44ad121777f38d97f40862ab03b71207a5df
Parents: d9dcd5a
Author: Christine Poerschke <cp...@apache.org>
Authored: Mon Jul 18 14:26:38 2016 +0100
Committer: Christine Poerschke <cp...@apache.org>
Committed: Wed Jul 20 13:03:53 2016 +0100

----------------------------------------------------------------------
 .../org/apache/solr/search/SolrCoreParser.java  | 37 +++++++++-
 .../apache/solr/search/SolrQueryBuilder.java    | 34 +++++++++
 .../apache/solr/search/XmlQParserPlugin.java    | 10 +++
 .../conf/solrconfig-testxmlparser.xml           | 33 +++++++++
 .../apache/solr/search/GoodbyeQueryBuilder.java | 39 ++++++++++
 .../apache/solr/search/HandyQueryBuilder.java   | 53 +++++++++++++
 .../apache/solr/search/HelloQueryBuilder.java   | 39 ++++++++++
 .../solr/search/TestXmlQParserPlugin.java       | 78 ++++++++++++++++++++
 8 files changed, 320 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/03eb44ad/solr/core/src/java/org/apache/solr/search/SolrCoreParser.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/search/SolrCoreParser.java b/solr/core/src/java/org/apache/solr/search/SolrCoreParser.java
index cf3fb42..1e0e5bd 100755
--- a/solr/core/src/java/org/apache/solr/search/SolrCoreParser.java
+++ b/solr/core/src/java/org/apache/solr/search/SolrCoreParser.java
@@ -16,23 +16,54 @@
  */
 package org.apache.solr.search;
 
+import java.util.Map;
+
 import org.apache.lucene.analysis.Analyzer;
 import org.apache.lucene.queryparser.xml.CoreParser;
+import org.apache.lucene.queryparser.xml.QueryBuilder;
 
+import org.apache.solr.common.util.NamedList;
+import org.apache.solr.core.SolrResourceLoader;
 import org.apache.solr.request.SolrQueryRequest;
+import org.apache.solr.util.plugin.NamedListInitializedPlugin;
 
 /**
  * Assembles a QueryBuilder which uses Query objects from Solr's <code>search</code> module
  * in addition to Query objects supported by the Lucene <code>CoreParser</code>.
  */
-public class SolrCoreParser extends CoreParser {
+public class SolrCoreParser extends CoreParser implements NamedListInitializedPlugin {
+
+  protected final SolrQueryRequest req;
 
   public SolrCoreParser(String defaultField, Analyzer analyzer,
       SolrQueryRequest req) {
     super(defaultField, analyzer);
+    this.req = req;
+  }
+
+  @Override
+  public void init(NamedList initArgs) {
+    final SolrResourceLoader loader;
+    if (req == null) {
+      loader = new SolrResourceLoader();
+    } else {
+      loader = req.getCore().getResourceLoader();
+    }
+
+    final Iterable<Map.Entry<String,Object>> args = initArgs;
+    for (final Map.Entry<String,Object> entry : args) {
+      final String queryName = entry.getKey();
+      final String queryBuilderClassName = (String)entry.getValue();
+
+      final SolrQueryBuilder queryBuilder = loader.newInstance(
+          queryBuilderClassName,
+          SolrQueryBuilder.class,
+          null,
+          new Class[] {String.class, Analyzer.class, SolrQueryRequest.class, QueryBuilder.class},
+          new Object[] {defaultField, analyzer, req, this});
 
-    // final IndexSchema schema = req.getSchema();
-    // lucene_parser.addQueryBuilder("SomeOtherQuery", new SomeOtherQueryBuilder(schema));
+      this.queryFactory.addBuilder(queryName, queryBuilder);
+    }
   }
 
 }

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/03eb44ad/solr/core/src/java/org/apache/solr/search/SolrQueryBuilder.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/search/SolrQueryBuilder.java b/solr/core/src/java/org/apache/solr/search/SolrQueryBuilder.java
new file mode 100644
index 0000000..e813512
--- /dev/null
+++ b/solr/core/src/java/org/apache/solr/search/SolrQueryBuilder.java
@@ -0,0 +1,34 @@
+/*
+ * 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.solr.search;
+
+import org.apache.lucene.analysis.Analyzer;
+import org.apache.lucene.queryparser.xml.QueryBuilder;
+import org.apache.solr.request.SolrQueryRequest;
+
+public abstract class SolrQueryBuilder implements QueryBuilder {
+
+  protected final SolrQueryRequest req;
+  protected final QueryBuilder queryFactory;
+
+  public SolrQueryBuilder(String defaultField, Analyzer analyzer,
+      SolrQueryRequest req, QueryBuilder queryFactory) {
+    this.req = req;
+    this.queryFactory = queryFactory;
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/03eb44ad/solr/core/src/java/org/apache/solr/search/XmlQParserPlugin.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/search/XmlQParserPlugin.java b/solr/core/src/java/org/apache/solr/search/XmlQParserPlugin.java
index 566cfa6..ee8e062 100755
--- a/solr/core/src/java/org/apache/solr/search/XmlQParserPlugin.java
+++ b/solr/core/src/java/org/apache/solr/search/XmlQParserPlugin.java
@@ -32,6 +32,14 @@ import org.apache.solr.schema.IndexSchema;
 public class XmlQParserPlugin extends QParserPlugin {
   public static final String NAME = "xmlparser";
 
+  private NamedList args;
+
+  @Override
+  public void init( NamedList args ) {
+    super.init(args);
+    this.args = args;
+  }
+
   private class XmlQParser extends QParser {
 
     public XmlQParser(String qstr, SolrParams localParams,
@@ -47,7 +55,9 @@ public class XmlQParserPlugin extends QParserPlugin {
       final IndexSchema schema = req.getSchema();
       final String defaultField = QueryParsing.getDefaultField(schema, getParam(CommonParams.DF));
       final Analyzer analyzer = schema.getQueryAnalyzer();
+
       final SolrCoreParser solrParser = new SolrCoreParser(defaultField, analyzer, req);
+      solrParser.init(args);
       try {
         return solrParser.parse(new ByteArrayInputStream(qstr.getBytes(StandardCharsets.UTF_8)));
       } catch (ParserException e) {

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/03eb44ad/solr/core/src/test-files/solr/collection1/conf/solrconfig-testxmlparser.xml
----------------------------------------------------------------------
diff --git a/solr/core/src/test-files/solr/collection1/conf/solrconfig-testxmlparser.xml b/solr/core/src/test-files/solr/collection1/conf/solrconfig-testxmlparser.xml
new file mode 100644
index 0000000..40c39a1
--- /dev/null
+++ b/solr/core/src/test-files/solr/collection1/conf/solrconfig-testxmlparser.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0" ?>
+
+<!--
+ 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.
+-->
+
+<!-- solrconfig-basic.xml plus a queryParser element -->
+<config>
+  <luceneMatchVersion>${tests.luceneMatchVersion:LATEST}</luceneMatchVersion>
+  <dataDir>${solr.data.dir:}</dataDir>
+  <xi:include href="solrconfig.snippet.randomindexconfig.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
+  <directoryFactory name="DirectoryFactory" class="${solr.directoryFactory:solr.RAMDirectoryFactory}"/>
+  <schemaFactory class="ClassicIndexSchemaFactory"/>
+  <requestHandler name="standard" class="solr.StandardRequestHandler" />
+  <queryParser name="testxmlparser" class="XmlQParserPlugin">
+    <str name="HandyQuery">org.apache.solr.search.HandyQueryBuilder</str>
+    <str name="HelloQuery">org.apache.solr.search.HelloQueryBuilder</str>
+    <str name="GoodbyeQuery">org.apache.solr.search.GoodbyeQueryBuilder</str>
+  </queryParser>
+</config>

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/03eb44ad/solr/core/src/test/org/apache/solr/search/GoodbyeQueryBuilder.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/search/GoodbyeQueryBuilder.java b/solr/core/src/test/org/apache/solr/search/GoodbyeQueryBuilder.java
new file mode 100644
index 0000000..af258d4
--- /dev/null
+++ b/solr/core/src/test/org/apache/solr/search/GoodbyeQueryBuilder.java
@@ -0,0 +1,39 @@
+/*
+ * 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.solr.search;
+
+import org.apache.lucene.analysis.Analyzer;
+import org.apache.lucene.queryparser.xml.ParserException;
+import org.apache.lucene.queryparser.xml.QueryBuilder;
+import org.apache.lucene.search.MatchNoDocsQuery;
+import org.apache.lucene.search.Query;
+import org.apache.solr.request.SolrQueryRequest;
+import org.w3c.dom.Element;
+
+public class GoodbyeQueryBuilder extends SolrQueryBuilder {
+
+  public GoodbyeQueryBuilder(String defaultField, Analyzer analyzer,
+      SolrQueryRequest req, QueryBuilder queryFactory) {
+    super(defaultField, analyzer, req, queryFactory);
+  }
+
+  @Override
+  public Query getQuery(Element e) throws ParserException {
+    return new MatchNoDocsQuery();
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/03eb44ad/solr/core/src/test/org/apache/solr/search/HandyQueryBuilder.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/search/HandyQueryBuilder.java b/solr/core/src/test/org/apache/solr/search/HandyQueryBuilder.java
new file mode 100644
index 0000000..14a8aac
--- /dev/null
+++ b/solr/core/src/test/org/apache/solr/search/HandyQueryBuilder.java
@@ -0,0 +1,53 @@
+/*
+ * 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.solr.search;
+
+import org.apache.lucene.analysis.Analyzer;
+import org.apache.lucene.queryparser.xml.DOMUtils;
+import org.apache.lucene.queryparser.xml.ParserException;
+import org.apache.lucene.queryparser.xml.QueryBuilder;
+import org.apache.lucene.search.BooleanClause;
+import org.apache.lucene.search.BooleanQuery;
+import org.apache.lucene.search.Query;
+import org.apache.solr.request.SolrQueryRequest;
+import org.w3c.dom.Element;
+
+// A simple test query builder to demonstrate use of
+// SolrQueryBuilder's queryFactory constructor argument.
+public class HandyQueryBuilder extends SolrQueryBuilder {
+
+  public HandyQueryBuilder(String defaultField, Analyzer analyzer,
+      SolrQueryRequest req, QueryBuilder queryFactory) {
+    super(defaultField, analyzer, req, queryFactory);
+  }
+
+  @Override
+  public Query getQuery(Element e) throws ParserException {
+    final BooleanQuery.Builder bq = new BooleanQuery.Builder();
+    final Query lhsQ = getSubQuery(e, "Left");
+    final Query rhsQ = getSubQuery(e, "Right");
+    bq.add(new BooleanClause(lhsQ, BooleanClause.Occur.SHOULD));
+    bq.add(new BooleanClause(rhsQ, BooleanClause.Occur.SHOULD));
+    return bq.build();
+  }
+
+  private Query getSubQuery(Element e, String name) throws ParserException {
+    Element subE = DOMUtils.getChildByTagOrFail(e, name);
+    subE = DOMUtils.getFirstChildOrFail(subE);
+    return queryFactory.getQuery(subE);
+  }
+}

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/03eb44ad/solr/core/src/test/org/apache/solr/search/HelloQueryBuilder.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/search/HelloQueryBuilder.java b/solr/core/src/test/org/apache/solr/search/HelloQueryBuilder.java
new file mode 100644
index 0000000..642047f
--- /dev/null
+++ b/solr/core/src/test/org/apache/solr/search/HelloQueryBuilder.java
@@ -0,0 +1,39 @@
+/*
+ * 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.solr.search;
+
+import org.apache.lucene.analysis.Analyzer;
+import org.apache.lucene.queryparser.xml.ParserException;
+import org.apache.lucene.queryparser.xml.QueryBuilder;
+import org.apache.lucene.search.MatchAllDocsQuery;
+import org.apache.lucene.search.Query;
+import org.apache.solr.request.SolrQueryRequest;
+import org.w3c.dom.Element;
+
+public class HelloQueryBuilder extends SolrQueryBuilder {
+
+  public HelloQueryBuilder(String defaultField, Analyzer analyzer,
+      SolrQueryRequest req, QueryBuilder queryFactory) {
+    super(defaultField, analyzer, req, queryFactory);
+  }
+
+  @Override
+  public Query getQuery(Element e) throws ParserException {
+    return new MatchAllDocsQuery();
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/03eb44ad/solr/core/src/test/org/apache/solr/search/TestXmlQParserPlugin.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/search/TestXmlQParserPlugin.java b/solr/core/src/test/org/apache/solr/search/TestXmlQParserPlugin.java
new file mode 100644
index 0000000..3c4edae
--- /dev/null
+++ b/solr/core/src/test/org/apache/solr/search/TestXmlQParserPlugin.java
@@ -0,0 +1,78 @@
+/*
+ * 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.solr.search;
+
+import org.apache.solr.SolrTestCaseJ4;
+import org.apache.solr.common.params.ModifiableSolrParams;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+public class TestXmlQParserPlugin extends SolrTestCaseJ4 {
+
+  @BeforeClass
+  public static void beforeClass() throws Exception {
+    initCore("solrconfig-testxmlparser.xml", "schema-minimal.xml");
+  }
+
+  @Override
+  @Before
+  public void setUp() throws Exception {
+    // if you override setUp or tearDown, you better call
+    // the super classes version
+    super.setUp();
+    clearIndex();
+    assertU(commit());
+  }
+
+  @Test
+  public void testHelloQuery() throws Exception {
+    final int numDocs = random().nextInt(10);
+    implTestQuery(numDocs, "<HelloQuery/>", numDocs);
+  }
+
+  @Test
+  public void testGoodbyeQuery() throws Exception {
+    final int numDocs = random().nextInt(10);
+    implTestQuery(numDocs, "<GoodbyeQuery/>", 0);
+  }
+
+  @Test
+  public void testHandyQuery() throws Exception {
+    final int numDocs = random().nextInt(10);
+    final String q = "<HandyQuery><Left><HelloQuery/></Left><Right><GoodbyeQuery/></Right></HandyQuery>";
+    implTestQuery(numDocs, q, numDocs);
+  }
+
+  public void implTestQuery(int numDocs, String q, int expectedCount) throws Exception {
+    // add some documents
+    for (int ii=1; ii<=numDocs; ++ii) {
+      String[] doc = {"id",ii+"0"};
+      assertU(adoc(doc));
+      if (random().nextBoolean()) {
+        assertU(commit());
+      }
+    }
+    assertU(commit());
+    // and then run the query
+    ModifiableSolrParams params = new ModifiableSolrParams();
+    params.add("defType", "testxmlparser");
+    params.add("q", q);
+    assertQ(req(params), "*[count(//doc)="+expectedCount+"]");
+  }
+
+}


[3/3] lucene-solr:branch_5x: SOLR-9275: fix NPE in SolrCoreParser.init

Posted by cp...@apache.org.
SOLR-9275: fix NPE in SolrCoreParser.init


Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/bb2f70ea
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/bb2f70ea
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/bb2f70ea

Branch: refs/heads/branch_5x
Commit: bb2f70eabf3fcb63662b3580936dbce6c7df1449
Parents: 03eb44a
Author: Christine Poerschke <cp...@apache.org>
Authored: Tue Jul 19 11:28:57 2016 +0100
Committer: Christine Poerschke <cp...@apache.org>
Committed: Wed Jul 20 13:04:26 2016 +0100

----------------------------------------------------------------------
 solr/core/src/java/org/apache/solr/search/SolrCoreParser.java | 3 +++
 1 file changed, 3 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/bb2f70ea/solr/core/src/java/org/apache/solr/search/SolrCoreParser.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/search/SolrCoreParser.java b/solr/core/src/java/org/apache/solr/search/SolrCoreParser.java
index 1e0e5bd..4857b75 100755
--- a/solr/core/src/java/org/apache/solr/search/SolrCoreParser.java
+++ b/solr/core/src/java/org/apache/solr/search/SolrCoreParser.java
@@ -43,6 +43,9 @@ public class SolrCoreParser extends CoreParser implements NamedListInitializedPl
 
   @Override
   public void init(NamedList initArgs) {
+    if (initArgs == null || initArgs.size() == 0) {
+      return;
+    }
     final SolrResourceLoader loader;
     if (req == null) {
       loader = new SolrResourceLoader();