mirror of https://github.com/apache/lucene.git
SOLR-12395: Make 'significantTerms' the SignificantTermsQParserPlugin's name and deprecate its old 'sigificantTerms' name.
(Tobias Kässmann, Christine Poerschke)
This commit is contained in:
parent
d38a1753d5
commit
1a4b1358ea
|
@ -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
|
||||
----------------------
|
||||
|
||||
|
|
|
@ -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());
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -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());
|
||||
}
|
||||
}
|
|
@ -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
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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));
|
||||
|
|
Loading…
Reference in New Issue