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 2018/07/03 18:51:04 UTC
[1/2] lucene-solr git commit: SOLR-12395: Make 'significantTerms' the SignificantTermsQParserPlugin's name and deprecate its old 'sigificantTerms' name. (Tobias Kässmann, Christine Poerschke)
Repository: lucene-solr
Updated Branches:
refs/heads/master d38a1753d -> a444e82ba
SOLR-12395: Make 'significantTerms' the SignificantTermsQParserPlugin's name and deprecate its old 'sigificantTerms' name.
(Tobias Kässmann, Christine Poerschke)
Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/1a4b1358
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/1a4b1358
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/1a4b1358
Branch: refs/heads/master
Commit: 1a4b1358ea1b3fbe03ca85b3272ade81e8056e86
Parents: d38a1753
Author: Christine Poerschke <cp...@apache.org>
Authored: Tue Jul 3 18:09:35 2018 +0100
Committer: Christine Poerschke <cp...@apache.org>
Committed: Tue Jul 3 18:09:35 2018 +0100
----------------------------------------------------------------------
solr/CHANGES.txt | 5 +++
.../org/apache/solr/search/QParserPlugin.java | 1 +
.../search/SignificantTermsQParserPlugin.java | 5 ++-
.../apache/solr/search/QueryEqualityTest.java | 7 +++-
.../SignificantTermsQParserPluginTest.java | 40 ++++++++++++++++++++
.../org/apache/solr/search/TestQueryTypes.java | 4 +-
.../solr/search/TestStandardQParsers.java | 5 +++
.../solrj/io/stream/SignificantTermsStream.java | 2 +-
8 files changed, 64 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/1a4b1358/solr/CHANGES.txt
----------------------------------------------------------------------
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index 54454b4..eb1b40f 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -67,6 +67,8 @@ Upgrade Notes
* LUCENE-7976: TieredMergePolicy now respects maxSegmentSizeMB by default when executing
findForcedMerges (optimize) and findForcedDeletesMerges (expungeDeletes) (Erick Erickson)
+* SOLR-12395: SignificantTermsQParserPlugin's name is now 'significantTerms' and its old name 'sigificantTerms' is deprecated.
+
New Features
----------------------
@@ -129,6 +131,9 @@ Bug Fixes
* SOLR-12427: Improve error message for invalid 'start', 'rows' parameters. (Munendra S N via Jason Gerlowski)
+* SOLR-12395: Make 'significantTerms' the SignificantTermsQParserPlugin's name and deprecate its old 'sigificantTerms' name.
+ (Tobias Kässmann, Christine Poerschke)
+
Optimizations
----------------------
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/1a4b1358/solr/core/src/java/org/apache/solr/search/QParserPlugin.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/search/QParserPlugin.java b/solr/core/src/java/org/apache/solr/search/QParserPlugin.java
index b20c3c8..e9aa255 100644
--- a/solr/core/src/java/org/apache/solr/search/QParserPlugin.java
+++ b/solr/core/src/java/org/apache/solr/search/QParserPlugin.java
@@ -80,6 +80,7 @@ public abstract class QParserPlugin implements NamedListInitializedPlugin, SolrI
map.put(GraphTermsQParserPlugin.NAME, new GraphTermsQParserPlugin());
map.put(IGainTermsQParserPlugin.NAME, new IGainTermsQParserPlugin());
map.put(TextLogisticRegressionQParserPlugin.NAME, new TextLogisticRegressionQParserPlugin());
+ map.put(SignificantTermsQParserPlugin.OLD_NAME, new SignificantTermsQParserPlugin()); // for Solr 7.x backcompat only
map.put(SignificantTermsQParserPlugin.NAME, new SignificantTermsQParserPlugin());
map.put(PayloadScoreQParserPlugin.NAME, new PayloadScoreQParserPlugin());
map.put(PayloadCheckQParserPlugin.NAME, new PayloadCheckQParserPlugin());
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/1a4b1358/solr/core/src/java/org/apache/solr/search/SignificantTermsQParserPlugin.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/search/SignificantTermsQParserPlugin.java b/solr/core/src/java/org/apache/solr/search/SignificantTermsQParserPlugin.java
index 8346316..7be5dad 100644
--- a/solr/core/src/java/org/apache/solr/search/SignificantTermsQParserPlugin.java
+++ b/solr/core/src/java/org/apache/solr/search/SignificantTermsQParserPlugin.java
@@ -39,7 +39,10 @@ import org.apache.solr.request.SolrQueryRequest;
public class SignificantTermsQParserPlugin extends QParserPlugin {
- public static final String NAME = "sigificantTerms";
+ @Deprecated
+ public static final String OLD_NAME = "sigificantTerms";
+
+ public static final String NAME = "significantTerms";
@Override
public QParser createParser(String qstr, SolrParams localParams, SolrParams params, SolrQueryRequest req) {
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/1a4b1358/solr/core/src/test/org/apache/solr/search/QueryEqualityTest.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/search/QueryEqualityTest.java b/solr/core/src/test/org/apache/solr/search/QueryEqualityTest.java
index 84c34e1..d27695f 100644
--- a/solr/core/src/test/org/apache/solr/search/QueryEqualityTest.java
+++ b/solr/core/src/test/org/apache/solr/search/QueryEqualityTest.java
@@ -190,7 +190,12 @@ public class QueryEqualityTest extends SolrTestCaseJ4 {
public void testSignificantTermsQuery() throws Exception {
SolrQueryRequest req = req("q", "*:*");
try {
- assertQueryEquals("sigificantTerms", req, "{!sigificantTerms}");
+ // for Solr 7.x backcompat only
+ assertQueryEquals(SignificantTermsQParserPlugin.OLD_NAME,
+ req, "{!"+SignificantTermsQParserPlugin.OLD_NAME+"}");
+
+ assertQueryEquals(SignificantTermsQParserPlugin.NAME,
+ req, "{!"+SignificantTermsQParserPlugin.NAME+"}");
} finally {
req.close();
}
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/1a4b1358/solr/core/src/test/org/apache/solr/search/SignificantTermsQParserPluginTest.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/search/SignificantTermsQParserPluginTest.java b/solr/core/src/test/org/apache/solr/search/SignificantTermsQParserPluginTest.java
new file mode 100644
index 0000000..a951c05
--- /dev/null
+++ b/solr/core/src/test/org/apache/solr/search/SignificantTermsQParserPluginTest.java
@@ -0,0 +1,40 @@
+/*
+ * 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.util.LuceneTestCase;
+import org.junit.Test;
+
+public class SignificantTermsQParserPluginTest extends LuceneTestCase {
+
+ /**
+ * Test the backwards compatibility for a typo in the SignificantTermsQParserPlugin. It will fail if the backwards
+ * compatibility is broken.
+ */
+ @Test
+ public void testQParserBackwardsCompatibility() {
+ // for Solr 7.x backcompat only
+ assertEquals("sigificantTerms", SignificantTermsQParserPlugin.OLD_NAME);
+ assertEquals(SignificantTermsQParserPlugin.class,
+ QParserPlugin.standardPlugins.get(SignificantTermsQParserPlugin.OLD_NAME).getClass());
+
+ assertEquals("significantTerms", SignificantTermsQParserPlugin.NAME);
+ assertEquals(SignificantTermsQParserPlugin.class,
+ QParserPlugin.standardPlugins.get(SignificantTermsQParserPlugin.NAME).getClass());
+ }
+}
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/1a4b1358/solr/core/src/test/org/apache/solr/search/TestQueryTypes.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/search/TestQueryTypes.java b/solr/core/src/test/org/apache/solr/search/TestQueryTypes.java
index aa94fab..477468a 100644
--- a/solr/core/src/test/org/apache/solr/search/TestQueryTypes.java
+++ b/solr/core/src/test/org/apache/solr/search/TestQueryTypes.java
@@ -476,8 +476,8 @@ public class TestQueryTypes extends SolrTestCaseJ4 {
}
// Skipping: func, boost, raw, nested, frange, spatial*, join, surround, switch, parent, child, collapsing,
- // complexphrase, rerank, export, mlt, hash, graph, graphTerms, igain, tlogit, sigificantTerms, payload*
- // Maybe add: raw, join, parent, child, collapsing, graphTerms, igain, sigificantTerms, simple
+ // complexphrase, rerank, export, mlt, hash, graph, graphTerms, igain, tlogit, significantTerms, payload*
+ // Maybe add: raw, join, parent, child, collapsing, graphTerms, igain, significantTerms, simple
}
}
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/1a4b1358/solr/core/src/test/org/apache/solr/search/TestStandardQParsers.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/search/TestStandardQParsers.java b/solr/core/src/test/org/apache/solr/search/TestStandardQParsers.java
index cab9026..4b79dd9 100644
--- a/solr/core/src/test/org/apache/solr/search/TestStandardQParsers.java
+++ b/solr/core/src/test/org/apache/solr/search/TestStandardQParsers.java
@@ -66,6 +66,11 @@ public class TestStandardQParsers extends LuceneTestCase {
}
}
+ // for Solr 7.x backcompat only
+ mismatch.remove(SignificantTermsQParserPlugin.OLD_NAME
+ + " != " + SignificantTermsQParserPlugin.NAME
+ + "(" + SignificantTermsQParserPlugin.class.getName() + ")");
+
assertTrue("All standard QParsers must have final NAME, broken: " + notFinal,
notFinal.isEmpty());
assertTrue("All standard QParsers must have static NAME, broken: " + notStatic,
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/1a4b1358/solr/solrj/src/java/org/apache/solr/client/solrj/io/stream/SignificantTermsStream.java
----------------------------------------------------------------------
diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/io/stream/SignificantTermsStream.java b/solr/solrj/src/java/org/apache/solr/client/solrj/io/stream/SignificantTermsStream.java
index 111b94b..4562cd3 100644
--- a/solr/solrj/src/java/org/apache/solr/client/solrj/io/stream/SignificantTermsStream.java
+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/io/stream/SignificantTermsStream.java
@@ -382,7 +382,7 @@ public class SignificantTermsStream extends TupleStream implements Expressible{
HttpSolrClient solrClient = cache.getHttpSolrClient(baseUrl);
params.add(DISTRIB, "false");
- params.add("fq","{!sigificantTerms}");
+ params.add("fq","{!significantTerms}");
for(String key : paramsMap.keySet()) {
params.add(key, paramsMap.get(key));
[2/2] lucene-solr:master: SOLR-12527: factor out a
test-framework/ConfigRequest class
Posted by cp...@apache.org.
SOLR-12527: factor out a test-framework/ConfigRequest class
Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/a444e82b
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/a444e82b
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/a444e82b
Branch: refs/heads/master
Commit: a444e82babe2aec9a7bbaeb9c546df4fde5af91d
Parents: 1a4b135
Author: Christine Poerschke <cp...@apache.org>
Authored: Tue Jul 3 18:27:17 2018 +0100
Committer: Christine Poerschke <cp...@apache.org>
Committed: Tue Jul 3 18:27:17 2018 +0100
----------------------------------------------------------------------
solr/CHANGES.txt | 2 +
.../solr/cloud/TestCloudSearcherWarming.java | 41 +--------------
.../component/CustomHighlightComponentTest.java | 7 +--
.../org/apache/solr/cloud/ConfigRequest.java | 55 ++++++++++++++++++++
4 files changed, 60 insertions(+), 45 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/a444e82b/solr/CHANGES.txt
----------------------------------------------------------------------
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index eb1b40f..3a346c8 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -157,6 +157,8 @@ Other Changes
* SOLR-12468: Upgrade Jetty to 9.4.11.v20180605 (Michael Braun, shalin)
+* SOLR-12527: factor out a test-framework/ConfigRequest class (Christine Poerschke)
+
================== 7.4.0 ==================
Consult the LUCENE_CHANGES.txt file for additional, low level, changes in this release.
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/a444e82b/solr/core/src/test/org/apache/solr/cloud/TestCloudSearcherWarming.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/cloud/TestCloudSearcherWarming.java b/solr/core/src/test/org/apache/solr/cloud/TestCloudSearcherWarming.java
index fe637d9..10a6cff 100644
--- a/solr/core/src/test/org/apache/solr/cloud/TestCloudSearcherWarming.java
+++ b/solr/core/src/test/org/apache/solr/cloud/TestCloudSearcherWarming.java
@@ -22,22 +22,16 @@ import java.util.Set;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicReference;
-import org.apache.solr.client.solrj.SolrClient;
import org.apache.solr.client.solrj.SolrQuery;
-import org.apache.solr.client.solrj.SolrRequest;
-import org.apache.solr.client.solrj.SolrResponse;
import org.apache.solr.client.solrj.embedded.JettySolrRunner;
import org.apache.solr.client.solrj.impl.CloudSolrClient;
import org.apache.solr.client.solrj.request.CollectionAdminRequest;
-import org.apache.solr.client.solrj.request.RequestWriter;
import org.apache.solr.client.solrj.response.QueryResponse;
-import org.apache.solr.client.solrj.response.SolrResponseBase;
import org.apache.solr.common.SolrInputDocument;
import org.apache.solr.common.cloud.CollectionStatePredicate;
import org.apache.solr.common.cloud.CollectionStateWatcher;
import org.apache.solr.common.cloud.DocCollection;
import org.apache.solr.common.cloud.Replica;
-import org.apache.solr.common.params.SolrParams;
import org.apache.solr.common.util.NamedList;
import org.apache.solr.core.SolrCore;
import org.apache.solr.core.SolrEventListener;
@@ -52,8 +46,6 @@ import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import static org.apache.solr.common.params.CommonParams.JSON_MIME;
-
/**
* Tests related to SOLR-6086
*/
@@ -108,7 +100,7 @@ public class TestCloudSearcherWarming extends SolrCloudTestCase {
"'add-listener' : {'name':'firstSearcherListener','event':'firstSearcher', 'class':'" + SleepingSolrEventListener.class.getName() + "'}" +
"}";
- ConfigRequest request = new ConfigRequest(SolrRequest.METHOD.POST, "/config", addListenerCommand);
+ ConfigRequest request = new ConfigRequest(addListenerCommand);
solrClient.request(request);
solrClient.add(new SolrInputDocument("id", "1"));
@@ -147,7 +139,7 @@ public class TestCloudSearcherWarming extends SolrCloudTestCase {
"'add-listener' : {'name':'firstSearcherListener','event':'firstSearcher', 'class':'" + SleepingSolrEventListener.class.getName() + "'}" +
"}";
- ConfigRequest request = new ConfigRequest(SolrRequest.METHOD.POST, "/config", addListenerCommand);
+ ConfigRequest request = new ConfigRequest(addListenerCommand);
solrClient.request(request);
solrClient.add(new SolrInputDocument("id", "1"));
@@ -328,33 +320,4 @@ public class TestCloudSearcherWarming extends SolrCloudTestCase {
}
}
}
-
- public static class ConfigRequest extends SolrRequest {
- protected final String message;
-
- public ConfigRequest(METHOD m, String path, String message) {
- super(m, path);
- this.message = message;
- }
-
- @Override
- public SolrParams getParams() {
- return null;
- }
-
- /* @Override
- public Collection<ContentStream> getContentStreams() throws IOException {
- return message != null ? Collections.singletonList(new ContentStreamBase.StringStream(message)) : null;
- }*/
-
- @Override
- public RequestWriter.ContentWriter getContentWriter(String expectedType) {
- return message == null? null: new RequestWriter.StringPayloadContentWriter(message, JSON_MIME);
- }
-
- @Override
- protected SolrResponse createResponse(SolrClient client) {
- return new SolrResponseBase();
- }
- }
}
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/a444e82b/solr/core/src/test/org/apache/solr/handler/component/CustomHighlightComponentTest.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/handler/component/CustomHighlightComponentTest.java b/solr/core/src/test/org/apache/solr/handler/component/CustomHighlightComponentTest.java
index 5f74064..da7ea57 100644
--- a/solr/core/src/test/org/apache/solr/handler/component/CustomHighlightComponentTest.java
+++ b/solr/core/src/test/org/apache/solr/handler/component/CustomHighlightComponentTest.java
@@ -23,14 +23,13 @@ import java.util.Map;
import java.util.Set;
import org.apache.solr.client.solrj.SolrQuery;
-import org.apache.solr.client.solrj.SolrRequest;
import org.apache.solr.client.solrj.request.CollectionAdminRequest;
import org.apache.solr.client.solrj.request.QueryRequest;
import org.apache.solr.client.solrj.request.UpdateRequest;
import org.apache.solr.client.solrj.response.QueryResponse;
import org.apache.solr.cloud.AbstractDistribZkTestBase;
+import org.apache.solr.cloud.ConfigRequest;
import org.apache.solr.cloud.SolrCloudTestCase;
-import org.apache.solr.cloud.TestCloudSearcherWarming.ConfigRequest;
import org.apache.solr.common.util.NamedList;
import org.apache.solr.common.util.SimpleOrderedMap;
import org.apache.solr.highlight.SolrFragmentsBuilder;
@@ -145,8 +144,6 @@ public class CustomHighlightComponentTest extends SolrCloudTestCase {
highlightComponentName = "customhighlight"+random().nextInt();
cluster.getSolrClient().request(
new ConfigRequest(
- SolrRequest.METHOD.POST,
- "/config",
"{\n" +
" 'add-searchcomponent': {\n" +
" 'name': '"+highlightComponentName+"',\n" +
@@ -158,8 +155,6 @@ public class CustomHighlightComponentTest extends SolrCloudTestCase {
// handler
cluster.getSolrClient().request(
new ConfigRequest(
- SolrRequest.METHOD.POST,
- "/config",
"{\n" +
" 'add-requesthandler': {\n" +
" 'name' : '"+customSearchHandlerName+"',\n" +
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/a444e82b/solr/test-framework/src/java/org/apache/solr/cloud/ConfigRequest.java
----------------------------------------------------------------------
diff --git a/solr/test-framework/src/java/org/apache/solr/cloud/ConfigRequest.java b/solr/test-framework/src/java/org/apache/solr/cloud/ConfigRequest.java
new file mode 100644
index 0000000..12b5a37
--- /dev/null
+++ b/solr/test-framework/src/java/org/apache/solr/cloud/ConfigRequest.java
@@ -0,0 +1,55 @@
+/*
+ * 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.cloud;
+
+import org.apache.solr.client.solrj.SolrClient;
+import org.apache.solr.client.solrj.SolrRequest;
+import org.apache.solr.client.solrj.SolrResponse;
+import org.apache.solr.client.solrj.request.RequestWriter;
+import org.apache.solr.client.solrj.response.SolrResponseBase;
+import org.apache.solr.common.params.CommonParams;
+import org.apache.solr.common.params.SolrParams;
+
+/**
+ * A class for making a request to the config handler. Tests can use this
+ * e.g. to add custom components, handlers, parsers, etc. to an otherwise
+ * generic configset.
+ */
+public class ConfigRequest extends SolrRequest {
+
+ protected final String message;
+
+ public ConfigRequest(String message) {
+ super(SolrRequest.METHOD.POST, "/config");
+ this.message = message;
+ }
+
+ @Override
+ public SolrParams getParams() {
+ return null;
+ }
+
+ @Override
+ public RequestWriter.ContentWriter getContentWriter(String expectedType) {
+ return message == null? null: new RequestWriter.StringPayloadContentWriter(message, CommonParams.JSON_MIME);
+ }
+
+ @Override
+ public SolrResponse createResponse(SolrClient client) {
+ return new SolrResponseBase();
+ }
+}