diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt index bb47496a0d5..d593eeac9c9 100644 --- a/solr/CHANGES.txt +++ b/solr/CHANGES.txt @@ -183,6 +183,36 @@ Upgrading from Solr 4.x * Due to changes in the underlying commons-codec package, users of the BeiderMorseFilterFactory will need to rebuild their indexes after upgrading. See LUCENE-6058 for more details. +* CachedSqlEntityProcessor has been removed, use SqlEntityProcessor with the + cacheImpl parameter. + +* HttpDataSource has been removed, use URLDataSource instead. + +* LegacyHTMLStripCharFilter has been removed + +* CoreAdminRequest.persist() call has been removed. All changes made via + CoreAdmin are persistent. + +* SpellCheckResponse.getSuggestions() and getSuggestionFrequencies() have been + removed, use getAlternatives() and getAlternativeFrequencies() instead. + +* SolrQuery deprecated methods have been removed: + - setMissing() is now setFacetMissing() + - getFacetSort() is now getFacetSortString() + - setFacetSort(boolean) should instead use setFacetSort(String) with + FacetParams.FACET_SORT_COUNT or FacetParams.FACET_SORT_INDEX + - setSortField(String, ORDER) should use setSort(SortClause) + - addSortField(String, ORDER) should use addSort(SortClause) + - removeSortField(String, ORDER) shoudl use removeSort(SortClause) + - getSortFields() should use getSorts() + - set/getQueryType() should use set/getRequestHandler() + +* ClientUtil deprecated date methods have been removed, use DateUtil instead + +* FacetParams.FacetDateOther has been removed, use FacetRangeOther + +* ShardParams.SHARD_KEYS has been removed, use ShardParams._ROUTE_ + * The 'old-style' solr.xml format is no longer supported, and cores must be defined using core.properties files. See https://cwiki.apache.org/confluence/display/solr/Format+of+solr.xml @@ -749,6 +779,9 @@ Other Changes * SOLR-6840: Remove support for old-style solr.xml (Erick Erickson, Alan Woodward) +* SOLR-6976: Remove classes and methods deprecated in 4.x (Alan Woodward, Noble + Paul, Chris Hostetter) + ================== 4.10.3 ================== Bug Fixes diff --git a/solr/contrib/dataimporthandler/src/java/org/apache/solr/handler/dataimport/CachedSqlEntityProcessor.java b/solr/contrib/dataimporthandler/src/java/org/apache/solr/handler/dataimport/CachedSqlEntityProcessor.java deleted file mode 100644 index 56c464c274b..00000000000 --- a/solr/contrib/dataimporthandler/src/java/org/apache/solr/handler/dataimport/CachedSqlEntityProcessor.java +++ /dev/null @@ -1,41 +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.handler.dataimport; - -/** - * This class enables caching of data obtained from the DB to avoid too many sql - * queries - *

- *

- * Refer to http://wiki.apache - * .org/solr/DataImportHandler for more details. - *

- *

- * This API is experimental and subject to change - * - * @since solr 1.3 - * @deprecated - Use SqlEntityProcessor with cacheImpl parameter. - */ -@Deprecated -public class CachedSqlEntityProcessor extends SqlEntityProcessor { - @Override - protected void initCache(Context context) { - cacheSupport = new DIHCacheSupport(context, "SortedMapBackedCache"); - } - -} diff --git a/solr/contrib/dataimporthandler/src/java/org/apache/solr/handler/dataimport/HttpDataSource.java b/solr/contrib/dataimporthandler/src/java/org/apache/solr/handler/dataimport/HttpDataSource.java deleted file mode 100644 index 04633f3d0e1..00000000000 --- a/solr/contrib/dataimporthandler/src/java/org/apache/solr/handler/dataimport/HttpDataSource.java +++ /dev/null @@ -1,39 +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.handler.dataimport; - -/** - *

- * A data source implementation which can be used to read character files using - * HTTP. - *

- *

- *

- * Refer to http://wiki.apache.org/solr/DataImportHandler - * for more details. - *

- *

- * This API is experimental and may change in the future. - * - * @since solr 1.3 - * @deprecated use {@link org.apache.solr.handler.dataimport.URLDataSource} instead - */ -@Deprecated -public class HttpDataSource extends URLDataSource { - -} diff --git a/solr/contrib/dataimporthandler/src/java/org/apache/solr/handler/dataimport/config/ConfigNameConstants.java b/solr/contrib/dataimporthandler/src/java/org/apache/solr/handler/dataimport/config/ConfigNameConstants.java index d6add000760..a34e31d430d 100644 --- a/solr/contrib/dataimporthandler/src/java/org/apache/solr/handler/dataimport/config/ConfigNameConstants.java +++ b/solr/contrib/dataimporthandler/src/java/org/apache/solr/handler/dataimport/config/ConfigNameConstants.java @@ -16,12 +16,12 @@ */ package org.apache.solr.handler.dataimport.config; +import org.apache.solr.handler.dataimport.SolrWriter; + import java.util.Collections; import java.util.HashSet; import java.util.Set; -import org.apache.solr.handler.dataimport.SolrWriter; - public class ConfigNameConstants { public static final String SCRIPT = "script"; @@ -31,10 +31,6 @@ public class ConfigNameConstants { public static final String PROPERTY_WRITER = "propertyWriter"; - /** - * @deprecated use IMPORTER_NS_SHORT instead - */ - @Deprecated public static final String IMPORTER_NS = "dataimporter"; public static final String IMPORTER_NS_SHORT = "dih"; diff --git a/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/AbstractSqlEntityProcessorTestCase.java b/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/AbstractSqlEntityProcessorTestCase.java index c9afeb7654e..e4eff3cb2bd 100644 --- a/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/AbstractSqlEntityProcessorTestCase.java +++ b/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/AbstractSqlEntityProcessorTestCase.java @@ -1,5 +1,9 @@ package org.apache.solr.handler.dataimport; +import junit.framework.Assert; +import org.junit.After; +import org.junit.Before; + import java.io.File; import java.nio.file.Files; import java.sql.Connection; @@ -17,11 +21,6 @@ import java.util.Locale; import java.util.Map; import java.util.Set; -import junit.framework.Assert; - -import org.junit.After; -import org.junit.Before; - /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with @@ -634,8 +633,7 @@ public abstract class AbstractSqlEntityProcessorTestCase extends + "newColumnName=''countryAdded_s'' newColumnValue=''country_added'' " : ""); if (countryCached) { - sb.append(random().nextBoolean() ? "processor=''SqlEntityProcessor'' cacheImpl=''SortedMapBackedCache'' " - : "processor=''CachedSqlEntityProcessor'' "); + sb.append("processor=''SqlEntityProcessor'' cacheImpl=''SortedMapBackedCache'' "); if (useSimpleCaches) { sb.append("query=''SELECT CODE, COUNTRY_NAME FROM COUNTRIES WHERE DELETED != 'Y' AND CODE='${People.COUNTRY_CODE}' ''>\n"); } else { @@ -671,8 +669,7 @@ public abstract class AbstractSqlEntityProcessorTestCase extends + "newColumnName=''sportsAdded_s'' newColumnValue=''sport_added'' " : ""); if (sportsCached) { - sb.append(random().nextBoolean() ? "processor=''SqlEntityProcessor'' cacheImpl=''SortedMapBackedCache'' " - : "processor=''CachedSqlEntityProcessor'' "); + sb.append("processor=''SqlEntityProcessor'' cacheImpl=''SortedMapBackedCache'' "); if (useSimpleCaches) { sb.append("query=''SELECT ID, SPORT_NAME FROM PEOPLE_SPORTS WHERE DELETED != 'Y' AND PERSON_ID=${People.ID} ORDER BY ID'' "); } else { diff --git a/solr/contrib/map-reduce/src/test/org/apache/solr/hadoop/MorphlineBasicMiniMRTest.java b/solr/contrib/map-reduce/src/test/org/apache/solr/hadoop/MorphlineBasicMiniMRTest.java index 3fca912cbc9..4250fc1ea19 100644 --- a/solr/contrib/map-reduce/src/test/org/apache/solr/hadoop/MorphlineBasicMiniMRTest.java +++ b/solr/contrib/map-reduce/src/test/org/apache/solr/hadoop/MorphlineBasicMiniMRTest.java @@ -16,15 +16,13 @@ */ package org.apache.solr.hadoop; -import java.io.File; -import java.io.IOException; -import java.io.OutputStream; -import java.io.OutputStreamWriter; -import java.io.Writer; -import java.lang.reflect.Array; -import java.nio.charset.StandardCharsets; -import java.util.Arrays; - +import com.carrotsearch.randomizedtesting.annotations.ThreadLeakAction; +import com.carrotsearch.randomizedtesting.annotations.ThreadLeakAction.Action; +import com.carrotsearch.randomizedtesting.annotations.ThreadLeakLingering; +import com.carrotsearch.randomizedtesting.annotations.ThreadLeakScope; +import com.carrotsearch.randomizedtesting.annotations.ThreadLeakScope.Scope; +import com.carrotsearch.randomizedtesting.annotations.ThreadLeakZombies; +import com.carrotsearch.randomizedtesting.annotations.ThreadLeakZombies.Consequence; import org.apache.commons.io.FileUtils; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.fs.FileSystem; @@ -49,13 +47,14 @@ import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.Test; -import com.carrotsearch.randomizedtesting.annotations.ThreadLeakAction; -import com.carrotsearch.randomizedtesting.annotations.ThreadLeakAction.Action; -import com.carrotsearch.randomizedtesting.annotations.ThreadLeakLingering; -import com.carrotsearch.randomizedtesting.annotations.ThreadLeakScope; -import com.carrotsearch.randomizedtesting.annotations.ThreadLeakScope.Scope; -import com.carrotsearch.randomizedtesting.annotations.ThreadLeakZombies; -import com.carrotsearch.randomizedtesting.annotations.ThreadLeakZombies.Consequence; +import java.io.File; +import java.io.IOException; +import java.io.OutputStream; +import java.io.OutputStreamWriter; +import java.io.Writer; +import java.lang.reflect.Array; +import java.nio.charset.StandardCharsets; +import java.util.Arrays; @ThreadLeakAction({Action.WARN}) @ThreadLeakLingering(linger = 0) diff --git a/solr/contrib/morphlines-core/src/test/org/apache/solr/morphlines/solr/SolrMorphlineTest.java b/solr/contrib/morphlines-core/src/test/org/apache/solr/morphlines/solr/SolrMorphlineTest.java index 1fceed95128..64fa2ec6d70 100644 --- a/solr/contrib/morphlines-core/src/test/org/apache/solr/morphlines/solr/SolrMorphlineTest.java +++ b/solr/contrib/morphlines-core/src/test/org/apache/solr/morphlines/solr/SolrMorphlineTest.java @@ -16,7 +16,6 @@ */ package org.apache.solr.morphlines.solr; -import org.junit.BeforeClass; import org.junit.Test; import org.kitesdk.morphline.api.Record; import org.kitesdk.morphline.base.Fields; diff --git a/solr/contrib/morphlines-core/src/test/org/apache/solr/morphlines/solr/SolrMorphlineZkAliasTest.java b/solr/contrib/morphlines-core/src/test/org/apache/solr/morphlines/solr/SolrMorphlineZkAliasTest.java index 1de9a6d506e..d6a2e10f19f 100644 --- a/solr/contrib/morphlines-core/src/test/org/apache/solr/morphlines/solr/SolrMorphlineZkAliasTest.java +++ b/solr/contrib/morphlines-core/src/test/org/apache/solr/morphlines/solr/SolrMorphlineZkAliasTest.java @@ -47,7 +47,7 @@ import java.util.Iterator; @ThreadLeakScope(Scope.NONE) @Slow public class SolrMorphlineZkAliasTest extends AbstractSolrMorphlineZkTestBase { - + @Override public void doTest() throws Exception { diff --git a/solr/contrib/morphlines-core/src/test/org/apache/solr/morphlines/solr/SolrMorphlineZkAvroTest.java b/solr/contrib/morphlines-core/src/test/org/apache/solr/morphlines/solr/SolrMorphlineZkAvroTest.java index db1c96b22dc..263b4720ae5 100644 --- a/solr/contrib/morphlines-core/src/test/org/apache/solr/morphlines/solr/SolrMorphlineZkAvroTest.java +++ b/solr/contrib/morphlines-core/src/test/org/apache/solr/morphlines/solr/SolrMorphlineZkAvroTest.java @@ -35,7 +35,6 @@ import org.apache.lucene.util.LuceneTestCase.Slow; import org.apache.solr.client.solrj.SolrQuery; import org.apache.solr.client.solrj.response.QueryResponse; import org.apache.solr.common.SolrDocument; -import org.junit.BeforeClass; import org.kitesdk.morphline.api.Record; import org.kitesdk.morphline.base.Fields; import org.kitesdk.morphline.base.Notifications; @@ -53,7 +52,7 @@ import java.util.List; @ThreadLeakScope(Scope.NONE) @Slow public class SolrMorphlineZkAvroTest extends AbstractSolrMorphlineZkTestBase { - + @Override public void doTest() throws Exception { Joiner joiner = Joiner.on(File.separator); diff --git a/solr/contrib/morphlines-core/src/test/org/apache/solr/morphlines/solr/SolrMorphlineZkTest.java b/solr/contrib/morphlines-core/src/test/org/apache/solr/morphlines/solr/SolrMorphlineZkTest.java index 753126a2fa8..fef15329e47 100644 --- a/solr/contrib/morphlines-core/src/test/org/apache/solr/morphlines/solr/SolrMorphlineZkTest.java +++ b/solr/contrib/morphlines-core/src/test/org/apache/solr/morphlines/solr/SolrMorphlineZkTest.java @@ -41,7 +41,7 @@ import java.util.Iterator; @ThreadLeakScope(Scope.NONE) @Slow public class SolrMorphlineZkTest extends AbstractSolrMorphlineZkTestBase { - + @Override public void doTest() throws Exception { diff --git a/solr/core/src/java/org/apache/solr/analysis/LegacyHTMLStripCharFilter.java b/solr/core/src/java/org/apache/solr/analysis/LegacyHTMLStripCharFilter.java deleted file mode 100644 index 515f8b7207b..00000000000 --- a/solr/core/src/java/org/apache/solr/analysis/LegacyHTMLStripCharFilter.java +++ /dev/null @@ -1,1372 +0,0 @@ -package org.apache.solr.analysis; - -/* - * 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. - */ - -import java.io.BufferedReader; -import java.io.IOException; -import java.io.InputStreamReader; -import java.io.Reader; -import java.nio.charset.Charset; -import java.util.HashMap; -import java.util.Set; - -import org.apache.lucene.analysis.charfilter.BaseCharFilter; - -/** - *

- * This class is NOT recommended for new users and should be - * considered UNSUPPORTED. - *

- *

- * In Solr version 3.5 and earlier, HTMLStripCharFilter(Factory) - * had known bugs in the offsets it provided, triggering e.g. exceptions in - * highlighting. - *

- *

- * This class is provided as possible alternative for people who depend on - * the "broken" behavior of HTMLStripCharFilter in Solr version 3.5 - * and earlier, and/or who don't like the changes introduced by the Solr 3.6+ - * version of HTMLStripCharFilterFactory. (See the 3.6.0 release - * section of solr/CHANGES.txt for a list of differences in behavior.) - *

- * @deprecated use {@link org.apache.lucene.analysis.charfilter.HTMLStripCharFilter} - */ -@Deprecated -public class LegacyHTMLStripCharFilter extends BaseCharFilter { - private int readAheadLimit = DEFAULT_READ_AHEAD; - private int safeReadAheadLimit = readAheadLimit - 3; - private int numWhitespace = 0; - private int numRead = 0; - private int numEaten = 0; - private int numReturned = 0; - private int lastMark; - private Set escapedTags; - - // pushback buffer - private final StringBuilder pushed = new StringBuilder(); - private static final int EOF=-1; - private static final int MISMATCH=-2; - - private static final int MATCH=-3; - // temporary buffer - private final StringBuilder sb = new StringBuilder(); - public static final int DEFAULT_READ_AHEAD = 8192; - - - public static void main(String[] args) throws IOException { - Reader in = new LegacyHTMLStripCharFilter( - new InputStreamReader(System.in, Charset.defaultCharset())); - int ch; - while ( (ch=in.read()) != -1 ) System.out.print((char)ch); - } - - public LegacyHTMLStripCharFilter(Reader source) { - super(source.markSupported() ? source : new BufferedReader(source)); - } - - public LegacyHTMLStripCharFilter(Reader source, Set escapedTags){ - this(source); - this.escapedTags = escapedTags; - } - - public LegacyHTMLStripCharFilter(Reader source, Set escapedTags, int readAheadLimit){ - this(source); - this.escapedTags = escapedTags; - this.readAheadLimit = readAheadLimit; - safeReadAheadLimit = readAheadLimit - 3; - } - - public int getReadAheadLimit() { - return readAheadLimit; - } - - private int next() throws IOException { - int len = pushed.length(); - if (len>0) { - int ch = pushed.charAt(len-1); - pushed.setLength(len-1); - return ch; - } - numRead++; - return input.read(); - } - - private int nextSkipWS() throws IOException { - int ch=next(); - while(isSpace(ch)) ch=next(); - return ch; - } - - private int peek() throws IOException { - int len = pushed.length(); - if (len>0) { - return pushed.charAt(len-1); - } - numRead++; - int ch = input.read(); - push(ch); - return ch; - } - - private void push(int ch) { - pushed.append((char)ch); - } - - - private boolean isSpace(int ch) { - switch (ch) { - case ' ': - case '\n': - case '\r': - case '\t': return true; - default: return false; - } - } - - private boolean isHex(int ch) { - return (ch>='0' && ch<='9') || - (ch>='A' && ch<='F') || - (ch>='a' && ch<='f'); - } - - private boolean isAlpha(int ch) { - return ch>='a' && ch<='z' || ch>='A' && ch<='Z'; - } - - private boolean isDigit(int ch) { - return ch>='0' && ch<='9'; - } - -/*** From HTML 4.0 -[4] NameChar ::= Letter | Digit | '.' | '-' | '_' | ':' | CombiningChar | Extender -[5] Name ::= (Letter | '_' | ':') (NameChar)* -[6] Names ::= Name (#x20 Name)* -[7] Nmtoken ::= (NameChar)+ -[8] Nmtokens ::= Nmtoken (#x20 Nmtoken)* -***/ - - // should I include all id chars allowable by HTML/XML here? - // including accented chars, ':', etc? - private boolean isIdChar(int ch) { - // return Character.isUnicodeIdentifierPart(ch); - // isUnicodeIdentiferPart doesn't include '-'... shoudl I still - // use it and add in '-',':',etc? - return isAlpha(ch) || isDigit(ch) || ch=='.' || - ch=='-' || ch=='_' || ch==':' - || Character.isLetter(ch); - - } - - private boolean isFirstIdChar(int ch) { - return Character.isUnicodeIdentifierStart(ch); - // return isAlpha(ch) || ch=='_' || Character.isLetter(ch); - } - - - private void saveState() throws IOException { - lastMark = numRead; - input.mark(readAheadLimit); - } - - private void restoreState() throws IOException { - input.reset(); - pushed.setLength(0); - } - - private int readNumericEntity() throws IOException { - // "&#" has already been read at this point - int eaten = 2; - - // is this decimal, hex, or nothing at all. - int ch = next(); - int base=10; - boolean invalid=false; - sb.setLength(0); - - if (isDigit(ch)) { - // decimal character entity - sb.append((char)ch); - for (int i=0; i<10; i++) { - ch = next(); - if (isDigit(ch)) { - sb.append((char)ch); - } else { - break; - } - } - } else if (ch=='x') { - eaten++; - // hex character entity - base=16; - sb.setLength(0); - for (int i=0; i<10; i++) { - ch = next(); - if (isHex(ch)) { - sb.append((char)ch); - } else { - break; - } - } - } else { - return MISMATCH; - } - - - // In older HTML, an entity may not have always been terminated - // with a semicolon. We'll also treat EOF or whitespace as terminating - // the entity. - try { - if (ch==';' || ch==-1) { - // do not account for the eaten ";" due to the fact that we do output a char - numWhitespace = sb.length() + eaten; - return Integer.parseInt(sb.toString(), base); - } - - // if whitespace terminated the entity, we need to return - // that whitespace on the next call to read(). - if (isSpace(ch)) { - push(ch); - numWhitespace = sb.length() + eaten; - return Integer.parseInt(sb.toString(), base); - } - } catch (NumberFormatException e) { - return MISMATCH; - } - - // Not an entity... - return MISMATCH; - } - - private int readEntity() throws IOException { - int ch = next(); - if (ch=='#') return readNumericEntity(); - - //read an entity reference - - // for an entity reference, require the ';' for safety. - // otherwise we may try and convert part of some company - // names to an entity. "Alpha&Beta Corp" for instance. - // - // TODO: perhaps I should special case some of the - // more common ones like & to make the ';' optional... - - sb.setLength(0); - sb.append((char)ch); - - for (int i=0; i< safeReadAheadLimit; i++) { - ch=next(); - if (Character.isLetter(ch)) { - sb.append((char)ch); - } else { - break; - } - } - - if (ch==';') { - String entity=sb.toString(); - Character entityChar = entityTable.get(entity); - if (entityChar!=null) { - numWhitespace = entity.length() + 1 ; - return entityChar.charValue(); - } - } - - return MISMATCH; - } - - /*** valid comments according to HTML specs - - - - - - Hello --> - - #comments inside of an entity decl: - - - Turns out, IE & mozilla don't parse comments correctly. - Since this is meant to be a practical stripper, I'll just - try and duplicate what the browsers do. - - - - - - - ***/ - - private int readBang(boolean inScript) throws IOException { - // at this point, "' ) { - - int ch = next(); - if (ch=='>') return MATCH; - - // if it starts with " - //since we did readComment already, it may be the case that we are already deep into the read ahead buffer - //so, we may need to abort sooner - while ((numRead - lastMark) < safeReadAheadLimit) { - ch = next(); - if (ch=='>') { - return MATCH; - } - else if (ch<0) { - return MISMATCH; - } - } - } - return MISMATCH; - } - - // tries to read comments the way browsers do, not - // strictly by the standards. - // - // GRRRR. it turns out that in the wild, a - // - private int readComment(boolean inScript) throws IOException { - // at this point "') { - push(ch); - push('-'); - continue; - } - - return MATCH; - } else if ((ch=='\'' || ch=='"') && inScript) { - push(ch); - int ret=readScriptString(); - // if this wasn't a string, there's not much we can do - // at this point without having a stack of stream states in - // order to "undo" just the latest. - } else if (ch=='<') { - eatSSI(); - } - - } - return MISMATCH; - - } - - - - private int readTag() throws IOException { - // at this point '<' has already been read - int ch = next(); - if (!isAlpha(ch)) { - push(ch); - return MISMATCH; - } - - sb.setLength(0); - sb.append((char)ch); - while((numRead - lastMark) < safeReadAheadLimit) { - - ch = next(); - if (isIdChar(ch)) { - sb.append((char)ch); - } else if (ch=='/') { - // Hmmm, a tag can close with "/>" as well as "/ >" - // read end tag '/>' or '/ >', etc - return nextSkipWS()=='>' ? MATCH : MISMATCH; - } else { - break; - } - } - if (escapedTags!=null && escapedTags.contains(sb.toString())){ - //if this is a reservedTag, then keep it - return MISMATCH; - } - // After the tag id, there needs to be either whitespace or - // '>' - if ( !(ch=='>' || isSpace(ch)) ) { - return MISMATCH; - } - - if (ch!='>') { - // process attributes - while ((numRead - lastMark) < safeReadAheadLimit) { - ch=next(); - if (isSpace(ch)) { - continue; - } else if (isFirstIdChar(ch)) { - push(ch); - int ret = readAttr2(); - if (ret==MISMATCH) return ret; - } else if (ch=='/') { - // read end tag '/>' or '/ >', etc - return nextSkipWS()=='>' ? MATCH : MISMATCH; - } else if (ch=='>') { - break; - } else { - return MISMATCH; - } - - } - if ((numRead - lastMark) >= safeReadAheadLimit){ - return MISMATCH;//exit out if we exceeded the buffer - } - } - - // We only get to this point after we have read the - // entire tag. Now let's see if it's a special tag. - String name=sb.toString(); - if (name.equalsIgnoreCase("script") || name.equalsIgnoreCase("style")) { - // The content of script and style elements is - // CDATA in HTML 4 but PCDATA in XHTML. - - /* From HTML4: - Although the STYLE and SCRIPT elements use CDATA for their data model, - for these elements, CDATA must be handled differently by user agents. - Markup and entities must be treated as raw text and passed to the application - as is. The first occurrence of the character sequence "foo - // beware markup in script strings: ...document.write("")foo - // TODO: do I need to worry about CDATA sections "') return MISMATCH; - return MATCH; - } else if (ch=='\'' || ch=='"') { - // read javascript string to avoid a false match. - push(ch); - int ret = readScriptString(); - // what to do about a non-match (non-terminated string?) - // play it safe and index the rest of the data I guess... - if (ret==MISMATCH) return MISMATCH; - } else if (ch<0) { - return MISMATCH; - } - - } - return MISMATCH; - } - - - // read a string escaped by backslashes - private int readScriptString() throws IOException { - int quoteChar = next(); - if (quoteChar!='\'' && quoteChar!='"') return MISMATCH; - - while((numRead - lastMark) < safeReadAheadLimit) { - int ch = next(); - if (ch==quoteChar) return MATCH; - else if (ch=='\\') { - ch=next(); - } else if (ch<0) { - return MISMATCH; - } else if (ch=='<') { - eatSSI(); - } - - } - return MISMATCH; - } - - - private int readName(boolean checkEscaped) throws IOException { - StringBuilder builder = (checkEscaped && escapedTags!=null) ? new StringBuilder() : null; - int ch = next(); - if (builder!=null) builder.append((char)ch); - if (!isFirstIdChar(ch)) return MISMATCH; - ch = next(); - if (builder!=null) builder.append((char)ch); - while(isIdChar(ch)) { - ch=next(); - if (builder!=null) builder.append((char)ch); - } - if (ch!=-1) { - push(ch); - - } - //strip off the trailing > - if (builder!=null && escapedTags.contains(builder.substring(0, builder.length() - 1))){ - return MISMATCH; - } - return MATCH; - } - - /*** - [10] AttValue ::= '"' ([^<&"] | Reference)* '"' - | "'" ([^<&'] | Reference)* "'" - - need to also handle unquoted attributes, and attributes w/o values: - - - ***/ - - // This reads attributes and attempts to handle any - // embedded server side includes that would otherwise - // mess up the quote handling. - // "> - private int readAttr2() throws IOException { - if ((numRead - lastMark < safeReadAheadLimit)) { - int ch = next(); - if (!isFirstIdChar(ch)) return MISMATCH; - ch = next(); - while(isIdChar(ch) && ((numRead - lastMark) < safeReadAheadLimit)){ - ch=next(); - } - if (isSpace(ch)) ch = nextSkipWS(); - - // attributes may not have a value at all! - // if (ch != '=') return MISMATCH; - if (ch != '=') { - push(ch); - return MATCH; - } - - int quoteChar = nextSkipWS(); - - if (quoteChar=='"' || quoteChar=='\'') { - while ((numRead - lastMark) < safeReadAheadLimit) { - ch = next(); - if (ch<0) return MISMATCH; - else if (ch=='<') { - eatSSI(); - } - else if (ch==quoteChar) { - return MATCH; - //} else if (ch=='<') { - // return MISMATCH; - } - - } - } else { - // unquoted attribute - while ((numRead - lastMark) < safeReadAheadLimit) { - ch = next(); - if (ch<0) return MISMATCH; - else if (isSpace(ch)) { - push(ch); - return MATCH; - } else if (ch=='>') { - push(ch); - return MATCH; - } else if (ch=='<') { - eatSSI(); - } - - } - } - } - return MISMATCH; - } - - // skip past server side include - private int eatSSI() throws IOException { - // at this point, only a "<" was read. - // on a mismatch, push back the last char so that if it was - // a quote that closes the attribute, it will be re-read and matched. - int ch = next(); - if (ch!='!') { - push(ch); - return MISMATCH; - } - ch=next(); - if (ch!='-') { - push(ch); - return MISMATCH; - } - ch=next(); - if (ch!='-') { - push(ch); - return MISMATCH; - } - ch=next(); - if (ch!='#') { - push(ch); - return MISMATCH; - } - - push('#'); push('-'); push('-'); - return readComment(false); - } - - private int readProcessingInstruction() throws IOException { - // "') { - next(); - return MATCH; - } else if (ch==-1) { - return MISMATCH; - } - - } - return MISMATCH; - } - - - - @Override - public int read() throws IOException { - // TODO: Do we ever want to preserve CDATA sections? - // where do we have to worry about them? - // - if (numWhitespace > 0){ - numEaten += numWhitespace; - addOffCorrectMap(numReturned, numEaten); - numWhitespace = 0; - } - numReturned++; - //do not limit this one by the READAHEAD - while(true) { - int lastNumRead = numRead; - int ch = next(); - - switch (ch) { - case '&': - saveState(); - ch = readEntity(); - if (ch>=0) return ch; - if (ch==MISMATCH) { - restoreState(); - - return '&'; - } - break; - - case '<': - saveState(); - ch = next(); - int ret = MISMATCH; - if (ch=='!') { - ret = readBang(false); - } else if (ch=='/') { - ret = readName(true); - if (ret==MATCH) { - ch=nextSkipWS(); - ret= ch=='>' ? MATCH : MISMATCH; - } - } else if (isAlpha(ch)) { - push(ch); - ret = readTag(); - } else if (ch=='?') { - ret = readProcessingInstruction(); - } - - // matched something to be discarded, so break - // from this case and continue in the loop - if (ret==MATCH) { - //break;//was - //return whitespace from - numWhitespace = (numRead - lastNumRead) - 1;//tack on the -1 since we are returning a space right now - return ' '; - } - - // didn't match any HTML constructs, so roll back - // the stream state and just return '<' - restoreState(); - return '<'; - - default: return ch; - } - - } - - - } - - @Override - public int read(char cbuf[], int off, int len) throws IOException { - int i=0; - for (i=0; i entityTable; - static { - entityTable = new HashMap<>(); - // entityName and entityVal generated from the python script - // included in comments at the end of this file. - final String[] entityName={ "zwnj","aring","gt","yen","ograve","Chi","delta","rang","sup","trade","Ntilde","xi","upsih","nbsp","Atilde","radic","otimes","aelig","oelig","equiv","ni","infin","Psi","auml","cup","Epsilon","otilde","lt","Icirc","Eacute","Lambda","sbquo","Prime","prime","psi","Kappa","rsaquo","Tau","uacute","ocirc","lrm","zwj","cedil","Alpha","not","amp","AElig","oslash","acute","lceil","alefsym","laquo","shy","loz","ge","Igrave","nu","Ograve","lsaquo","sube","euro","rarr","sdot","rdquo","Yacute","lfloor","lArr","Auml","Dagger","brvbar","Otilde","szlig","clubs","diams","agrave","Ocirc","Iota","Theta","Pi","zeta","Scaron","frac14","egrave","sub","iexcl","frac12","ordf","sum","prop","Uuml","ntilde","atilde","asymp","uml","prod","nsub","reg","rArr","Oslash","emsp","THORN","yuml","aacute","Mu","hArr","le","thinsp","dArr","ecirc","bdquo","Sigma","Aring","tilde","nabla","mdash","uarr","times","Ugrave","Eta","Agrave","chi","real","circ","eth","rceil","iuml","gamma","lambda","harr","Egrave","frac34","dagger","divide","Ouml","image","ndash","hellip","igrave","Yuml","ang","alpha","frasl","ETH","lowast","Nu","plusmn","bull","sup1","sup2","sup3","Aacute","cent","oline","Beta","perp","Delta","there4","pi","iota","empty","euml","notin","iacute","para","epsilon","weierp","OElig","uuml","larr","icirc","Upsilon","omicron","upsilon","copy","Iuml","Oacute","Xi","kappa","ccedil","Ucirc","cap","mu","scaron","lsquo","isin","Zeta","minus","deg","and","tau","pound","curren","int","ucirc","rfloor","ensp","crarr","ugrave","exist","cong","theta","oplus","permil","Acirc","piv","Euml","Phi","Iacute","quot","Uacute","Omicron","ne","iquest","eta","rsquo","yacute","Rho","darr","Ecirc","Omega","acirc","sim","phi","sigmaf","macr","thetasym","Ccedil","ordm","uArr","forall","beta","fnof","rho","micro","eacute","omega","middot","Gamma","rlm","lang","spades","supe","thorn","ouml","or","raquo","part","sect","ldquo","hearts","sigma","oacute"}; - final char[] entityVal={ 8204,229,62,165,242,935,948,9002,8835,8482,209,958,978,160,195,8730,8855,230,339,8801,8715,8734,936,228,8746,917,245,60,206,201,923,8218,8243,8242,968,922,8250,932,250,244,8206,8205,184,913,172,38,198,248,180,8968,8501,171,173,9674,8805,204,957,210,8249,8838,8364,8594,8901,8221,221,8970,8656,196,8225,166,213,223,9827,9830,224,212,921,920,928,950,352,188,232,8834,161,189,170,8721,8733,220,241,227,8776,168,8719,8836,174,8658,216,8195,222,255,225,924,8660,8804,8201,8659,234,8222,931,197,732,8711,8212,8593,215,217,919,192,967,8476,710,240,8969,239,947,955,8596,200,190,8224,247,214,8465,8211,8230,236,376,8736,945,8260,208,8727,925,177,8226,185,178,179,193,162,8254,914,8869,916,8756,960,953,8709,235,8713,237,182,949,8472,338,252,8592,238,933,959,965,169,207,211,926,954,231,219,8745,956,353,8216,8712,918,8722,176,8743,964,163,164,8747,251,8971,8194,8629,249,8707,8773,952,8853,8240,194,982,203,934,205,34,218,927,8800,191,951,8217,253,929,8595,202,937,226,8764,966,962,175,977,199,186,8657,8704,946,402,961,181,233,969,183,915,8207,9001,9824,8839,254,246,8744,187,8706,167,8220,9829,963,243}; - for (int i=0; i - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -24.3 Character entity references for symbols, mathematical symbols, and Greek letters - -The character entity references in this section produce characters that may be represented by glyphs in the widely available Adobe Symbol font, including Greek characters, various bracketing symbols, and a selection of mathematical operators such as gradient, product, and summation symbols. - -To support these entities, user agents may support full [ISO10646] or use other means. Display of glyphs for these characters may be obtained by being able to display the relevant [ISO10646] characters or by other means, such as internally mapping the listed entities, numeric character references, and characters to the appropriate position in some font that contains the requisite glyphs. - -When to use Greek entities. This entity set contains all the letters used in modern Greek. However, it does not include Greek punctuation, precomposed accented characters nor the non-spacing accents (tonos, dialytika) required to compose them. There are no archaic letters, Coptic-unique letters, or precomposed letters for Polytonic Greek. The entities defined here are not intended for the representation of modern Greek text and would not be an efficient representation; rather, they are intended for occasional Greek letters used in technical and mathematical works. -24.3.1 The list of characters - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -24.4 Character entity references for markup-significant and internationalization characters - -The character entity references in this section are for escaping markup-significant characters (these are the same as those in HTML 2.0 and 3.2), for denoting spaces and dashes. Other characters in this section apply to internationalization issues such as the disambiguation of bidirectional text (see the section on bidirectional text for details). - -Entities have also been added for the remaining characters occurring in CP-1252 which do not occur in the HTMLlat1 or HTMLsymbol entity sets. These all occur in the 128 to 159 range within the CP-1252 charset. These entities permit the characters to be denoted in a platform-independent manner. - -To support these entities, user agents may support full [ISO10646] or use other means. Display of glyphs for these characters may be obtained by being able to display the relevant [ISO10646] characters or by other means, such as internally mapping the listed entities, numeric character references, and characters to the appropriate position in some font that contains the requisite glyphs. -24.4.1 The list of characters - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -""" - -codes={} -for line in text.split('\n'): - parts = line.split() - if len(parts)<3 or parts[0]!=' - * <fieldType name="text_html_legacy" class="solr.TextField" positionIncrementGap="100"> - * <analyzer> - * <charFilter class="solr.LegacyHTMLStripCharFilterFactory"/> - * <tokenizer class="solr.WhitespaceTokenizerFactory"/> - * </analyzer> - * </fieldType> - * - *

- * This factory is NOT recommended for new users and should be - * considered UNSUPPORTED. - *

- *

- * In Solr version 3.5 and earlier, HTMLStripCharFilter(Factory) - * had known bugs in the offsets it provided, triggering e.g. exceptions in - * highlighting. - *

- *

- * This class is provided as possible alternative for people who depend on - * the "broken" behavior of HTMLStripCharFilter in Solr version 3.5 - * and earlier, and/or who don't like the changes introduced by the Solr 3.6+ - * version of HTMLStripCharFilterFactory. (See the 3.6.0 release - * section of lucene/CHANGES.txt for a list of differences in behavior.) - *

- * @deprecated use {@link HTMLStripCharFilterFactory} - */ -@Deprecated -public class LegacyHTMLStripCharFilterFactory extends CharFilterFactory { - - /** Creates a new LegacyHTMLStripCharFilterFactory */ - public LegacyHTMLStripCharFilterFactory(Map args) { - super(args); - if (!args.isEmpty()) { - throw new IllegalArgumentException("Unknown parameters: " + args); - } - } - - @Override - public LegacyHTMLStripCharFilter create(Reader input) { - return new LegacyHTMLStripCharFilter(input); - } - -} diff --git a/solr/core/src/java/org/apache/solr/analysis/SolrAnalyzer.java b/solr/core/src/java/org/apache/solr/analysis/SolrAnalyzer.java index 28c2bee221a..a33a373e11d 100644 --- a/solr/core/src/java/org/apache/solr/analysis/SolrAnalyzer.java +++ b/solr/core/src/java/org/apache/solr/analysis/SolrAnalyzer.java @@ -17,10 +17,9 @@ package org.apache.solr.analysis; -import org.apache.lucene.analysis.*; +import org.apache.lucene.analysis.Analyzer; import java.io.Reader; -import java.io.IOException; /** * @@ -37,14 +36,8 @@ public abstract class SolrAnalyzer extends Analyzer { return posIncGap; } - /** wrap the reader in a CharStream, if appropriate */ - @Deprecated - public Reader charStream(Reader reader) { - return reader; - } - @Override protected Reader initReader(String fieldName, Reader reader) { - return charStream(reader); + return reader; } } diff --git a/solr/core/src/java/org/apache/solr/client/solrj/embedded/EmbeddedSolrServer.java b/solr/core/src/java/org/apache/solr/client/solrj/embedded/EmbeddedSolrServer.java index 50df70b767f..1c5051d08b4 100644 --- a/solr/core/src/java/org/apache/solr/client/solrj/embedded/EmbeddedSolrServer.java +++ b/solr/core/src/java/org/apache/solr/client/solrj/embedded/EmbeddedSolrServer.java @@ -17,6 +17,7 @@ package org.apache.solr.client.solrj.embedded; +import com.google.common.base.Strings; import org.apache.solr.client.solrj.SolrClient; import org.apache.solr.client.solrj.SolrRequest; import org.apache.solr.client.solrj.SolrServerException; @@ -30,7 +31,6 @@ import org.apache.solr.common.params.SolrParams; import org.apache.solr.common.util.JavaBinCodec; import org.apache.solr.common.util.NamedList; import org.apache.solr.core.CoreContainer; -import org.apache.solr.core.CoreDescriptor; import org.apache.solr.core.SolrCore; import org.apache.solr.request.SolrQueryRequest; import org.apache.solr.request.SolrRequestHandler; @@ -62,25 +62,10 @@ public class EmbeddedSolrServer extends SolrClient /** * Use the other constructor using a CoreContainer and a name. - * @deprecated use {@link #EmbeddedSolrServer(CoreContainer, String)} instead. */ - @Deprecated public EmbeddedSolrServer(SolrCore core) { - if ( core == null ) { - throw new NullPointerException("SolrCore instance required"); - } - CoreDescriptor dcore = core.getCoreDescriptor(); - if (dcore == null) - throw new NullPointerException("CoreDescriptor required"); - - CoreContainer cores = dcore.getCoreContainer(); - if (cores == null) - throw new NullPointerException("CoreContainer required"); - - coreName = dcore.getName(); - coreContainer = cores; - _parser = new SolrRequestParsers( null ); + this(core.getCoreDescriptor().getCoreContainer(), core.getName()); } /** @@ -93,8 +78,10 @@ public class EmbeddedSolrServer extends SolrClient if ( coreContainer == null ) { throw new NullPointerException("CoreContainer instance required"); } + if (Strings.isNullOrEmpty(coreName)) + throw new SolrException(SolrException.ErrorCode.SERVER_ERROR, "Core name cannot be empty"); this.coreContainer = coreContainer; - this.coreName = coreName == null? "" : coreName; + this.coreName = coreName; _parser = new SolrRequestParsers( null ); } @@ -208,7 +195,7 @@ public class EmbeddedSolrServer extends SolrClient } // Now write it out - NamedList normalized = getParsedResponse(req, rsp); + NamedList normalized = BinaryResponseWriter.getParsedResponse(req, rsp); return normalized; } catch( IOException iox ) { @@ -227,18 +214,6 @@ public class EmbeddedSolrServer extends SolrClient } } - /** - * Returns a response object equivalent to what you get from the XML/JSON/javabin parser. Documents - * become SolrDocuments, DocList becomes SolrDocumentList etc. - * - * @deprecated use {@link BinaryResponseWriter#getParsedResponse(SolrQueryRequest, SolrQueryResponse)} - */ - @Deprecated - public NamedList getParsedResponse( SolrQueryRequest req, SolrQueryResponse rsp ) - { - return BinaryResponseWriter.getParsedResponse(req, rsp); - } - /** * Shutdown all cores within the EmbeddedSolrServer instance */ diff --git a/solr/core/src/java/org/apache/solr/common/ResourceLoader.java b/solr/core/src/java/org/apache/solr/common/ResourceLoader.java deleted file mode 100644 index e18663c3a50..00000000000 --- a/solr/core/src/java/org/apache/solr/common/ResourceLoader.java +++ /dev/null @@ -1,26 +0,0 @@ -package org.apache.solr.common; - -/* - * 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. - */ - -/** - * @deprecated This interface has been kept for backwards compatibility and will - * be removed in (5.0). Use {@link org.apache.lucene.analysis.util.ResourceLoader} - */ -@Deprecated -public interface ResourceLoader extends org.apache.lucene.analysis.util.ResourceLoader { -} diff --git a/solr/core/src/java/org/apache/solr/common/package.html b/solr/core/src/java/org/apache/solr/common/package.html deleted file mode 100644 index 6c251545b29..00000000000 --- a/solr/core/src/java/org/apache/solr/common/package.html +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - - -

-Commonly reused classes and interfaces (deprecated package, do not add new classes) - - -

- - diff --git a/solr/core/src/java/org/apache/solr/core/SolrResourceLoader.java b/solr/core/src/java/org/apache/solr/core/SolrResourceLoader.java index 6c567fe28bd..332a2cff2fa 100644 --- a/solr/core/src/java/org/apache/solr/core/SolrResourceLoader.java +++ b/solr/core/src/java/org/apache/solr/core/SolrResourceLoader.java @@ -18,6 +18,7 @@ package org.apache.solr.core; import org.apache.lucene.analysis.util.CharFilterFactory; +import org.apache.lucene.analysis.util.ResourceLoader; import org.apache.lucene.analysis.util.ResourceLoaderAware; import org.apache.lucene.analysis.util.TokenFilterFactory; import org.apache.lucene.analysis.util.TokenizerFactory; @@ -26,7 +27,6 @@ import org.apache.lucene.codecs.Codec; import org.apache.lucene.codecs.DocValuesFormat; import org.apache.lucene.codecs.PostingsFormat; import org.apache.lucene.util.IOUtils; -import org.apache.solr.common.ResourceLoader; import org.apache.solr.common.SolrException; import org.apache.solr.handler.admin.CoreAdminHandler; import org.apache.solr.handler.component.SearchComponent; @@ -546,10 +546,6 @@ public class SolrResourceLoader implements ResourceLoader,Closeable if (!live) { //TODO: Does SolrCoreAware make sense here since in a multi-core context // which core are we talking about ? - if (org.apache.solr.util.plugin.ResourceLoaderAware.class.isInstance(obj)) { - log.warn("Class [{}] uses org.apache.solr.util.plugin.ResourceLoaderAware " + - "which is deprecated. Change to org.apache.lucene.analysis.util.ResourceLoaderAware.", cname); - } if( obj instanceof ResourceLoaderAware ) { assertAwareCompatibility( ResourceLoaderAware.class, obj ); waitingForResources.add( (ResourceLoaderAware)obj ); @@ -589,10 +585,6 @@ public class SolrResourceLoader implements ResourceLoader,Closeable assertAwareCompatibility( SolrCoreAware.class, obj ); waitingForCore.add( (SolrCoreAware)obj ); } - if (org.apache.solr.util.plugin.ResourceLoaderAware.class.isInstance(obj)) { - log.warn("Class [{}] uses org.apache.solr.util.plugin.ResourceLoaderAware " + - "which is deprecated. Change to org.apache.lucene.analysis.util.ResourceLoaderAware.", cName); - } if( obj instanceof ResourceLoaderAware ) { assertAwareCompatibility( ResourceLoaderAware.class, obj ); waitingForResources.add( (ResourceLoaderAware)obj ); diff --git a/solr/core/src/java/org/apache/solr/handler/BinaryUpdateRequestHandler.java b/solr/core/src/java/org/apache/solr/handler/BinaryUpdateRequestHandler.java deleted file mode 100644 index ceb225155c6..00000000000 --- a/solr/core/src/java/org/apache/solr/handler/BinaryUpdateRequestHandler.java +++ /dev/null @@ -1,44 +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.handler; - -import org.apache.solr.common.util.NamedList; - -/** - * Update handler which uses the JavaBin format - * - * @see org.apache.solr.client.solrj.request.JavaBinUpdateRequestCodec - * @see org.apache.solr.common.util.JavaBinCodec - * - * use {@link UpdateRequestHandler} - */ -@Deprecated -public class BinaryUpdateRequestHandler extends UpdateRequestHandler { - - @Override - public void init(NamedList args) { - super.init(args); - setAssumeContentType("application/javabin"); - log.warn("Using deprecated class: "+this.getClass().getSimpleName()+" -- replace with UpdateRequestHandler"); - } - - @Override - public String getDescription() { - return "Add/Update multiple documents with javabin format"; - } -} diff --git a/solr/core/src/java/org/apache/solr/handler/CSVRequestHandler.java b/solr/core/src/java/org/apache/solr/handler/CSVRequestHandler.java deleted file mode 100644 index f6b91c9f1d4..00000000000 --- a/solr/core/src/java/org/apache/solr/handler/CSVRequestHandler.java +++ /dev/null @@ -1,45 +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.handler; - -import org.apache.solr.common.util.NamedList; - -/** - * use {@link UpdateRequestHandler} - */ -@Deprecated -public class CSVRequestHandler extends UpdateRequestHandler { - - @Override - public void init(NamedList args) { - super.init(args); - setAssumeContentType("application/csv"); - // log.warn("Using deprecated class: "+this.getClass().getSimpleName()+" -- replace with UpdateRequestHandler"); - } - - //////////////////////// SolrInfoMBeans methods ////////////////////// - @Override - public String getDescription() { - return "Add/Update multiple documents with CSV formatted rows"; - } -} - - - - - diff --git a/solr/core/src/java/org/apache/solr/handler/JsonUpdateRequestHandler.java b/solr/core/src/java/org/apache/solr/handler/JsonUpdateRequestHandler.java deleted file mode 100644 index 8c60ad4daf9..00000000000 --- a/solr/core/src/java/org/apache/solr/handler/JsonUpdateRequestHandler.java +++ /dev/null @@ -1,44 +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.handler; - -import org.apache.solr.common.util.NamedList; - -/** - * use {@link UpdateRequestHandler} - */ -@Deprecated -public class JsonUpdateRequestHandler extends UpdateRequestHandler { - - @Override - public void init(NamedList args) { - super.init(args); - setAssumeContentType("application/json"); - // log.warn("Using deprecated class: "+this.getClass().getSimpleName()+" -- replace with UpdateRequestHandler"); - } - - //////////////////////// SolrInfoMBeans methods ////////////////////// - - @Override - public String getDescription() { - return "Add documents with JSON"; - } -} - - - diff --git a/solr/core/src/java/org/apache/solr/handler/XmlUpdateRequestHandler.java b/solr/core/src/java/org/apache/solr/handler/XmlUpdateRequestHandler.java deleted file mode 100644 index d6f1f49116d..00000000000 --- a/solr/core/src/java/org/apache/solr/handler/XmlUpdateRequestHandler.java +++ /dev/null @@ -1,46 +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.handler; - -import org.apache.solr.common.util.NamedList; - -/** - * Add documents to solr using the STAX XML parser. - * - * use {@link UpdateRequestHandler} - */ -@Deprecated -public class XmlUpdateRequestHandler extends UpdateRequestHandler { - - @Override - public void init(NamedList args) { - super.init(args); - setAssumeContentType("application/xml"); - log.warn("Using deprecated class: "+this.getClass().getSimpleName()+" -- replace with UpdateRequestHandler"); - } - - //////////////////////// SolrInfoMBeans methods ////////////////////// - - @Override - public String getDescription() { - return "Add documents with XML"; - } -} - - - diff --git a/solr/core/src/java/org/apache/solr/handler/XsltUpdateRequestHandler.java b/solr/core/src/java/org/apache/solr/handler/XsltUpdateRequestHandler.java deleted file mode 100644 index 1bfdfaa5453..00000000000 --- a/solr/core/src/java/org/apache/solr/handler/XsltUpdateRequestHandler.java +++ /dev/null @@ -1,43 +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.handler; - -import org.apache.solr.common.util.NamedList; - -/** - * Add documents to solr using the STAX XML parser, transforming it with XSLT first - * - * use {@link UpdateRequestHandler} - */ -@Deprecated -public class XsltUpdateRequestHandler extends UpdateRequestHandler { - - @Override - public void init(NamedList args) { - super.init(args); - setAssumeContentType("application/xml"); - log.warn("Using deprecated class: "+this.getClass().getSimpleName()+" -- replace with UpdateRequestHandler"); - } - - //////////////////////// SolrInfoMBeans methods ////////////////////// - - @Override - public String getDescription() { - return "Add documents with XML, transforming with XSLT first"; - } -} diff --git a/solr/core/src/java/org/apache/solr/handler/component/HighlightComponent.java b/solr/core/src/java/org/apache/solr/handler/component/HighlightComponent.java index e768fafd16f..334f75a6ff1 100644 --- a/solr/core/src/java/org/apache/solr/handler/component/HighlightComponent.java +++ b/solr/core/src/java/org/apache/solr/handler/component/HighlightComponent.java @@ -92,7 +92,6 @@ public class HighlightComponent extends SearchComponent implements PluginInfoIni PluginInfo pluginInfo = core.getSolrConfig().getPluginInfo(SolrHighlighter.class.getName()); //TODO deprecated configuration remove later if (pluginInfo != null) { highlighter = core.createInitInstance(pluginInfo, SolrHighlighter.class, null, DefaultSolrHighlighter.class.getName()); - highlighter.initalize(core.getSolrConfig()); } else { DefaultSolrHighlighter defHighlighter = new DefaultSolrHighlighter(core); defHighlighter.init(PluginInfo.EMPTY_INFO); diff --git a/solr/core/src/java/org/apache/solr/handler/component/HttpShardHandler.java b/solr/core/src/java/org/apache/solr/handler/component/HttpShardHandler.java index 2e07080e89f..c0ce99d1d5f 100644 --- a/solr/core/src/java/org/apache/solr/handler/component/HttpShardHandler.java +++ b/solr/core/src/java/org/apache/solr/handler/component/HttpShardHandler.java @@ -282,7 +282,6 @@ public class HttpShardHandler extends ShardHandler { clusterState = zkController.getClusterState(); String shardKeys = params.get(ShardParams._ROUTE_); - if(shardKeys == null) shardKeys = params.get(ShardParams.SHARD_KEYS);//eprecated // This will be the complete list of slices we need to query for this request. slices = new HashMap<>(); diff --git a/solr/core/src/java/org/apache/solr/highlight/DefaultSolrHighlighter.java b/solr/core/src/java/org/apache/solr/highlight/DefaultSolrHighlighter.java index 6703b938a06..3d58134ab33 100644 --- a/solr/core/src/java/org/apache/solr/highlight/DefaultSolrHighlighter.java +++ b/solr/core/src/java/org/apache/solr/highlight/DefaultSolrHighlighter.java @@ -16,18 +16,6 @@ */ package org.apache.solr.highlight; -import java.io.IOException; -import java.util.ArrayList; -import java.util.Collections; -import java.util.Comparator; -import java.util.HashMap; -import java.util.HashSet; -import java.util.LinkedList; -import java.util.List; -import java.util.ListIterator; -import java.util.Map; -import java.util.Set; - import org.apache.lucene.analysis.CachingTokenFilter; import org.apache.lucene.analysis.TokenFilter; import org.apache.lucene.analysis.TokenStream; @@ -59,7 +47,6 @@ import org.apache.solr.common.params.SolrParams; import org.apache.solr.common.util.NamedList; import org.apache.solr.common.util.SimpleOrderedMap; import org.apache.solr.core.PluginInfo; -import org.apache.solr.core.SolrConfig; import org.apache.solr.core.SolrCore; import org.apache.solr.request.SolrQueryRequest; import org.apache.solr.schema.IndexSchema; @@ -71,6 +58,18 @@ import org.apache.solr.util.plugin.PluginInfoInitialized; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Collections; +import java.util.Comparator; +import java.util.HashMap; +import java.util.HashSet; +import java.util.LinkedList; +import java.util.List; +import java.util.ListIterator; +import java.util.Map; +import java.util.Set; + /** * * @since solr 1.3 @@ -160,38 +159,7 @@ public class DefaultSolrHighlighter extends SolrHighlighter implements PluginInf if(boundaryScanner == null) boundaryScanner = new SimpleBoundaryScanner(); boundaryScanners.put("", boundaryScanner); boundaryScanners.put(null, boundaryScanner); - - initialized = true; - } - //just for back-compat with the deprecated method - private boolean initialized = false; - @Override - @Deprecated - public void initalize( SolrConfig config) { - if (initialized) return; - SolrFragmenter frag = new GapFragmenter(); - fragmenters.put("", frag); - fragmenters.put(null, frag); - SolrFormatter fmt = new HtmlFormatter(); - formatters.put("", fmt); - formatters.put(null, fmt); - - SolrEncoder enc = new DefaultEncoder(); - encoders.put("", enc); - encoders.put(null, enc); - - SolrFragListBuilder fragListBuilder = new SimpleFragListBuilder(); - fragListBuilders.put( "", fragListBuilder ); - fragListBuilders.put( null, fragListBuilder ); - - SolrFragmentsBuilder fragsBuilder = new ScoreOrderFragmentsBuilder(); - fragmentsBuilders.put( "", fragsBuilder ); - fragmentsBuilders.put( null, fragsBuilder ); - - SolrBoundaryScanner boundaryScanner = new SimpleBoundaryScanner(); - boundaryScanners.put("", boundaryScanner); - boundaryScanners.put(null, boundaryScanner); } /** diff --git a/solr/core/src/java/org/apache/solr/highlight/PostingsSolrHighlighter.java b/solr/core/src/java/org/apache/solr/highlight/PostingsSolrHighlighter.java index 9f4eb72c108..82e75a8fdf7 100644 --- a/solr/core/src/java/org/apache/solr/highlight/PostingsSolrHighlighter.java +++ b/solr/core/src/java/org/apache/solr/highlight/PostingsSolrHighlighter.java @@ -107,9 +107,6 @@ import java.util.Set; * @lucene.experimental */ public class PostingsSolrHighlighter extends SolrHighlighter implements PluginInfoInitialized { - - @Override - public void initalize(SolrConfig config) {} @Override public void init(PluginInfo info) {} diff --git a/solr/core/src/java/org/apache/solr/highlight/SolrHighlighter.java b/solr/core/src/java/org/apache/solr/highlight/SolrHighlighter.java index ac4e3d3a43c..b6f510a3185 100644 --- a/solr/core/src/java/org/apache/solr/highlight/SolrHighlighter.java +++ b/solr/core/src/java/org/apache/solr/highlight/SolrHighlighter.java @@ -16,21 +16,20 @@ package org.apache.solr.highlight; * limitations under the License. */ -import java.io.IOException; -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - import org.apache.lucene.search.Query; import org.apache.solr.common.params.HighlightParams; import org.apache.solr.common.params.SolrParams; import org.apache.solr.common.util.NamedList; -import org.apache.solr.core.SolrConfig; import org.apache.solr.request.SolrQueryRequest; import org.apache.solr.search.DocList; import org.apache.solr.util.SolrPluginUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; public abstract class SolrHighlighter { @@ -38,9 +37,6 @@ public abstract class SolrHighlighter public static int DEFAULT_PHRASE_LIMIT = 5000; public static Logger log = LoggerFactory.getLogger(SolrHighlighter.class); - @Deprecated - public abstract void initalize( SolrConfig config ); - /** * Check whether Highlighting is enabled for this request. * @param params The params controlling Highlighting diff --git a/solr/core/src/java/org/apache/solr/parser/CharStream.java b/solr/core/src/java/org/apache/solr/parser/CharStream.java index d45c19403b2..7536df001f8 100644 --- a/solr/core/src/java/org/apache/solr/parser/CharStream.java +++ b/solr/core/src/java/org/apache/solr/parser/CharStream.java @@ -27,22 +27,6 @@ interface CharStream { */ char readChar() throws java.io.IOException; - @Deprecated - /** - * Returns the column position of the character last read. - * @deprecated - * @see #getEndColumn - */ - int getColumn(); - - @Deprecated - /** - * Returns the line number of the character last read. - * @deprecated - * @see #getEndLine - */ - int getLine(); - /** * Returns the column number of the last character for current token (being * matched after the last call to BeginTOken). diff --git a/solr/core/src/java/org/apache/solr/parser/FastCharStream.java b/solr/core/src/java/org/apache/solr/parser/FastCharStream.java index 91dbf9145d7..2e3b4662099 100644 --- a/solr/core/src/java/org/apache/solr/parser/FastCharStream.java +++ b/solr/core/src/java/org/apache/solr/parser/FastCharStream.java @@ -108,15 +108,6 @@ public final class FastCharStream implements CharStream { } } - @Override - public final int getColumn() { - return bufferStart + bufferPosition; - } - @Override - public final int getLine() { - return 1; - } - @Override public final int getEndColumn() { return bufferStart + bufferPosition; } diff --git a/solr/core/src/java/org/apache/solr/request/SimpleFacets.java b/solr/core/src/java/org/apache/solr/request/SimpleFacets.java index 1273a6d85b4..ae3b3847ca0 100644 --- a/solr/core/src/java/org/apache/solr/request/SimpleFacets.java +++ b/solr/core/src/java/org/apache/solr/request/SimpleFacets.java @@ -17,26 +17,6 @@ package org.apache.solr.request; -import java.io.IOException; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Date; -import java.util.EnumSet; -import java.util.IdentityHashMap; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.concurrent.Callable; -import java.util.concurrent.ExecutionException; -import java.util.concurrent.Executor; -import java.util.concurrent.Future; -import java.util.concurrent.FutureTask; -import java.util.concurrent.RunnableFuture; -import java.util.concurrent.Semaphore; -import java.util.concurrent.SynchronousQueue; -import java.util.concurrent.ThreadPoolExecutor; -import java.util.concurrent.TimeUnit; - import org.apache.lucene.index.DocsEnum; import org.apache.lucene.index.Fields; import org.apache.lucene.index.LeafReader; @@ -95,6 +75,26 @@ import org.apache.solr.util.BoundedTreeSet; import org.apache.solr.util.DateMathParser; import org.apache.solr.util.DefaultSolrThreadFactory; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Date; +import java.util.EnumSet; +import java.util.IdentityHashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.concurrent.Callable; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.Executor; +import java.util.concurrent.Future; +import java.util.concurrent.FutureTask; +import java.util.concurrent.RunnableFuture; +import java.util.concurrent.Semaphore; +import java.util.concurrent.SynchronousQueue; +import java.util.concurrent.ThreadPoolExecutor; +import java.util.concurrent.TimeUnit; + /** * A class that generates simple Facet information for a request. * diff --git a/solr/core/src/java/org/apache/solr/schema/SchemaField.java b/solr/core/src/java/org/apache/solr/schema/SchemaField.java index cca6e51d0a8..e8feaed819a 100644 --- a/solr/core/src/java/org/apache/solr/schema/SchemaField.java +++ b/solr/core/src/java/org/apache/solr/schema/SchemaField.java @@ -96,10 +96,6 @@ public final class SchemaField extends FieldProperties { public boolean storeTermOffsets() { return (properties & STORE_TERMOFFSETS)!=0; } public boolean omitNorms() { return (properties & OMIT_NORMS)!=0; } - /** @deprecated Use {@link #omitTermFreqAndPositions} */ - @Deprecated - public boolean omitTf() { return omitTermFreqAndPositions(); } - public boolean omitTermFreqAndPositions() { return (properties & OMIT_TF_POSITIONS)!=0; } public boolean omitPositions() { return (properties & OMIT_POSITIONS)!=0; } public boolean storeOffsetsWithPositions() { return (properties & STORE_OFFSETS)!=0; } diff --git a/solr/core/src/java/org/apache/solr/search/QueryParsing.java b/solr/core/src/java/org/apache/solr/search/QueryParsing.java index 4fd12c13617..70e0d2e3606 100644 --- a/solr/core/src/java/org/apache/solr/search/QueryParsing.java +++ b/solr/core/src/java/org/apache/solr/search/QueryParsing.java @@ -33,7 +33,6 @@ import org.apache.lucene.search.TermQuery; import org.apache.lucene.search.TermRangeQuery; import org.apache.lucene.search.WildcardQuery; import org.apache.lucene.util.BytesRef; -import org.apache.lucene.util.CharsRef; import org.apache.lucene.util.CharsRefBuilder; import org.apache.solr.common.SolrException; import org.apache.solr.common.params.MapSolrParams; @@ -45,8 +44,8 @@ import org.apache.solr.schema.IndexSchema; import org.apache.solr.schema.SchemaField; import java.io.IOException; -import java.util.Collections; import java.util.ArrayList; +import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Locale; @@ -222,17 +221,6 @@ public class QueryParsing { return new MapSolrParams(localParams); } - /** - * Returns the Sort object represented by the string, or null if default sort - * by score descending should be used. - * @see #parseSortSpec - * @deprecated use {@link #parseSortSpec} - */ - @Deprecated - public static Sort parseSort(String sortSpec, SolrQueryRequest req) { - return parseSortSpec(sortSpec, req).getSort(); - } - /** *

* The form of the sort specification string currently parsed is: diff --git a/solr/core/src/java/org/apache/solr/search/SortSpec.java b/solr/core/src/java/org/apache/solr/search/SortSpec.java index 6655aa67a79..45db657f696 100644 --- a/solr/core/src/java/org/apache/solr/search/SortSpec.java +++ b/solr/core/src/java/org/apache/solr/search/SortSpec.java @@ -19,13 +19,11 @@ package org.apache.solr.search; import org.apache.lucene.search.Sort; import org.apache.lucene.search.SortField; - import org.apache.solr.schema.SchemaField; import java.util.Arrays; -import java.util.List; -import java.util.ArrayList; import java.util.Collections; +import java.util.List; /*** * SortSpec encapsulates a Lucene Sort and a count of the number of documents * to return. @@ -44,28 +42,6 @@ public class SortSpec setSortAndFields(sort, Arrays.asList(fields)); } - /** @deprecated Specify both Sort and SchemaField[] when constructing */ - @Deprecated - public SortSpec(Sort sort, int num) { - this(sort,0,num); - } - - /** @deprecated Specify both Sort and SchemaField[] when constructing */ - @Deprecated - public SortSpec(Sort sort, int offset, int num) { - setSort(sort); - this.offset=offset; - this.num=num; - } - - /** @deprecated use {@link #setSortAndFields} */ - @Deprecated - public void setSort( Sort s ) - { - sort = s; - fields = Collections.unmodifiableList(Arrays.asList(new SchemaField[s.getSort().length])); - } - /** * the specified SchemaFields must correspond one to one with the Sort's SortFields, * using null where appropriate. diff --git a/solr/core/src/java/org/apache/solr/update/SolrIndexConfig.java b/solr/core/src/java/org/apache/solr/update/SolrIndexConfig.java index 4580d92555d..e8c1f33afb5 100644 --- a/solr/core/src/java/org/apache/solr/update/SolrIndexConfig.java +++ b/solr/core/src/java/org/apache/solr/update/SolrIndexConfig.java @@ -23,7 +23,6 @@ import org.apache.lucene.util.InfoStream; import org.apache.lucene.util.Version; import org.apache.solr.common.cloud.ZkNodeProps; import org.apache.solr.common.util.NamedList; -import org.apache.solr.core.Config; import org.apache.solr.core.MapSerializable; import org.apache.solr.core.SolrConfig; import org.apache.solr.core.PluginInfo; @@ -47,14 +46,8 @@ public class SolrIndexConfig implements MapSerializable { final String defaultMergePolicyClassName; public static final String DEFAULT_MERGE_SCHEDULER_CLASSNAME = ConcurrentMergeScheduler.class.getName(); public final Version luceneVersion; - - /** - * The explicit value of <useCompoundFile> specified on this index config - * @deprecated use {@link #getUseCompoundFile} - */ - @Deprecated - public final boolean useCompoundFile; - private boolean effectiveUseCompountFileSetting; + + private boolean effectiveUseCompoundFileSetting; public final int maxBufferedDocs; public final int maxMergeDocs; @@ -84,7 +77,7 @@ public class SolrIndexConfig implements MapSerializable { @SuppressWarnings("deprecation") private SolrIndexConfig(SolrConfig solrConfig) { luceneVersion = solrConfig.luceneMatchVersion; - useCompoundFile = effectiveUseCompountFileSetting = false; + effectiveUseCompoundFileSetting = false; maxBufferedDocs = -1; maxMergeDocs = -1; maxIndexingThreads = IndexWriterConfig.DEFAULT_MAX_THREAD_STATES; @@ -134,8 +127,7 @@ public class SolrIndexConfig implements MapSerializable { true); defaultMergePolicyClassName = def.defaultMergePolicyClassName; - useCompoundFile=solrConfig.getBool(prefix+"/useCompoundFile", def.useCompoundFile); - effectiveUseCompountFileSetting = useCompoundFile; + effectiveUseCompoundFileSetting = solrConfig.getBool(prefix+"/useCompoundFile", def.getUseCompoundFile()); maxBufferedDocs=solrConfig.getInt(prefix+"/maxBufferedDocs",def.maxBufferedDocs); maxMergeDocs=solrConfig.getInt(prefix+"/maxMergeDocs",def.maxMergeDocs); maxIndexingThreads=solrConfig.getInt(prefix+"/maxIndexingThreads",def.maxIndexingThreads); @@ -306,7 +298,7 @@ public class SolrIndexConfig implements MapSerializable { } public boolean getUseCompoundFile() { - return effectiveUseCompountFileSetting; + return effectiveUseCompoundFileSetting; } /** @@ -330,7 +322,7 @@ public class SolrIndexConfig implements MapSerializable { if (useCFSArg instanceof Boolean) { boolean cfs = ((Boolean)useCFSArg).booleanValue(); log.warn("Please update your config to specify "+cfs+" directly in your settings."); - effectiveUseCompountFileSetting = cfs; + effectiveUseCompoundFileSetting = cfs; } else { log.error("MergePolicy's 'useCompoundFile' init arg is not a boolean, can not apply back compat logic to apply to the IndexWriterConfig: " + useCFSArg.toString()); } diff --git a/solr/core/src/java/org/apache/solr/update/processor/DistributedUpdateProcessor.java b/solr/core/src/java/org/apache/solr/update/processor/DistributedUpdateProcessor.java index 5b156613c1a..4e6d4a50b2f 100644 --- a/solr/core/src/java/org/apache/solr/update/processor/DistributedUpdateProcessor.java +++ b/solr/core/src/java/org/apache/solr/update/processor/DistributedUpdateProcessor.java @@ -17,24 +17,6 @@ package org.apache.solr.update.processor; * limitations under the License. */ -import static org.apache.solr.update.processor.DistributingUpdateProcessorFactory.DISTRIB_UPDATE_PARAM; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.Collections; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.Set; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.TimeUnit; -import java.util.concurrent.atomic.AtomicInteger; -import java.util.concurrent.locks.ReentrantLock; - import org.apache.lucene.util.BytesRef; import org.apache.lucene.util.CharsRefBuilder; import org.apache.solr.client.solrj.request.UpdateRequest; @@ -91,6 +73,24 @@ import org.apache.zookeeper.KeeperException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicInteger; +import java.util.concurrent.locks.ReentrantLock; + +import static org.apache.solr.update.processor.DistributingUpdateProcessorFactory.DISTRIB_UPDATE_PARAM; + // NOT mt-safe... create a new processor for each add thread // TODO: we really should not wait for distrib after local? unless a certain replication factor is asked for public class DistributedUpdateProcessor extends UpdateRequestProcessor { @@ -1254,7 +1254,6 @@ public class DistributedUpdateProcessor extends UpdateRequestProcessor { SolrParams params = req.getParams(); String route = params.get(ShardParams._ROUTE_); - if(route == null) route = params.get(ShardParams.SHARD_KEYS);// deprecated . kept for backcompat Collection slices = coll.getRouter().getSearchSlices(route, params, coll); List leaders = new ArrayList<>(slices.size()); diff --git a/solr/core/src/java/org/apache/solr/util/plugin/ResourceLoaderAware.java b/solr/core/src/java/org/apache/solr/util/plugin/ResourceLoaderAware.java deleted file mode 100644 index 89c36742997..00000000000 --- a/solr/core/src/java/org/apache/solr/util/plugin/ResourceLoaderAware.java +++ /dev/null @@ -1,26 +0,0 @@ -package org.apache.solr.util.plugin; - -/* - * 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. - */ - -/** - * @deprecated This interface has been kept for backwards compatibility and will - * be removed in (5.0). Use {@link org.apache.lucene.analysis.util.ResourceLoaderAware}. - */ -@Deprecated -public interface ResourceLoaderAware extends org.apache.lucene.analysis.util.ResourceLoaderAware { -} diff --git a/solr/core/src/test/org/apache/solr/analysis/LegacyHTMLStripCharFilterTest.java b/solr/core/src/test/org/apache/solr/analysis/LegacyHTMLStripCharFilterTest.java deleted file mode 100644 index 58158d9a15c..00000000000 --- a/solr/core/src/test/org/apache/solr/analysis/LegacyHTMLStripCharFilterTest.java +++ /dev/null @@ -1,321 +0,0 @@ -package org.apache.solr.analysis; - -/* - * 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. - */ - -import java.io.BufferedReader; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.io.Reader; -import java.io.StringReader; -import java.nio.charset.StandardCharsets; -import java.util.HashSet; -import java.util.Set; - -import org.apache.lucene.analysis.Analyzer; -import org.apache.lucene.analysis.BaseTokenStreamTestCase; -import org.apache.lucene.analysis.MockTokenizer; -import org.apache.lucene.analysis.Tokenizer; -import org.apache.lucene.util.TestUtil; -import org.junit.Ignore; - -public class LegacyHTMLStripCharFilterTest extends BaseTokenStreamTestCase { - - //this is some text here is a link and another link . This is an entity: & plus a <. Here is an & - // - public void test() throws IOException { - String html = "

this is some text
here is a link and " + - "another link. " + - "This is an entity: & plus a <. Here is an &. "; - String gold = " this is some text here is a link and " + - "another link . " + - "This is an entity: & plus a <. Here is an &. "; - LegacyHTMLStripCharFilter reader = new LegacyHTMLStripCharFilter(new StringReader(html)); - StringBuilder builder = new StringBuilder(); - int ch = -1; - char [] goldArray = gold.toCharArray(); - int position = 0; - while ((ch = reader.read()) != -1){ - char theChar = (char) ch; - builder.append(theChar); - assertTrue("\"" + theChar + "\"" + " at position: " + position + " does not equal: " + goldArray[position] - + " Buffer so far: " + builder + "", theChar == goldArray[position]); - position++; - } - assertEquals(gold, builder.toString()); - } - - //Some sanity checks, but not a full-fledged check - public void testHTML() throws Exception { - InputStream stream = getClass().getResourceAsStream("htmlStripReaderTest.html"); - LegacyHTMLStripCharFilter reader = new LegacyHTMLStripCharFilter(new InputStreamReader(stream, StandardCharsets.UTF_8)); - StringBuilder builder = new StringBuilder(); - int ch = -1; - while ((ch = reader.read()) != -1){ - builder.append((char)ch); - } - String str = builder.toString(); - assertTrue("Entity not properly escaped", str.indexOf("<") == -1);//there is one > in the text - assertTrue("Forrest should have been stripped out", str.indexOf("forrest") == -1 && str.indexOf("Forrest") == -1); - assertTrue("File should start with 'Welcome to Solr' after trimming", str.trim().startsWith("Welcome to Solr")); - - assertTrue("File should start with 'Foundation.' after trimming", str.trim().endsWith("Foundation.")); - - } - - public void testGamma() throws Exception { - String test = "Γ"; - String gold = "\u0393"; - Set set = new HashSet<>(); - set.add("reserved"); - Reader reader = new LegacyHTMLStripCharFilter(new StringReader(test), set); - StringBuilder builder = new StringBuilder(); - int ch = 0; - while ((ch = reader.read()) != -1){ - builder.append((char)ch); - } - String result = builder.toString(); - // System.out.println("Resu: " + result + ""); - // System.out.println("Gold: " + gold + ""); - assertTrue(result + " is not equal to " + gold + "", result.equals(gold) == true); - } - - public void testEntities() throws Exception { - String test = "  <foo> Übermensch = Γ bar Γ"; - String gold = " \u00DCbermensch = \u0393 bar \u0393"; - Set set = new HashSet<>(); - set.add("reserved"); - Reader reader = new LegacyHTMLStripCharFilter(new StringReader(test), set); - StringBuilder builder = new StringBuilder(); - int ch = 0; - while ((ch = reader.read()) != -1){ - builder.append((char)ch); - } - String result = builder.toString(); - // System.out.println("Resu: " + result + ""); - // System.out.println("Gold: " + gold + ""); - assertTrue(result + " is not equal to " + gold + "", result.equals(gold) == true); - } - - public void testMoreEntities() throws Exception { - String test = "  <junk/>   ! @ and ’"; - String gold = " ! @ and ’"; - Set set = new HashSet<>(); - set.add("reserved"); - Reader reader = new LegacyHTMLStripCharFilter(new StringReader(test), set); - StringBuilder builder = new StringBuilder(); - int ch = 0; - while ((ch = reader.read()) != -1){ - builder.append((char)ch); - } - String result = builder.toString(); - // System.out.println("Resu: " + result + ""); - // System.out.println("Gold: " + gold + ""); - assertTrue(result + " is not equal to " + gold, result.equals(gold) == true); - } - - public void testReserved() throws Exception { - String test = "aaa bbb eeee ffff "; - Set set = new HashSet<>(); - set.add("reserved"); - Reader reader = new LegacyHTMLStripCharFilter(new StringReader(test), set); - StringBuilder builder = new StringBuilder(); - int ch = 0; - while ((ch = reader.read()) != -1){ - builder.append((char)ch); - } - String result = builder.toString(); - // System.out.println("Result: " + result); - assertTrue("Escaped tag not preserved: " + result.indexOf("reserved"), result.indexOf("reserved") == 9); - assertTrue("Escaped tag not preserved: " + result.indexOf("reserved", 15), result.indexOf("reserved", 15) == 38); - assertTrue("Escaped tag not preserved: " + result.indexOf("reserved", 41), result.indexOf("reserved", 41) == 54); - assertTrue("Other tag should be removed", result.indexOf("other") == -1); - } - - public void testMalformedHTML() throws Exception { - String test = "a > "; - String gold = "a "); - // System.out.println("Gold: " + gold + ""); - assertTrue(result + " is not equal to " + gold + "", result.equals(gold) == true); - } - - public void testBufferOverflow() throws Exception { - StringBuilder testBuilder = new StringBuilder(LegacyHTMLStripCharFilter.DEFAULT_READ_AHEAD + 50); - testBuilder.append("ah ??????"); - appendChars(testBuilder, LegacyHTMLStripCharFilter.DEFAULT_READ_AHEAD + 500); - processBuffer(testBuilder.toString(), "Failed on pseudo proc. instr.");//processing instructions - - testBuilder.setLength(0); - testBuilder.append("foo"); - processBuffer(testBuilder.toString(), "Failed w/ comment"); - - testBuilder.setLength(0); - testBuilder.append(""); - processBuffer(testBuilder.toString(), "Failed with proc. instr."); - - testBuilder.setLength(0); - testBuilder.append(""); - processBuffer(testBuilder.toString(), "Failed on tag"); - - } - - private void appendChars(StringBuilder testBuilder, int numChars) { - int i1 = numChars / 2; - for (int i = 0; i < i1; i++){ - testBuilder.append('a').append(' ');//tack on enough to go beyond the mark readahead limit, since makes LegacyHTMLStripCharFilter think it is a processing instruction - } - } - - - private void processBuffer(String test, String assertMsg) throws IOException { - // System.out.println("-------------------processBuffer----------"); - Reader reader = new LegacyHTMLStripCharFilter(new BufferedReader(new StringReader(test)));//force the use of BufferedReader - int ch = 0; - StringBuilder builder = new StringBuilder(); - try { - while ((ch = reader.read()) != -1){ - builder.append((char)ch); - } - } finally { - // System.out.println("String (trimmed): " + builder.toString().trim() + ""); - } - assertTrue(assertMsg + "::: " + builder.toString() + " is not equal to " + test, builder.toString().equals(test) == true); - } - - public void testComment() throws Exception { - - String test = " "; - String gold = " "; - Reader reader = new LegacyHTMLStripCharFilter(new BufferedReader(new StringReader(test)));//force the use of BufferedReader - int ch = 0; - StringBuilder builder = new StringBuilder(); - try { - while ((ch = reader.read()) != -1){ - builder.append((char)ch); - } - } finally { - // System.out.println("String: " + builder.toString()); - } - assertTrue(builder.toString() + " is not equal to " + gold + "", builder.toString().equals(gold) == true); - } - - - public void doTestOffsets(String in) throws Exception { - LegacyHTMLStripCharFilter reader = new LegacyHTMLStripCharFilter(new BufferedReader(new StringReader(in))); - int ch = 0; - int off = 0; // offset in the reader - int strOff = -1; // offset in the original string - while ((ch = reader.read()) != -1) { - int correctedOff = reader.correctOffset(off); - - if (ch == 'X') { - strOff = in.indexOf('X',strOff+1); - assertEquals(strOff, correctedOff); - } - - off++; - } - } - - public void testOffsets() throws Exception { - doTestOffsets("hello X how X are you"); - doTestOffsets("hello

X

how

X are you"); - doTestOffsets("X & X ( X < > X"); - - // test backtracking - doTestOffsets("X < &zz >X &# < X > < &l > &g < X"); - } - - @Ignore("broken offsets: see LUCENE-2208") - public void testRandom() throws Exception { - Analyzer analyzer = new Analyzer() { - - @Override - protected TokenStreamComponents createComponents(String fieldName) { - Tokenizer tokenizer = new MockTokenizer(MockTokenizer.WHITESPACE, false); - return new TokenStreamComponents(tokenizer, tokenizer); - } - - @Override - protected Reader initReader(String fieldName, Reader reader) { - return new LegacyHTMLStripCharFilter(new BufferedReader(reader)); - } - }; - - int numRounds = RANDOM_MULTIPLIER * 10000; - checkRandomData(random(), analyzer, numRounds); - } - - public void testRandomBrokenHTML() throws Exception { - int maxNumElements = 10000; - String text = TestUtil.randomHtmlishString(random(), maxNumElements); - Reader reader - = new LegacyHTMLStripCharFilter(new StringReader(text)); - while (reader.read() != -1); - } - - public void testRandomText() throws Exception { - StringBuilder text = new StringBuilder(); - int minNumWords = 10; - int maxNumWords = 10000; - int minWordLength = 3; - int maxWordLength = 20; - int numWords = TestUtil.nextInt(random(), minNumWords, maxNumWords); - switch (TestUtil.nextInt(random(), 0, 4)) { - case 0: { - for (int wordNum = 0 ; wordNum < numWords ; ++wordNum) { - text.append(TestUtil.randomUnicodeString(random(), maxWordLength)); - text.append(' '); - } - break; - } - case 1: { - for (int wordNum = 0 ; wordNum < numWords ; ++wordNum) { - text.append(TestUtil.randomRealisticUnicodeString - (random(), minWordLength, maxWordLength)); - text.append(' '); - } - break; - } - default: { // ASCII 50% of the time - for (int wordNum = 0 ; wordNum < numWords ; ++wordNum) { - text.append(TestUtil.randomSimpleString(random())); - text.append(' '); - } - } - } - Reader reader = new LegacyHTMLStripCharFilter - (new StringReader(text.toString())); - while (reader.read() != -1); - } -} diff --git a/solr/core/src/test/org/apache/solr/cloud/ShardRoutingTest.java b/solr/core/src/test/org/apache/solr/cloud/ShardRoutingTest.java index a883f991c40..0171c3a6fb2 100644 --- a/solr/core/src/test/org/apache/solr/cloud/ShardRoutingTest.java +++ b/solr/core/src/test/org/apache/solr/cloud/ShardRoutingTest.java @@ -17,32 +17,15 @@ package org.apache.solr.cloud; * limitations under the License. */ -import org.apache.solr.client.solrj.SolrQuery; import org.apache.solr.client.solrj.SolrClient; -import org.apache.solr.client.solrj.SolrServerException; import org.apache.solr.client.solrj.embedded.JettySolrRunner; -import org.apache.solr.client.solrj.impl.CloudSolrClient; import org.apache.solr.client.solrj.request.UpdateRequest; import org.apache.solr.client.solrj.response.QueryResponse; -import org.apache.solr.common.SolrDocument; -import org.apache.solr.common.SolrException; -import org.apache.solr.common.SolrInputDocument; -import org.apache.solr.common.cloud.CompositeIdRouter; -import org.apache.solr.common.cloud.ZkNodeProps; -import org.apache.solr.common.cloud.ZkStateReader; -import org.apache.solr.common.params.CommonParams; -import org.apache.solr.common.params.ModifiableSolrParams; import org.apache.solr.common.params.ShardParams; -import org.apache.solr.common.util.StrUtils; -import org.apache.solr.servlet.SolrDispatchFilter; -import org.apache.solr.update.DirectUpdateHandler2; import org.junit.BeforeClass; -import org.junit.Ignore; -import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Set; public class ShardRoutingTest extends AbstractFullDistribZkTestBase { @@ -137,7 +120,7 @@ public class ShardRoutingTest extends AbstractFullDistribZkTestBase { private void doHashingTest() throws Exception { log.info("### STARTING doHashingTest"); assertEquals(4, cloudClient.getZkStateReader().getClusterState().getCollection(DEFAULT_COLLECTION).getSlices().size()); - String shardKeys = ShardParams.SHARD_KEYS; + String shardKeys = ShardParams._ROUTE_; // for now, we know how ranges will be distributed to shards. // may have to look it up in clusterstate if that assumption changes. @@ -282,12 +265,12 @@ public class ShardRoutingTest extends AbstractFullDistribZkTestBase { assertEquals(1, nEnd - nStart); // short circuit should prevent distrib search nStart = getNumRequests(); - replica.client.solrClient.query( params("q","*:*", "shard.keys","b!") ); + replica.client.solrClient.query( params("q","*:*", ShardParams._ROUTE_, "b!") ); nEnd = getNumRequests(); assertEquals(1, nEnd - nStart); // short circuit should prevent distrib search nStart = getNumRequests(); - leader2.client.solrClient.query( params("q","*:*", "shard.keys","b!") ); + leader2.client.solrClient.query( params("q","*:*", ShardParams._ROUTE_, "b!") ); nEnd = getNumRequests(); assertEquals(3, nEnd - nStart); // original + 2 phase distrib search. we could improve this! @@ -297,12 +280,12 @@ public class ShardRoutingTest extends AbstractFullDistribZkTestBase { assertEquals(9, nEnd - nStart); // original + 2 phase distrib search * 4 shards. nStart = getNumRequests(); - leader2.client.solrClient.query( params("q","*:*", "shard.keys","b!,d!") ); + leader2.client.solrClient.query( params("q","*:*", ShardParams._ROUTE_, "b!,d!") ); nEnd = getNumRequests(); assertEquals(5, nEnd - nStart); // original + 2 phase distrib search * 2 shards. nStart = getNumRequests(); - leader2.client.solrClient.query( params("q","*:*", "shard.keys","b!,f1!f2!") ); + leader2.client.solrClient.query( params("q","*:*", ShardParams._ROUTE_, "b!,f1!f2!") ); nEnd = getNumRequests(); assertEquals(5, nEnd - nStart); } diff --git a/solr/core/src/test/org/apache/solr/core/TestConfig.java b/solr/core/src/test/org/apache/solr/core/TestConfig.java index 023ab5a42b8..41d83d31b93 100644 --- a/solr/core/src/test/org/apache/solr/core/TestConfig.java +++ b/solr/core/src/test/org/apache/solr/core/TestConfig.java @@ -17,17 +17,14 @@ package org.apache.solr.core; -import org.apache.lucene.index.IndexWriter; +import org.apache.lucene.index.ConcurrentMergeScheduler; import org.apache.lucene.index.IndexWriterConfig; import org.apache.lucene.index.TieredMergePolicy; -import org.apache.lucene.index.ConcurrentMergeScheduler; import org.apache.solr.SolrTestCaseJ4; import org.apache.solr.handler.admin.ShowFileRequestHandler; -import org.apache.solr.update.DirectUpdateHandler2; -import org.apache.solr.update.SolrIndexConfig; -import org.apache.solr.util.RefCounted; import org.apache.solr.schema.IndexSchema; import org.apache.solr.schema.IndexSchemaFactory; +import org.apache.solr.update.SolrIndexConfig; import org.junit.BeforeClass; import org.junit.Test; import org.w3c.dom.Node; @@ -36,7 +33,6 @@ import org.w3c.dom.NodeList; import javax.xml.xpath.XPathConstants; import java.io.IOException; import java.io.InputStream; -import java.util.Locale; public class TestConfig extends SolrTestCaseJ4 { @@ -117,7 +113,7 @@ public class TestConfig extends SolrTestCaseJ4 { SolrIndexConfig sic = sc.indexConfig; assertEquals("default ramBufferSizeMB", 100.0D, sic.ramBufferSizeMB, 0.0D); assertEquals("default LockType", SolrIndexConfig.LOCK_TYPE_NATIVE, sic.lockType); - assertEquals("default useCompoundFile", false, sic.useCompoundFile); + assertEquals("default useCompoundFile", false, sic.getUseCompoundFile()); IndexSchema indexSchema = IndexSchemaFactory.buildIndexSchema("schema.xml", solrConfig); IndexWriterConfig iwc = sic.toIndexWriterConfig(indexSchema); @@ -140,7 +136,7 @@ public class TestConfig extends SolrTestCaseJ4 { Double.parseDouble(System.getProperty("solr.tests.ramBufferSizeMB")), sic.ramBufferSizeMB, 0.0D); assertEquals("useCompoundFile sysprop", - Boolean.parseBoolean(System.getProperty("useCompoundFile")), sic.useCompoundFile); + Boolean.parseBoolean(System.getProperty("useCompoundFile")), sic.getUseCompoundFile()); } } diff --git a/solr/core/src/test/org/apache/solr/highlight/DummyHighlighter.java b/solr/core/src/test/org/apache/solr/highlight/DummyHighlighter.java index 0d660b40ecd..3836a12b86a 100644 --- a/solr/core/src/test/org/apache/solr/highlight/DummyHighlighter.java +++ b/solr/core/src/test/org/apache/solr/highlight/DummyHighlighter.java @@ -16,15 +16,14 @@ */ package org.apache.solr.highlight; -import java.io.IOException; - import org.apache.lucene.search.Query; import org.apache.solr.common.util.NamedList; import org.apache.solr.common.util.SimpleOrderedMap; -import org.apache.solr.core.SolrConfig; import org.apache.solr.request.SolrQueryRequest; import org.apache.solr.search.DocList; +import java.io.IOException; + public class DummyHighlighter extends SolrHighlighter { @Override @@ -35,9 +34,4 @@ public class DummyHighlighter extends SolrHighlighter { return fragments; } - @Override - public void initalize(SolrConfig config) { - // do nothing - } - } 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 482c02e79ea..e63066f7361 100644 --- a/solr/core/src/test/org/apache/solr/search/QueryParsingTest.java +++ b/solr/core/src/test/org/apache/solr/search/QueryParsingTest.java @@ -20,10 +20,9 @@ import org.apache.lucene.search.Query; import org.apache.lucene.search.Sort; import org.apache.lucene.search.SortField; import org.apache.solr.SolrTestCaseJ4; -import org.apache.solr.schema.SchemaField; -import org.apache.solr.search.SortSpec; import org.apache.solr.common.SolrException; import org.apache.solr.request.SolrQueryRequest; +import org.apache.solr.schema.SchemaField; import org.junit.BeforeClass; import org.junit.Test; @@ -79,7 +78,7 @@ public class QueryParsingTest extends SolrTestCaseJ4 { SortSpec spec; SolrQueryRequest req = req(); - sort = QueryParsing.parseSort("score desc", req); + sort = QueryParsing.parseSortSpec("score desc", req).getSort(); assertNull("sort", sort);//only 1 thing in the list, no Sort specified spec = QueryParsing.parseSortSpec("score desc", req); @@ -89,7 +88,7 @@ public class QueryParsingTest extends SolrTestCaseJ4 { assertEquals(0, spec.getSchemaFields().size()); // SOLR-4458 - using different case variations of asc and desc - sort = QueryParsing.parseSort("score aSc", req); + sort = QueryParsing.parseSortSpec("score aSc", req).getSort(); SortField[] flds = sort.getSort(); assertEquals(flds[0].getType(), SortField.Type.SCORE); assertTrue(flds[0].getReverse()); @@ -102,7 +101,7 @@ public class QueryParsingTest extends SolrTestCaseJ4 { assertEquals(1, spec.getSchemaFields().size()); assertNull(spec.getSchemaFields().get(0)); - sort = QueryParsing.parseSort("weight dEsC", req); + sort = QueryParsing.parseSortSpec("weight dEsC", req).getSort(); flds = sort.getSort(); assertEquals(flds[0].getType(), SortField.Type.FLOAT); assertEquals(flds[0].getField(), "weight"); @@ -118,7 +117,7 @@ public class QueryParsingTest extends SolrTestCaseJ4 { assertNotNull(spec.getSchemaFields().get(0)); assertEquals("weight", spec.getSchemaFields().get(0).getName()); - sort = QueryParsing.parseSort("weight desc,bday ASC", req); + sort = QueryParsing.parseSortSpec("weight desc,bday ASC", req).getSort(); flds = sort.getSort(); assertEquals(flds[0].getType(), SortField.Type.FLOAT); assertEquals(flds[0].getField(), "weight"); @@ -127,7 +126,7 @@ public class QueryParsingTest extends SolrTestCaseJ4 { assertEquals(flds[1].getField(), "bday"); assertEquals(flds[1].getReverse(), false); //order aliases - sort = QueryParsing.parseSort("weight top,bday asc", req); + sort = QueryParsing.parseSortSpec("weight top,bday asc", req).getSort(); flds = sort.getSort(); assertEquals(flds[0].getType(), SortField.Type.FLOAT); assertEquals(flds[0].getField(), "weight"); @@ -135,7 +134,7 @@ public class QueryParsingTest extends SolrTestCaseJ4 { assertEquals(flds[1].getType(), SortField.Type.LONG); assertEquals(flds[1].getField(), "bday"); assertEquals(flds[1].getReverse(), false); - sort = QueryParsing.parseSort("weight top,bday bottom", req); + sort = QueryParsing.parseSortSpec("weight top,bday bottom", req).getSort(); flds = sort.getSort(); assertEquals(flds[0].getType(), SortField.Type.FLOAT); assertEquals(flds[0].getField(), "weight"); @@ -145,20 +144,20 @@ public class QueryParsingTest extends SolrTestCaseJ4 { assertEquals(flds[1].getReverse(), false); //test weird spacing - sort = QueryParsing.parseSort("weight DESC, bday asc", req); + sort = QueryParsing.parseSortSpec("weight DESC, bday asc", req).getSort(); flds = sort.getSort(); assertEquals(flds[0].getType(), SortField.Type.FLOAT); assertEquals(flds[0].getField(), "weight"); assertEquals(flds[1].getField(), "bday"); assertEquals(flds[1].getType(), SortField.Type.LONG); //handles trailing commas - sort = QueryParsing.parseSort("weight desc,", req); + sort = QueryParsing.parseSortSpec("weight desc,", req).getSort(); flds = sort.getSort(); assertEquals(flds[0].getType(), SortField.Type.FLOAT); assertEquals(flds[0].getField(), "weight"); //test functions - sort = QueryParsing.parseSort("pow(weight, 2) desc", req); + sort = QueryParsing.parseSortSpec("pow(weight, 2) desc", req).getSort(); flds = sort.getSort(); assertEquals(flds[0].getType(), SortField.Type.REWRITEABLE); //Not thrilled about the fragility of string matching here, but... @@ -166,12 +165,12 @@ public class QueryParsingTest extends SolrTestCaseJ4 { assertEquals(flds[0].getField(), "pow(float(weight),const(2))"); //test functions (more deep) - sort = QueryParsing.parseSort("sum(product(r_f1,sum(d_f1,t_f1,1.0)),a_f1) asc", req); + sort = QueryParsing.parseSortSpec("sum(product(r_f1,sum(d_f1,t_f1,1.0)),a_f1) asc", req).getSort(); flds = sort.getSort(); assertEquals(flds[0].getType(), SortField.Type.REWRITEABLE); assertEquals(flds[0].getField(), "sum(product(float(r_f1),sum(float(d_f1),float(t_f1),const(1.0))),float(a_f1))"); - sort = QueryParsing.parseSort("pow(weight, 2.0) desc", req); + sort = QueryParsing.parseSortSpec("pow(weight, 2.0) desc", req).getSort(); flds = sort.getSort(); assertEquals(flds[0].getType(), SortField.Type.REWRITEABLE); //Not thrilled about the fragility of string matching here, but... @@ -202,19 +201,19 @@ public class QueryParsingTest extends SolrTestCaseJ4 { assertEquals("bday", schemaFlds.get(2).getName()); //handles trailing commas - sort = QueryParsing.parseSort("weight desc,", req); + sort = QueryParsing.parseSortSpec("weight desc,", req).getSort(); flds = sort.getSort(); assertEquals(flds[0].getType(), SortField.Type.FLOAT); assertEquals(flds[0].getField(), "weight"); //Test literals in functions - sort = QueryParsing.parseSort("strdist(foo_s1, \"junk\", jw) desc", req); + sort = QueryParsing.parseSortSpec("strdist(foo_s1, \"junk\", jw) desc", req).getSort(); flds = sort.getSort(); assertEquals(flds[0].getType(), SortField.Type.REWRITEABLE); //the value sources get wrapped, so the out field is different than the input assertEquals(flds[0].getField(), "strdist(str(foo_s1),literal(junk), dist=org.apache.lucene.search.spell.JaroWinklerDistance)"); - sort = QueryParsing.parseSort("", req); + sort = QueryParsing.parseSortSpec("", req).getSort(); assertNull(sort); spec = QueryParsing.parseSortSpec("", req); @@ -231,40 +230,40 @@ public class QueryParsingTest extends SolrTestCaseJ4 { //test some bad vals try { - sort = QueryParsing.parseSort("weight, desc", req); + sort = QueryParsing.parseSortSpec("weight, desc", req).getSort(); assertTrue(false); } catch (SolrException e) { //expected } try { - sort = QueryParsing.parseSort("w", req); + sort = QueryParsing.parseSortSpec("w", req).getSort(); assertTrue(false); } catch (SolrException e) { //expected } try { - sort = QueryParsing.parseSort("weight desc, bday", req); + sort = QueryParsing.parseSortSpec("weight desc, bday", req).getSort(); assertTrue(false); } catch (SolrException e) { } try { //bad number of commas - sort = QueryParsing.parseSort("pow(weight,,2) desc, bday asc", req); + sort = QueryParsing.parseSortSpec("pow(weight,,2) desc, bday asc", req).getSort(); assertTrue(false); } catch (SolrException e) { } try { //bad function - sort = QueryParsing.parseSort("pow() desc, bday asc", req); + sort = QueryParsing.parseSortSpec("pow() desc, bday asc", req).getSort(); assertTrue(false); } catch (SolrException e) { } try { //bad number of parens - sort = QueryParsing.parseSort("pow((weight,2) desc, bday asc", req); + sort = QueryParsing.parseSortSpec("pow((weight,2) desc, bday asc", req).getSort(); assertTrue(false); } catch (SolrException e) { } diff --git a/solr/core/src/test/org/apache/solr/update/processor/SignatureUpdateProcessorFactoryTest.java b/solr/core/src/test/org/apache/solr/update/processor/SignatureUpdateProcessorFactoryTest.java index dde06e4145b..e941412a8ee 100644 --- a/solr/core/src/test/org/apache/solr/update/processor/SignatureUpdateProcessorFactoryTest.java +++ b/solr/core/src/test/org/apache/solr/update/processor/SignatureUpdateProcessorFactoryTest.java @@ -17,12 +17,7 @@ package org.apache.solr.update.processor; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Map; - import org.apache.lucene.util.Constants; - import org.apache.solr.SolrTestCaseJ4; import org.apache.solr.client.solrj.impl.BinaryRequestWriter; import org.apache.solr.client.solrj.request.UpdateRequest; @@ -30,20 +25,23 @@ import org.apache.solr.common.SolrInputDocument; import org.apache.solr.common.params.MultiMapSolrParams; import org.apache.solr.common.params.SolrParams; import org.apache.solr.common.params.UpdateParams; -import org.apache.solr.common.util.NamedList; import org.apache.solr.common.util.ContentStream; import org.apache.solr.common.util.ContentStreamBase; +import org.apache.solr.common.util.NamedList; import org.apache.solr.core.SolrCore; -import org.apache.solr.handler.BinaryUpdateRequestHandler; import org.apache.solr.handler.UpdateRequestHandler; +import org.apache.solr.request.LocalSolrQueryRequest; import org.apache.solr.request.SolrQueryRequest; import org.apache.solr.request.SolrQueryRequestBase; -import org.apache.solr.request.LocalSolrQueryRequest; import org.apache.solr.response.SolrQueryResponse; import org.junit.Before; import org.junit.BeforeClass; import org.junit.Test; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Map; + /** * */ diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/SolrQuery.java b/solr/solrj/src/java/org/apache/solr/client/solrj/SolrQuery.java index 50fc1fe76ab..80eb623a79c 100644 --- a/solr/solrj/src/java/org/apache/solr/client/solrj/SolrQuery.java +++ b/solr/solrj/src/java/org/apache/solr/client/solrj/SolrQuery.java @@ -17,13 +17,6 @@ package org.apache.solr.client.solrj; -import java.util.ArrayList; -import java.util.Collections; -import java.util.Date; -import java.util.List; -import java.util.Locale; -import java.util.regex.Pattern; - import org.apache.solr.common.params.CommonParams; import org.apache.solr.common.params.FacetParams; import org.apache.solr.common.params.HighlightParams; @@ -32,6 +25,13 @@ import org.apache.solr.common.params.StatsParams; import org.apache.solr.common.params.TermsParams; import org.apache.solr.common.util.DateUtil; +import java.util.ArrayList; +import java.util.Collections; +import java.util.Date; +import java.util.List; +import java.util.Locale; +import java.util.regex.Pattern; + /** * This is an augmented SolrParams with get/set/add fields for common fields used @@ -443,14 +443,6 @@ public class SolrQuery extends ModifiableSolrParams return this; } - /** - * @deprecated use {@link #setFacetMissing(Boolean)} - */ - @Deprecated - public SolrQuery setMissing(String fld) { - return setFacetMissing(Boolean.valueOf(fld)); - } - /** get facet sort * * @return facet sort or default of {@link FacetParams#FACET_SORT_COUNT} @@ -459,18 +451,6 @@ public class SolrQuery extends ModifiableSolrParams return this.get(FacetParams.FACET_SORT, FacetParams.FACET_SORT_COUNT); } - /** get facet sort - * - * @return facet sort or default of true.
- * true corresponds to - * {@link FacetParams#FACET_SORT_COUNT} and
false to {@link FacetParams#FACET_SORT_INDEX} - * - * @deprecated Use {@link #getFacetSortString()} instead. - */ - @Deprecated - public boolean getFacetSort() { - return this.get(FacetParams.FACET_SORT, FacetParams.FACET_SORT_COUNT).equals(FacetParams.FACET_SORT_COUNT); - } /** set facet sort * @@ -482,19 +462,6 @@ public class SolrQuery extends ModifiableSolrParams return this; } - /** set facet sort - * - * @param sort sort facets - * @return this - * @deprecated Use {@link #setFacetSort(String)} instead, true corresponds to - * {@link FacetParams#FACET_SORT_COUNT} and false to {@link FacetParams#FACET_SORT_INDEX}. - */ - @Deprecated - public SolrQuery setFacetSort(boolean sort) { - this.set(FacetParams.FACET_SORT, sort == true ? FacetParams.FACET_SORT_COUNT : FacetParams.FACET_SORT_INDEX); - return this; - } - /** add highlight field * * @param f field to enable for highlighting @@ -571,57 +538,6 @@ public class SolrQuery extends ModifiableSolrParams return this.get(HighlightParams.SIMPLE_POST, ""); } - /** - * Replaces the sort string with a single sort field. - * @deprecated Use {@link #setSort(SortClause)} instead, which is part - * of an api handling a wider range of sort specifications. - */ - @Deprecated - public SolrQuery setSortField(String field, ORDER order) { - this.remove(CommonParams.SORT); - addValueToParam(CommonParams.SORT, toSortString(field, order)); - return this; - } - - /** - * Adds a sort field to the end of the sort string. - * @deprecated Use {@link #addSort(SortClause)} instead, which is part - * of an api handling a wider range of sort specifications. - */ - @Deprecated - public SolrQuery addSortField(String field, ORDER order) { - return addValueToParam(CommonParams.SORT, toSortString(field, order)); - } - - /** - * Removes a sort field to the end of the sort string. - * @deprecated Use {@link #removeSort(SortClause)} instead, which is part - * of an api handling a wider range of sort specifications. - */ - @Deprecated - public SolrQuery removeSortField(String field, ORDER order) { - String[] sorts = getSortFields(); - if (sorts != null) { - String removeSort = toSortString(field, order); - String s = join(sorts, ",", removeSort); - if (s.length()==0) s=null; - this.set(CommonParams.SORT, s); - } - return this; - } - - /** - * Gets an array of sort specifications. - * @deprecated Use {@link #getSorts()} instead, which is part - * of an api handling a wider range of sort specifications. - */ - @Deprecated - public String[] getSortFields() { - String s = getSortField(); - if (s==null) return null; - return s.trim().split(", *"); - } - /** * Gets the raw sort field, as it will be sent to Solr. *

@@ -978,22 +894,6 @@ public class SolrQuery extends ModifiableSolrParams return this.get(CommonParams.QT); } - /** - * @deprecated See {@link #setRequestHandler(String)}. - */ - @Deprecated - public SolrQuery setQueryType(String qt) { - return setRequestHandler(qt); - } - - /** - * @deprecated See {@link #getRequestHandler()}. - */ - @Deprecated - public String getQueryType() { - return getRequestHandler(); - } - /** * @return this * @see ModifiableSolrParams#set(String,String[]) diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/CloudSolrClient.java b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/CloudSolrClient.java index 607e29eacb0..9b8f8227f92 100644 --- a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/CloudSolrClient.java +++ b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/CloudSolrClient.java @@ -923,9 +923,6 @@ public class CloudSolrClient extends SolrClient { } String shardKeys = reqParams.get(ShardParams._ROUTE_); - if(shardKeys == null) { - shardKeys = reqParams.get(ShardParams.SHARD_KEYS); // deprecated - } // TODO: not a big deal because of the caching, but we could avoid looking // at every shard diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/request/CoreAdminRequest.java b/solr/solrj/src/java/org/apache/solr/client/solrj/request/CoreAdminRequest.java index 2c4a2c1dec6..320a16e7fcf 100644 --- a/solr/solrj/src/java/org/apache/solr/client/solrj/request/CoreAdminRequest.java +++ b/solr/solrj/src/java/org/apache/solr/client/solrj/request/CoreAdminRequest.java @@ -587,14 +587,6 @@ public class CoreAdminRequest extends SolrRequest return req.process( client ); } - @Deprecated - public static CoreAdminResponse persist(String fileName, SolrClient client) throws SolrServerException, IOException - { - CoreAdminRequest.Persist req = new CoreAdminRequest.Persist(); - req.setFileName(fileName); - return req.process(client); - } - public static CoreAdminResponse mergeIndexes(String name, String[] indexDirs, String[] srcCores, SolrClient client) throws SolrServerException, IOException { diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/response/RangeFacet.java b/solr/solrj/src/java/org/apache/solr/client/solrj/response/RangeFacet.java index 22708ced563..52b4e6b98d1 100644 --- a/solr/solrj/src/java/org/apache/solr/client/solrj/response/RangeFacet.java +++ b/solr/solrj/src/java/org/apache/solr/client/solrj/response/RangeFacet.java @@ -84,11 +84,6 @@ public abstract class RangeFacet { public static class Numeric extends RangeFacet { - @Deprecated - public Numeric(String name, Number start, Number end, Number gap, Number before, Number after) { - this(name, start, end, gap, before, after, null); - } - public Numeric(String name, Number start, Number end, Number gap, Number before, Number after, Number between) { super(name, start, end, gap, before, after, between); } @@ -97,11 +92,6 @@ public abstract class RangeFacet { public static class Date extends RangeFacet { - @Deprecated - public Date(String name, java.util.Date start, java.util.Date end, String gap, Number before, Number after) { - this(name, start, end, gap, before, after, null); - } - public Date(String name, java.util.Date start, java.util.Date end, String gap, Number before, Number after, Number between) { super(name, start, end, gap, before, after, between); } diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/response/SpellCheckResponse.java b/solr/solrj/src/java/org/apache/solr/client/solrj/response/SpellCheckResponse.java index 1118e9ddcaa..a3ae45daa16 100644 --- a/solr/solrj/src/java/org/apache/solr/client/solrj/response/SpellCheckResponse.java +++ b/solr/solrj/src/java/org/apache/solr/client/solrj/response/SpellCheckResponse.java @@ -210,18 +210,6 @@ public class SpellCheckResponse { return alternativeFrequencies; } - @Deprecated - /** @see #getAlternatives */ - public List getSuggestions() { - return alternatives; - } - - @Deprecated - /** @see #getAlternativeFrequencies */ - public List getSuggestionFrequencies() { - return alternativeFrequencies; - } - } public class Collation { diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/util/ClientUtils.java b/solr/solrj/src/java/org/apache/solr/client/solrj/util/ClientUtils.java index a4bcca0aba1..9f33d6f962e 100644 --- a/solr/solrj/src/java/org/apache/solr/client/solrj/util/ClientUtils.java +++ b/solr/solrj/src/java/org/apache/solr/client/solrj/util/ClientUtils.java @@ -17,21 +17,6 @@ package org.apache.solr.client.solrj.util; -import java.io.IOException; -import java.io.StringWriter; -import java.io.Writer; -import java.net.URLEncoder; -import java.text.DateFormat; -import java.text.ParseException; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Date; -import java.util.Iterator; -import java.util.Map; -import java.util.Map.Entry; -import java.util.TimeZone; -import java.nio.ByteBuffer; - import org.apache.solr.common.SolrDocument; import org.apache.solr.common.SolrInputDocument; import org.apache.solr.common.SolrInputField; @@ -43,6 +28,18 @@ import org.apache.solr.common.util.ContentStreamBase; import org.apache.solr.common.util.DateUtil; import org.apache.solr.common.util.XML; +import java.io.IOException; +import java.io.StringWriter; +import java.io.Writer; +import java.net.URLEncoder; +import java.nio.ByteBuffer; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Date; +import java.util.Iterator; +import java.util.Map; +import java.util.Map.Entry; + /** * @@ -186,44 +183,6 @@ public class ClientUtils //--------------------------------------------------------------------------------------- - /** - * @deprecated Use {@link org.apache.solr.common.util.DateUtil#DEFAULT_DATE_FORMATS} - */ - @Deprecated - public static final Collection fmts = DateUtil.DEFAULT_DATE_FORMATS; - - /** - * Returns a formatter that can be use by the current thread if needed to - * convert Date objects to the Internal representation. - * - * @deprecated Use {@link org.apache.solr.common.util.DateUtil#parseDate(String)} - */ - @Deprecated - public static Date parseDate( String d ) throws ParseException - { - return DateUtil.parseDate(d); - } - - /** - * Returns a formatter that can be use by the current thread if needed to - * convert Date objects to the Internal representation. - * - * @deprecated use {@link org.apache.solr.common.util.DateUtil#getThreadLocalDateFormat()} - */ - @Deprecated - public static DateFormat getThreadLocalDateFormat() { - - return DateUtil.getThreadLocalDateFormat(); - } - - /** - * @deprecated Use {@link org.apache.solr.common.util.DateUtil#UTC}. - */ - @Deprecated - public static TimeZone UTC = DateUtil.UTC; - - - /** * See: {@link org.apache.lucene.queryparser.classic queryparser syntax} * for more information on Escaping Special Characters diff --git a/solr/solrj/src/java/org/apache/solr/common/cloud/ClusterState.java b/solr/solrj/src/java/org/apache/solr/common/cloud/ClusterState.java index be18d65043c..ceac4ecaf66 100644 --- a/solr/solrj/src/java/org/apache/solr/common/cloud/ClusterState.java +++ b/solr/solrj/src/java/org/apache/solr/common/cloud/ClusterState.java @@ -17,6 +17,12 @@ package org.apache.solr.common.cloud; * limitations under the License. */ +import org.apache.solr.common.SolrException; +import org.apache.solr.common.SolrException.ErrorCode; +import org.noggit.JSONWriter; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + import java.util.Collection; import java.util.Collections; import java.util.HashMap; @@ -26,12 +32,6 @@ import java.util.Map; import java.util.Map.Entry; import java.util.Set; -import org.apache.solr.common.SolrException; -import org.apache.solr.common.SolrException.ErrorCode; -import org.noggit.JSONWriter; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - /** * Immutable state of the cloud. Normally you can get the state by using * {@link ZkStateReader#getClusterState()}. @@ -45,18 +45,6 @@ public class ClusterState implements JSONWriter.Writable { private final Map collectionStates; private Set liveNodes; - - /** - * Use this constr when ClusterState is meant for publication. - * - * hashCode and equals will only depend on liveNodes and not clusterStateVersion. - */ - @Deprecated - public ClusterState(Set liveNodes, - Map collectionStates) { - this(null, liveNodes, collectionStates); - } - /** * Use this constr when ClusterState is meant for consumption. */ diff --git a/solr/solrj/src/java/org/apache/solr/common/cloud/ImplicitDocRouter.java b/solr/solrj/src/java/org/apache/solr/common/cloud/ImplicitDocRouter.java index 1fd82e1dc3a..8e421bd21fb 100644 --- a/solr/solrj/src/java/org/apache/solr/common/cloud/ImplicitDocRouter.java +++ b/solr/solrj/src/java/org/apache/solr/common/cloud/ImplicitDocRouter.java @@ -31,9 +31,9 @@ import static org.apache.solr.common.params.ShardParams._ROUTE_; /** This document router is for custom sharding */ public class ImplicitDocRouter extends DocRouter { + public static final String NAME = "implicit"; -// @Deprecated -// public static final String DEFAULT_SHARD_PARAM = "_shard_"; + private static Logger log = LoggerFactory .getLogger(ImplicitDocRouter.class); @@ -49,7 +49,6 @@ public class ImplicitDocRouter extends DocRouter { } if(shard == null) { Object o = sdoc.getFieldValue(_ROUTE_); - if (o == null) o = sdoc.getFieldValue("_shard_");//deprecated . for backcompat remove later if (o != null) { shard = o.toString(); } @@ -58,7 +57,6 @@ public class ImplicitDocRouter extends DocRouter { if (shard == null) { shard = params.get(_ROUTE_); - if(shard == null) shard =params.get("_shard_"); //deperecated for back compat } if (shard != null) { diff --git a/solr/solrj/src/java/org/apache/solr/common/params/AppendedSolrParams.java b/solr/solrj/src/java/org/apache/solr/common/params/AppendedSolrParams.java index 298e0c14087..4c9cc2e44e4 100644 --- a/solr/solrj/src/java/org/apache/solr/common/params/AppendedSolrParams.java +++ b/solr/solrj/src/java/org/apache/solr/common/params/AppendedSolrParams.java @@ -24,11 +24,11 @@ package org.apache.solr.common.params; */ public class AppendedSolrParams extends DefaultSolrParams { - /** - * @deprecated (3.6) Use {@link SolrParams#wrapAppended(SolrParams, SolrParams)} instead. - */ - @Deprecated - public AppendedSolrParams(SolrParams main, SolrParams extra) { + public static AppendedSolrParams wrapAppended(SolrParams params, SolrParams extra) { + return new AppendedSolrParams(params, extra); + } + + private AppendedSolrParams(SolrParams main, SolrParams extra) { super(main, extra); } diff --git a/solr/solrj/src/java/org/apache/solr/common/params/DefaultSolrParams.java b/solr/solrj/src/java/org/apache/solr/common/params/DefaultSolrParams.java index 36936e4a7ab..1f308cdc9f8 100644 --- a/solr/solrj/src/java/org/apache/solr/common/params/DefaultSolrParams.java +++ b/solr/solrj/src/java/org/apache/solr/common/params/DefaultSolrParams.java @@ -24,14 +24,11 @@ import java.util.LinkedHashSet; * */ public class DefaultSolrParams extends SolrParams { + protected final SolrParams params; protected final SolrParams defaults; - /** - * @deprecated (3.6) Use {@link SolrParams#wrapDefaults(SolrParams, SolrParams)} instead. - */ - @Deprecated - public DefaultSolrParams(SolrParams params, SolrParams defaults) { + protected DefaultSolrParams(SolrParams params, SolrParams defaults) { assert params != null && defaults != null; this.params = params; this.defaults = defaults; diff --git a/solr/solrj/src/java/org/apache/solr/common/params/FacetParams.java b/solr/solrj/src/java/org/apache/solr/common/params/FacetParams.java index 0509ea568ef..0947494d03a 100644 --- a/solr/solrj/src/java/org/apache/solr/common/params/FacetParams.java +++ b/solr/solrj/src/java/org/apache/solr/common/params/FacetParams.java @@ -309,25 +309,6 @@ public interface FacetParams { } } - /** - * @deprecated Use {@link FacetRangeOther} - */ - @Deprecated - public enum FacetDateOther { - BEFORE, AFTER, BETWEEN, ALL, NONE; - @Override - public String toString() { return super.toString().toLowerCase(Locale.ROOT); } - public static FacetDateOther get(String label) { - try { - return valueOf(label.toUpperCase(Locale.ROOT)); - } catch (IllegalArgumentException e) { - throw new SolrException - (SolrException.ErrorCode.BAD_REQUEST, - label+" is not a valid type of 'other' range facet information",e); - } - } - } - /** * An enumeration of the legal values for {@link #FACET_DATE_INCLUDE} and {@link #FACET_RANGE_INCLUDE} *

diff --git a/solr/solrj/src/java/org/apache/solr/common/params/ShardParams.java b/solr/solrj/src/java/org/apache/solr/common/params/ShardParams.java index a17be2aec23..46a9fc08d90 100644 --- a/solr/solrj/src/java/org/apache/solr/common/params/ShardParams.java +++ b/solr/solrj/src/java/org/apache/solr/common/params/ShardParams.java @@ -45,10 +45,6 @@ public interface ShardParams { /** Should things fail if there is an error? (true/false) */ public static final String SHARDS_TOLERANT = "shards.tolerant"; - - /** Should things fail if there is an error? (true/false) */ - @Deprecated - public static final String SHARD_KEYS = "shard.keys"; /** query purpose for shard requests */ public static final String SHARDS_PURPOSE = "shards.purpose"; diff --git a/solr/solrj/src/java/org/apache/solr/common/params/SolrParams.java b/solr/solrj/src/java/org/apache/solr/common/params/SolrParams.java index 10f07b80d87..36d0df1a117 100644 --- a/solr/solrj/src/java/org/apache/solr/common/params/SolrParams.java +++ b/solr/solrj/src/java/org/apache/solr/common/params/SolrParams.java @@ -17,17 +17,17 @@ package org.apache.solr.common.params; +import org.apache.solr.common.SolrException; +import org.apache.solr.common.util.NamedList; +import org.apache.solr.common.util.SimpleOrderedMap; +import org.apache.solr.common.util.StrUtils; + import java.io.Serializable; import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; -import org.apache.solr.common.SolrException; -import org.apache.solr.common.util.NamedList; -import org.apache.solr.common.util.SimpleOrderedMap; -import org.apache.solr.common.util.StrUtils; - /** SolrParams hold request parameters. * * @@ -282,7 +282,6 @@ public abstract class SolrParams implements Serializable { } } - @SuppressWarnings({"deprecation"}) public static SolrParams wrapDefaults(SolrParams params, SolrParams defaults) { if (params == null) return defaults; @@ -291,13 +290,12 @@ public abstract class SolrParams implements Serializable { return new DefaultSolrParams(params,defaults); } - @SuppressWarnings({"deprecation"}) public static SolrParams wrapAppended(SolrParams params, SolrParams defaults) { if (params == null) return defaults; if (defaults == null) return params; - return new AppendedSolrParams(params,defaults); + return AppendedSolrParams.wrapAppended(params,defaults); } /** Create a Map<String,String> from a NamedList given no keys are repeated */ diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/SolrExampleTests.java b/solr/solrj/src/test/org/apache/solr/client/solrj/SolrExampleTests.java index d28b1030d25..76e66af62c8 100644 --- a/solr/solrj/src/test/org/apache/solr/client/solrj/SolrExampleTests.java +++ b/solr/solrj/src/test/org/apache/solr/client/solrj/SolrExampleTests.java @@ -256,7 +256,7 @@ abstract public class SolrExampleTests extends SolrExampleTestsBase SolrQuery query = new SolrQuery(); query.setQuery( "*:*" ); - query.addSortField( "price", SolrQuery.ORDER.asc ); + query.addSort(new SolrQuery.SortClause("price", SolrQuery.ORDER.asc)); QueryResponse rsp = client.query( query ); assertEquals(2, rsp.getResults().getNumFound()); @@ -495,7 +495,7 @@ abstract public class SolrExampleTests extends SolrExampleTestsBase SolrQuery query = new SolrQuery(); query.setQuery( "*:*" ); query.set( CommonParams.FL, "id,price,[docid],[explain style=nl],score,aaa:[value v=aaa],ten:[value v=10 t=int]" ); - query.addSortField( "price", SolrQuery.ORDER.asc ); + query.addSort(new SolrQuery.SortClause("price", SolrQuery.ORDER.asc)); QueryResponse rsp = client.query( query ); SolrDocumentList out = rsp.getResults(); diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/SolrQueryTest.java b/solr/solrj/src/test/org/apache/solr/client/solrj/SolrQueryTest.java index 800b48fb426..7b5be047a83 100644 --- a/solr/solrj/src/test/org/apache/solr/client/solrj/SolrQueryTest.java +++ b/solr/solrj/src/test/org/apache/solr/client/solrj/SolrQueryTest.java @@ -70,14 +70,14 @@ public class SolrQueryTest extends LuceneTestCase { b = q.removeFacetQuery("a:b"); Assert.assertEquals(null, q.getFacetQuery()); - q.addSortField("price", SolrQuery.ORDER.asc); - q.addSortField("date", SolrQuery.ORDER.desc); - q.addSortField("qty", SolrQuery.ORDER.desc); - q.removeSortField("date", SolrQuery.ORDER.desc); - Assert.assertEquals(2, q.getSortFields().length); - q.removeSortField("price", SolrQuery.ORDER.asc); - q.removeSortField("qty", SolrQuery.ORDER.desc); - Assert.assertEquals(null, q.getSortFields()); + q.addSort("price", SolrQuery.ORDER.asc); + q.addSort("date", SolrQuery.ORDER.desc); + q.addSort("qty", SolrQuery.ORDER.desc); + q.removeSort(new SortClause("date", SolrQuery.ORDER.desc)); + Assert.assertEquals(2, q.getSorts().size()); + q.removeSort(new SortClause("price", SolrQuery.ORDER.asc)); + q.removeSort(new SortClause("qty", SolrQuery.ORDER.desc)); + Assert.assertEquals(0, q.getSorts().size()); q.addHighlightField("hl1"); q.addHighlightField("hl2"); @@ -103,21 +103,6 @@ public class SolrQueryTest extends LuceneTestCase { // System.out.println(q); } - - /* - * Verifies that the old (deprecated) sort methods - * allows mix-and-match between the raw field and - * the itemized apis. - */ - public void testSortFieldRawStringAndMethods() { - SolrQuery q = new SolrQuery("dog"); - q.set("sort", "price asc,date desc,qty desc"); - q.removeSortField("date", SolrQuery.ORDER.desc); - Assert.assertEquals(2, q.getSortFields().length); - q.set("sort", "price asc, date desc, qty desc"); - q.removeSortField("date", SolrQuery.ORDER.desc); - Assert.assertEquals(2, q.getSortFields().length); - } /* * Verifies that you can use removeSortField() twice, which @@ -125,13 +110,13 @@ public class SolrQueryTest extends LuceneTestCase { */ public void testSortFieldRemoveAfterRemove() { SolrQuery q = new SolrQuery("dog"); - q.addSortField("price", SolrQuery.ORDER.asc); - q.addSortField("date", SolrQuery.ORDER.desc); - q.addSortField("qty", SolrQuery.ORDER.desc); - q.removeSortField("date", SolrQuery.ORDER.desc); - Assert.assertEquals(2, q.getSortFields().length); - q.removeSortField("qty", SolrQuery.ORDER.desc); - Assert.assertEquals(1, q.getSortFields().length); + q.addSort("price", SolrQuery.ORDER.asc); + q.addSort("date", SolrQuery.ORDER.desc); + q.addSort("qty", SolrQuery.ORDER.desc); + q.removeSort("date"); + Assert.assertEquals(2, q.getSorts().size()); + q.removeSort("qty"); + Assert.assertEquals(1, q.getSorts().size()); } /* @@ -140,9 +125,9 @@ public class SolrQueryTest extends LuceneTestCase { */ public void testSortFieldRemoveLast() { SolrQuery q = new SolrQuery("dog"); - q.addSortField("date", SolrQuery.ORDER.desc); - q.addSortField("qty", SolrQuery.ORDER.desc); - q.removeSortField("qty", SolrQuery.ORDER.desc); + q.addSort("date", SolrQuery.ORDER.desc); + q.addSort("qty", SolrQuery.ORDER.desc); + q.removeSort("qty"); Assert.assertEquals("date desc", q.getSortField()); } @@ -276,9 +261,9 @@ public class SolrQueryTest extends LuceneTestCase { public void testFacetSortLegacy() { SolrQuery q = new SolrQuery("dog"); - assertTrue("expected default value to be true", q.getFacetSort()); - q.setFacetSort(false); - assertFalse("expected set value to be false", q.getFacetSort()); + assertEquals("expected default value to be SORT_COUNT", FacetParams.FACET_SORT_COUNT, q.getFacetSortString()); + q.setFacetSort(FacetParams.FACET_SORT_INDEX); + assertEquals("expected set value to be SORT_INDEX", FacetParams.FACET_SORT_INDEX, q.getFacetSortString()); } public void testFacetNumericRange() { @@ -343,7 +328,7 @@ public class SolrQueryTest extends LuceneTestCase { assertEquals("foo", q.setFacetPrefix("foo").get( FacetParams.FACET_PREFIX, null ) ); assertEquals("foo", q.setFacetPrefix("a", "foo").getFieldParam( "a", FacetParams.FACET_PREFIX, null ) ); - assertEquals( Boolean.TRUE, q.setMissing(Boolean.TRUE.toString()).getBool( FacetParams.FACET_MISSING ) ); + assertEquals( Boolean.TRUE, q.setFacetMissing(Boolean.TRUE).getBool( FacetParams.FACET_MISSING ) ); assertEquals( Boolean.FALSE, q.setFacetMissing( Boolean.FALSE ).getBool( FacetParams.FACET_MISSING ) ); assertEquals( "true", q.setParam( "xxx", true ).getParams( "xxx" )[0] ); diff --git a/solr/test-framework/src/java/org/apache/solr/SolrTestCaseJ4.java b/solr/test-framework/src/java/org/apache/solr/SolrTestCaseJ4.java index b7f484197d6..373bb4ee42c 100644 --- a/solr/test-framework/src/java/org/apache/solr/SolrTestCaseJ4.java +++ b/solr/test-framework/src/java/org/apache/solr/SolrTestCaseJ4.java @@ -51,7 +51,7 @@ import org.apache.solr.core.CoreDescriptor; import org.apache.solr.core.SolrConfig; import org.apache.solr.core.SolrCore; import org.apache.solr.core.SolrResourceLoader; -import org.apache.solr.handler.JsonUpdateRequestHandler; +import org.apache.solr.handler.UpdateRequestHandler; import org.apache.solr.request.LocalSolrQueryRequest; import org.apache.solr.request.SolrQueryRequest; import org.apache.solr.request.SolrRequestHandler; @@ -1062,20 +1062,6 @@ public abstract class SolrTestCaseJ4 extends LuceneTestCase { @Override public String toString() { return xml; } } - - /** - * @see IOUtils#rm(Path...) - */ - @Deprecated() - public static boolean recurseDelete(File f) { - try { - IOUtils.rm(f.toPath()); - return true; - } catch (IOException e) { - System.err.println(e.toString()); - return false; - } - } public void clearIndex() { assertU(delQ("*:*")); @@ -1095,7 +1081,7 @@ public abstract class SolrTestCaseJ4 extends LuceneTestCase { DirectSolrConnection connection = new DirectSolrConnection(core); SolrRequestHandler handler = core.getRequestHandler("/update/json"); if (handler == null) { - handler = new JsonUpdateRequestHandler(); + handler = new UpdateRequestHandler(); handler.init(null); } return connection.request(handler, args, json);