You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by sh...@apache.org on 2017/09/18 16:24:38 UTC
[04/50] lucene-solr:feature/autoscaling_72: SOLR-10792: remove
OldLuceneQParser (FINALLY deprecated in 7.0) from master
SOLR-10792: remove OldLuceneQParser (FINALLY deprecated in 7.0) from master
Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/ba9504d4
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/ba9504d4
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/ba9504d4
Branch: refs/heads/feature/autoscaling_72
Commit: ba9504d49dea4465afec75cb0c5e784117d4bf8a
Parents: 5e83475
Author: Chris Hostetter <ho...@apache.org>
Authored: Wed Sep 6 16:24:11 2017 -0700
Committer: Chris Hostetter <ho...@apache.org>
Committed: Wed Sep 6 16:24:11 2017 -0700
----------------------------------------------------------------------
.../apache/solr/search/LuceneQParserPlugin.java | 54 ---------------
.../solr/search/OldLuceneQParserPlugin.java | 37 -----------
.../solr/collection1/conf/solrconfig.xml | 3 -
.../org/apache/solr/ConvertedLegacyTest.java | 70 ++++++++++----------
.../apache/solr/handler/SearchHandlerTest.java | 4 +-
.../apache/solr/search/QueryEqualityTest.java | 8 ---
.../apache/solr/search/QueryParsingTest.java | 1 -
7 files changed, 36 insertions(+), 141 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/ba9504d4/solr/core/src/java/org/apache/solr/search/LuceneQParserPlugin.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/search/LuceneQParserPlugin.java b/solr/core/src/java/org/apache/solr/search/LuceneQParserPlugin.java
index 912b57f..91c824a 100644
--- a/solr/core/src/java/org/apache/solr/search/LuceneQParserPlugin.java
+++ b/solr/core/src/java/org/apache/solr/search/LuceneQParserPlugin.java
@@ -16,13 +16,9 @@
*/
package org.apache.solr.search;
-import org.apache.lucene.search.Query;
-import org.apache.solr.common.params.CommonParams;
import org.apache.solr.common.params.SolrParams;
-import org.apache.solr.common.util.StrUtils;
import org.apache.solr.request.SolrQueryRequest;
-import java.util.List;
/**
* Parse Solr's variant on the Lucene QueryParser syntax.
* <br>Other parameters:<ul>
@@ -42,53 +38,3 @@ public class LuceneQParserPlugin extends QParserPlugin {
}
}
-@Deprecated
-class OldLuceneQParser extends LuceneQParser {
- String sortStr;
-
- public OldLuceneQParser(String qstr, SolrParams localParams, SolrParams params, SolrQueryRequest req) {
- super(qstr, localParams, params, req);
- }
-
- @Override
- public Query parse() throws SyntaxError {
- // handle legacy "query;sort" syntax
- if (getLocalParams() == null) {
- String qstr = getString();
- if (qstr == null || qstr.length() == 0)
- return null;
- sortStr = getParams().get(CommonParams.SORT);
- if (sortStr == null) {
- // sort may be legacy form, included in the query string
- List<String> commands = StrUtils.splitSmart(qstr,';');
- if (commands.size() == 2) {
- qstr = commands.get(0);
- sortStr = commands.get(1);
- } else if (commands.size() == 1) {
- // This is need to support the case where someone sends: "q=query;"
- qstr = commands.get(0);
- }
- else if (commands.size() > 2) {
- throw new SyntaxError("If you want to use multiple ';' in the query, use the 'sort' param.");
- }
- }
- setString(qstr);
- }
-
- return super.parse();
- }
-
- @Override
- public SortSpec getSortSpec(boolean useGlobal) throws SyntaxError {
- SortSpec sort = super.getSortSpec(useGlobal);
- if (sortStr != null && sortStr.length()>0 && sort.getSort()==null) {
- SortSpec oldSort = SortSpecParsing.parseSortSpec(sortStr, getReq());
- if( oldSort.getSort() != null ) {
- sort.setSortAndFields(oldSort.getSort(), oldSort.getSchemaFields());
- }
- }
- return sort;
- }
-
-}
-
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/ba9504d4/solr/core/src/java/org/apache/solr/search/OldLuceneQParserPlugin.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/search/OldLuceneQParserPlugin.java b/solr/core/src/java/org/apache/solr/search/OldLuceneQParserPlugin.java
deleted file mode 100644
index d4cbfcb..0000000
--- a/solr/core/src/java/org/apache/solr/search/OldLuceneQParserPlugin.java
+++ /dev/null
@@ -1,37 +0,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.
- */
-package org.apache.solr.search;
-
-import org.apache.solr.common.params.SolrParams;
-import org.apache.solr.request.SolrQueryRequest;
-
-/**
- * Parse Solr's variant of Lucene QueryParser syntax, including the
- * deprecated sort specification after the query.
- * <br>Example: <code>{!lucenePlusSort}myfield:foo +bar -baz;price asc</code>
- *
- * @deprecated This class should have been removed a long time ago, it will be removed in Solr 8.0
- */
-@Deprecated
-public class OldLuceneQParserPlugin extends QParserPlugin {
- public static final String NAME = "lucenePlusSort";
-
- @Override
- public QParser createParser(String qstr, SolrParams localParams, SolrParams params, SolrQueryRequest req) {
- return new OldLuceneQParser(qstr, localParams, params, req);
- }
-}
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/ba9504d4/solr/core/src/test-files/solr/collection1/conf/solrconfig.xml
----------------------------------------------------------------------
diff --git a/solr/core/src/test-files/solr/collection1/conf/solrconfig.xml b/solr/core/src/test-files/solr/collection1/conf/solrconfig.xml
index 9422a4d..6528aba 100644
--- a/solr/core/src/test-files/solr/collection1/conf/solrconfig.xml
+++ b/solr/core/src/test-files/solr/collection1/conf/solrconfig.xml
@@ -489,9 +489,6 @@
<queryParser name="foo" class="FooQParserPlugin"/>
- <!-- deprecated parser, delete once class is deleted in Solr 8.0 -->
- <queryParser name="lucenePlusSort" class="solr.OldLuceneQParserPlugin"/>
-
<updateRequestProcessorChain name="dedupe">
<processor class="org.apache.solr.update.processor.SignatureUpdateProcessorFactory">
<bool name="enabled">false</bool>
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/ba9504d4/solr/core/src/test/org/apache/solr/ConvertedLegacyTest.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/ConvertedLegacyTest.java b/solr/core/src/test/org/apache/solr/ConvertedLegacyTest.java
index 35bd107..603dd03 100644
--- a/solr/core/src/test/org/apache/solr/ConvertedLegacyTest.java
+++ b/solr/core/src/test/org/apache/solr/ConvertedLegacyTest.java
@@ -43,7 +43,6 @@ public class ConvertedLegacyTest extends SolrTestCaseJ4 {
SolrQueryRequest req = null;
Map<String,String> args = new HashMap<>();
lrf.args.put(CommonParams.VERSION,"2.2");
- lrf.args.put("defType","lucenePlusSort");
// compact the index, keep things from getting out of hand
@@ -215,16 +214,16 @@ public class ConvertedLegacyTest extends SolrTestCaseJ4 {
,"*[count(//doc)=0]"
);
args = new HashMap<>();
- args.put("defType","lucenePlusSort");
- req = new LocalSolrQueryRequest(h.getCore(), "val_s:[a TO z];val_s1 asc",
+ args.put("sort","val_s1 asc");
+ req = new LocalSolrQueryRequest(h.getCore(), "val_s:[a TO z]",
"/select", 0, 0 , args);
assertQ(req
,"//*[@numFound='3'] "
,"*[count(//doc)=0]"
);
args = new HashMap<>();
- args.put("defType","lucenePlusSort");
- req = new LocalSolrQueryRequest(h.getCore(), "val_s:[a TO z];val_s1 desc",
+ args.put("sort","val_s1 desc");
+ req = new LocalSolrQueryRequest(h.getCore(), "val_s:[a TO z]",
"/select", 0, 0 , args);
assertQ(req
,"//*[@numFound='3'] "
@@ -518,11 +517,11 @@ public class ConvertedLegacyTest extends SolrTestCaseJ4 {
,"//@numFound[.='1'] "
,"//int[.='-2147483648']"
);
- assertQ(req("id:44;num_i1 asc;")
+ assertQ(req("q", "id:44", "sort","num_i1 asc")
,"//doc[1]/int[.='-2147483648'] "
,"//doc[last()]/int[.='2147483647']"
);
- assertQ(req("id:44;num_i1 desc;")
+ assertQ(req("q","id:44","sort","num_i1 desc")
,"//doc[1]/int[.='2147483647'] "
,"//doc[last()]/int[.='-2147483648']"
);
@@ -561,11 +560,11 @@ public class ConvertedLegacyTest extends SolrTestCaseJ4 {
,"//@numFound[.='1'] "
,"//long[.='-9223372036854775808']"
);
- assertQ(req("id:44;num_l1 asc;")
+ assertQ(req("q","id:44","sort","num_l1 asc")
,"//doc[1]/long[.='-9223372036854775808'] "
,"//doc[last()]/long[.='9223372036854775807']"
);
- assertQ(req("id:44;num_l1 desc;")
+ assertQ(req("q","id:44", "sort", "num_l1 desc")
,"//doc[1]/long[.='9223372036854775807'] "
,"//doc[last()]/long[.='-9223372036854775808']"
);
@@ -611,11 +610,11 @@ public class ConvertedLegacyTest extends SolrTestCaseJ4 {
assertQ(req("num_f1:\"-1e20\"")
,"//@numFound[.='1']"
);
- assertQ(req("id:44;num_f1 asc;")
+ assertQ(req("q", "id:44", "sort", "num_f1 asc")
,"//doc[1]/float[.='-Infinity'] "
,"//doc[last()]/float[.='NaN']"
);
- assertQ(req("id:44;num_f1 desc;")
+ assertQ(req("q", "id:44", "sort","num_f1 desc")
,"//doc[1]/float[.='NaN'] "
,"//doc[last()]/float[.='-Infinity']"
);
@@ -663,11 +662,11 @@ public class ConvertedLegacyTest extends SolrTestCaseJ4 {
assertQ(req("num_d1:\"1e-100\"")
,"//@numFound[.='1']"
);
- assertQ(req("id:44;num_d1 asc;")
+ assertQ(req("q", "id:44", "sort", "num_d1 asc")
,"//doc[1]/double[.='-Infinity'] "
,"//doc[last()]/double[.='NaN']"
);
- assertQ(req("id:44;num_d1 desc;")
+ assertQ(req("q","id:44","sort","num_d1 desc")
,"//doc[1]/double[.='NaN'] "
,"//doc[last()]/double[.='-Infinity']"
);
@@ -693,27 +692,27 @@ public class ConvertedLegacyTest extends SolrTestCaseJ4 {
,"*[count(//doc)=6]"
);
- assertQ(req("id:44; a_i1 asc,b_i1 desc")
+ assertQ(req("q","id:44", "sort", "a_i1 asc,b_i1 desc")
,"*[count(//doc)=6] "
,"//doc[3]/int[.='100'] "
,"//doc[4]/int[.='50']"
);
- assertQ(req("id:44;a_i1 asc , b_i1 asc;")
+ assertQ(req("q","id:44", "sort", "a_i1 asc , b_i1 asc")
,"*[count(//doc)=6] "
,"//doc[3]/int[.='50'] "
,"//doc[4]/int[.='100']"
);
- assertQ(req("id:44;a_i1 asc;")
+ assertQ(req("q", "id:44", "sort", "a_i1 asc")
,"*[count(//doc)=6] "
,"//doc[1]/int[.='-1'] "
,"//doc[last()]/int[.='15']"
);
- assertQ(req("id:44;a_i1 asc , score top;")
+ assertQ(req("q","id:44","sort","a_i1 asc , score top")
,"*[count(//doc)=6] "
,"//doc[1]/int[.='-1'] "
,"//doc[last()]/int[.='15']"
);
- assertQ(req("id:44; score top , a_i1 top, b_i1 bottom ;")
+ assertQ(req("q","id:44","sort","score top , a_i1 top, b_i1 bottom ")
,"*[count(//doc)=6] "
,"//doc[last()]/int[.='-1'] "
,"//doc[1]/int[.='15'] "
@@ -736,36 +735,36 @@ public class ConvertedLegacyTest extends SolrTestCaseJ4 {
assertQ(req("id_i:[1000 TO 1010]")
,"*[count(//doc)=7]"
);
- assertQ(req("id_i:[1000 TO 1010]; b_i1 asc")
+ assertQ(req("q","id_i:[1000 TO 1010]","sort","b_i1 asc")
,"*[count(//doc)=7] "
,"//doc[1]/int[.='50'] "
,"//doc[2]/int[.='100']"
);
- assertQ(req("id_i:[1000 TO 1010]; b_i1 desc")
+ assertQ(req("q","id_i:[1000 TO 1010]","sort"," b_i1 desc")
,"*[count(//doc)=7] "
,"//doc[1]/int[.='100'] "
,"//doc[2]/int[.='50']"
);
- assertQ(req("id_i:[1000 TO 1010]; a_i1 asc,b_i1 desc")
+ assertQ(req("q","id_i:[1000 TO 1010]","sort"," a_i1 asc,b_i1 desc")
,"*[count(//doc)=7] "
,"//doc[3]/int[@name='b_i1' and .='100'] "
,"//doc[4]/int[@name='b_i1' and .='50'] "
,"//doc[5]/arr[@name='id_i' and .='1000']"
);
- assertQ(req("id_i:[1000 TO 1010]; a_i1 asc,b_i1 asc")
+ assertQ(req("q","id_i:[1000 TO 1010]","sort"," a_i1 asc,b_i1 asc")
,"*[count(//doc)=7] "
,"//doc[3]/int[@name='b_i1' and .='50'] "
,"//doc[4]/int[@name='b_i1' and .='100'] "
,"//doc[5]/arr[@name='id_i' and .='1000']"
);
// nullfirst tests
- assertQ(req("id_i:[1000 TO 1002]; nullfirst asc")
+ assertQ(req("q","id_i:[1000 TO 1002]","sort"," nullfirst asc")
,"*[count(//doc)=3] "
,"//doc[1]/arr[@name='id_i' and .='1002']"
,"//doc[2]/arr[@name='id_i' and .='1001'] "
,"//doc[3]/arr[@name='id_i' and .='1000']"
);
- assertQ(req("id_i:[1000 TO 1002]; nullfirst desc")
+ assertQ(req("q","id_i:[1000 TO 1002]","sort"," nullfirst desc")
,"*[count(//doc)=3] "
,"//doc[1]/arr[@name='id_i' and .='1002']"
,"//doc[2]/arr[@name='id_i' and .='1000'] "
@@ -779,16 +778,16 @@ public class ConvertedLegacyTest extends SolrTestCaseJ4 {
// Sort parsing exception tests. (SOLR-6, SOLR-99)
assertQEx( "can not sort unindexed fields",
- req( "id_i:1000; shouldbeunindexed asc" ), 400 );
+ req( "q","id_i:1000", "sort", "shouldbeunindexed asc" ), 400 );
assertQEx( "invalid query format",
- req( "id_i:1000; nullfirst" ), 400 );
+ req( "q","id_i:1000", "sort", "nullfirst" ), 400 );
assertQEx( "unknown sort field",
- req( "id_i:1000; abcde12345 asc" ), 400 );
+ req( "q","id_i:1000", "sort", "abcde12345 asc" ), 400 );
assertQEx( "unknown sort order",
- req( "id_i:1000; nullfirst aaa" ), 400 );
+ req( "q","id_i:1000", "sort", "nullfirst aaa" ), 400 );
resetExceptionIgnores();
@@ -1166,32 +1165,31 @@ public class ConvertedLegacyTest extends SolrTestCaseJ4 {
);
args = new HashMap<>();
args.put("fl","score ");
- args.put("defType","lucenePlusSort");
- req = new LocalSolrQueryRequest(h.getCore(), "id:44;id desc;",
+ args.put("sort","id desc");
+ req = new LocalSolrQueryRequest(h.getCore(), "id:44",
"/select", 0, 10, args);
assertQ(req
,"//result[@maxScore>0]"
);
args = new HashMap<>();
args.put("fl","score ");
- args.put("defType","lucenePlusSort");
- req = new LocalSolrQueryRequest(h.getCore(), "id:44;",
+ req = new LocalSolrQueryRequest(h.getCore(), "id:44",
"/select", 0, 10, args);
assertQ(req
,"//@maxScore = //doc/float[@name='score']"
);
args = new HashMap<>();
args.put("fl","score ");
- args.put("defType","lucenePlusSort");
- req = new LocalSolrQueryRequest(h.getCore(), "id:44;id desc;",
+ args.put("sort","id desc");
+ req = new LocalSolrQueryRequest(h.getCore(), "id:44",
"/select", 0, 10, args);
assertQ(req
,"//@maxScore = //doc/float[@name='score']"
);
args = new HashMap<>();
args.put("fl","*,score");
- args.put("defType","lucenePlusSort");
- req = new LocalSolrQueryRequest(h.getCore(), "id:44;id desc;",
+ args.put("sort","id desc");
+ req = new LocalSolrQueryRequest(h.getCore(), "id:44",
"/select", 0, 0 , args);
assertQ(req
,"//result[@maxScore>0]"
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/ba9504d4/solr/core/src/test/org/apache/solr/handler/SearchHandlerTest.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/handler/SearchHandlerTest.java b/solr/core/src/test/org/apache/solr/handler/SearchHandlerTest.java
index b35103b..4fa5f10 100644
--- a/solr/core/src/test/org/apache/solr/handler/SearchHandlerTest.java
+++ b/solr/core/src/test/org/apache/solr/handler/SearchHandlerTest.java
@@ -63,14 +63,14 @@ public class SearchHandlerTest extends AbstractSolrTestCase {
);
// Using legacy ';' param
- assertQ(req("q", "title:test; val_s1 desc", "defType","lucenePlusSort")
+ assertQ(req("q", "title:test", "sort","val_s1 desc")
,"//*[@numFound='3']"
,"//result/doc[1]/str[@name='id'][.='12']"
,"//result/doc[2]/str[@name='id'][.='11']"
,"//result/doc[3]/str[@name='id'][.='10']"
);
- assertQ(req("q", "title:test; val_s1 asc", "defType","lucenePlusSort")
+ assertQ(req("q", "title:test", "sort", "val_s1 asc")
,"//*[@numFound='3']"
,"//result/doc[1]/str[@name='id'][.='10']"
,"//result/doc[2]/str[@name='id'][.='11']"
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/ba9504d4/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 eab254f..4177d81 100644
--- a/solr/core/src/test/org/apache/solr/search/QueryEqualityTest.java
+++ b/solr/core/src/test/org/apache/solr/search/QueryEqualityTest.java
@@ -94,14 +94,6 @@ public class QueryEqualityTest extends SolrTestCaseJ4 {
" +apache +solr");
}
- @Deprecated
- public void testQueryLucenePlusSort() throws Exception {
- assertQueryEquals("lucenePlusSort",
- "apache solr", "apache solr", "apache solr ; score desc");
- assertQueryEquals("lucenePlusSort",
- "+apache +solr", "apache AND solr", " +apache +solr; score desc");
- }
-
public void testQueryPrefix() throws Exception {
SolrQueryRequest req = req("myField","foo_s");
try {
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/ba9504d4/solr/core/src/test/org/apache/solr/search/QueryParsingTest.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/search/QueryParsingTest.java b/solr/core/src/test/org/apache/solr/search/QueryParsingTest.java
index 925f71b..20ea941 100644
--- a/solr/core/src/test/org/apache/solr/search/QueryParsingTest.java
+++ b/solr/core/src/test/org/apache/solr/search/QueryParsingTest.java
@@ -43,7 +43,6 @@ public class QueryParsingTest extends SolrTestCaseJ4 {
SolrQueryRequest req = req("df", "text");
final String[] parsersTested = new String[] {
- OldLuceneQParserPlugin.NAME,
LuceneQParserPlugin.NAME,
DisMaxQParserPlugin.NAME,
ExtendedDismaxQParserPlugin.NAME