This is an automated email from the ASF dual-hosted git repository.
epugh pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/solr.git
The following commit(s) were added to refs/heads/main by this push:
new bb52661e607 Tidy up java code in o.a.s.common package (#4669)
bb52661e607 is described below
commit bb52661e60749aa92588ab772d02febe585af4a1
Author: Eric Pugh <[email protected]>
AuthorDate: Fri Jul 31 20:03:07 2026 -0400
Tidy up java code in o.a.s.common package (#4669)
---
.../apache/solr/cloud/overseer/SliceMutator.java | 4 +-
.../org/apache/solr/response/JSONWriterTest.java | 3 +-
.../solr/common/cloud/SecurityNodeWatcher.java | 6 +-
.../src/java/org/apache/solr/common/Callable.java | 21 ----
.../solr/common/ConditionalKeyMapWriter.java | 5 -
.../apache/solr/common/ConditionalMapWriter.java | 84 ---------------
.../apache/solr/common/LinkedHashMapWriter.java | 11 --
.../src/java/org/apache/solr/common/MapWriter.java | 4 -
.../org/apache/solr/common/NavigableObject.java | 9 --
.../org/apache/solr/common/SolrDocumentList.java | 2 +-
.../java/org/apache/solr/common/SolrException.java | 44 +-------
.../apache/solr/common/ToleratedUpdateError.java | 6 +-
.../java/org/apache/solr/common/cloud/Aliases.java | 2 +-
.../solr/common/cloud/CompositeIdRouter.java | 6 +-
.../apache/solr/common/cloud/HashBasedRouter.java | 6 +-
.../apache/solr/common/cloud/PerReplicaStates.java | 6 +-
.../org/apache/solr/common/cloud/RoutingRule.java | 2 +-
.../java/org/apache/solr/common/cloud/Slice.java | 2 +-
.../apache/solr/common/params/AnalysisParams.java | 14 +--
.../apache/solr/common/params/CommonParams.java | 4 -
.../apache/solr/common/params/ConfigSetParams.java | 10 +-
.../solr/common/params/CursorMarkParams.java | 6 +-
.../apache/solr/common/params/DisMaxParams.java | 31 +++---
.../org/apache/solr/common/params/EventParams.java | 6 +-
.../apache/solr/common/params/ExpandParams.java | 14 +--
.../org/apache/solr/common/params/FacetParams.java | 118 ++++++++++----------
.../org/apache/solr/common/params/GroupParams.java | 32 +++---
.../apache/solr/common/params/HighlightParams.java | 117 ++++++++++----------
.../solr/common/params/MoreLikeThisParams.java | 39 ++++---
.../apache/solr/common/params/SimpleParams.java | 24 ++---
.../org/apache/solr/common/params/SolrParams.java | 20 ----
.../apache/solr/common/params/SpatialParams.java | 12 +--
.../apache/solr/common/params/SpellingParams.java | 46 ++++----
.../org/apache/solr/common/params/StatsParams.java | 8 +-
.../solr/common/params/TermVectorParams.java | 20 ++--
.../org/apache/solr/common/params/TermsParams.java | 30 +++---
.../apache/solr/common/params/UpdateParams.java | 34 +++---
.../common/util/ByteArrayUtf8CharSequence.java | 12 +--
.../org/apache/solr/common/util/ByteUtils.java | 19 ++--
.../apache/solr/common/util/CommandOperation.java | 20 +---
.../solr/common/util/CommonTestInjection.java | 11 --
.../apache/solr/common/util/ContentStreamBase.java | 4 -
.../java/org/apache/solr/common/util/DOMUtil.java | 119 ---------------------
.../solr/common/util/DataInputInputStream.java | 3 +-
.../org/apache/solr/common/util/ExecutorUtil.java | 18 ----
.../solr/common/util/FastJavaBinDecoder.java | 14 +--
.../apache/solr/common/util/FastOutputStream.java | 4 +-
.../org/apache/solr/common/util/FastWriter.java | 2 +-
.../apache/solr/common/util/GlobPatternUtil.java | 4 +-
.../org/apache/solr/common/util/JavaBinCodec.java | 10 +-
.../apache/solr/common/util/JsonRecordReader.java | 29 ++---
.../solr/common/util/JsonSchemaValidator.java | 1 -
.../apache/solr/common/util/JsonTextWriter.java | 76 ++-----------
.../org/apache/solr/common/util/NamedList.java | 2 +-
.../solr/common/util/ObjectReleaseTracker.java | 11 --
.../java/org/apache/solr/common/util/PathTrie.java | 2 -
.../apache/solr/common/util/PropertiesUtil.java | 19 ----
.../java/org/apache/solr/common/util/Template.java | 61 -----------
.../java/org/apache/solr/common/util/URLUtil.java | 2 +-
.../java/org/apache/solr/common/util/Utils.java | 43 --------
.../src/java/org/apache/solr/common/util/XML.java | 40 +------
61 files changed, 346 insertions(+), 988 deletions(-)
diff --git
a/solr/core/src/java/org/apache/solr/cloud/overseer/SliceMutator.java
b/solr/core/src/java/org/apache/solr/cloud/overseer/SliceMutator.java
index 9b72410a114..b8e5b304d3d 100644
--- a/solr/core/src/java/org/apache/solr/cloud/overseer/SliceMutator.java
+++ b/solr/core/src/java/org/apache/solr/cloud/overseer/SliceMutator.java
@@ -250,14 +250,14 @@ public class SliceMutator {
map.put("routeRanges", range);
map.put("targetCollection", targetCollection);
map.put("expireAt", expireAt);
- RoutingRule rule = new RoutingRule(routeKey, map);
+ RoutingRule rule = new RoutingRule(map);
routingRules.put(routeKey, rule);
} else {
// add this range
Map<String, Object> map = r.shallowCopy();
map.put("routeRanges", map.get("routeRanges") + "," + range);
map.put("expireAt", expireAt);
- routingRules.put(routeKey, new RoutingRule(routeKey, map));
+ routingRules.put(routeKey, new RoutingRule(map));
}
Map<String, Object> props = slice.shallowCopy();
diff --git a/solr/core/src/test/org/apache/solr/response/JSONWriterTest.java
b/solr/core/src/test/org/apache/solr/response/JSONWriterTest.java
index ad318de1650..2bfc740a977 100644
--- a/solr/core/src/test/org/apache/solr/response/JSONWriterTest.java
+++ b/solr/core/src/test/org/apache/solr/response/JSONWriterTest.java
@@ -187,10 +187,9 @@ public class JSONWriterTest extends SolrTestCaseJ4 {
@Test
public void testArrntvWriterOverridesAllWrites() {
// List rather than Set because two not-overridden methods could share
name but not signature
- final List<String> methodsExpectedNotOverridden = new ArrayList<>(14);
+ final List<String> methodsExpectedNotOverridden = new ArrayList<>();
methodsExpectedNotOverridden.add("writeResponse");
methodsExpectedNotOverridden.add("writeKey");
- methodsExpectedNotOverridden.add("writeNamedListAsMapMangled");
methodsExpectedNotOverridden.add("writeNamedListAsMapWithDups");
methodsExpectedNotOverridden.add("writeNamedListAsArrMap");
methodsExpectedNotOverridden.add("writeNamedListAsArrArr");
diff --git
a/solr/solrj-zookeeper/src/java/org/apache/solr/common/cloud/SecurityNodeWatcher.java
b/solr/solrj-zookeeper/src/java/org/apache/solr/common/cloud/SecurityNodeWatcher.java
index 376a9c140c5..0a90b3db6a5 100644
---
a/solr/solrj-zookeeper/src/java/org/apache/solr/common/cloud/SecurityNodeWatcher.java
+++
b/solr/solrj-zookeeper/src/java/org/apache/solr/common/cloud/SecurityNodeWatcher.java
@@ -19,7 +19,7 @@ package org.apache.solr.common.cloud;
import java.lang.invoke.MethodHandles;
import java.nio.charset.StandardCharsets;
import java.util.Map;
-import org.apache.solr.common.Callable;
+import java.util.function.Consumer;
import org.apache.solr.common.SolrException;
import org.apache.solr.common.util.Utils;
import org.apache.zookeeper.KeeperException;
@@ -35,7 +35,7 @@ class SecurityNodeWatcher implements Watcher {
private final ZkStateReader zkStateReader;
private ZkStateReader.ConfigData securityData;
- private final Callable<SolrZkClient.NodeData> callback;
+ private final Consumer<SolrZkClient.NodeData> callback;
@SuppressWarnings("unchecked")
public SecurityNodeWatcher(ZkStateReader zkStateReader, Runnable
securityNodeListener) {
@@ -74,7 +74,7 @@ class SecurityNodeWatcher implements Watcher {
data =
zkStateReader.getZkClient().getNode(ZkStateReader.SOLR_SECURITY_CONF_PATH,
this);
}
try {
- callback.call(data);
+ callback.accept(data);
} catch (Exception e) {
log.error("Error running collections node listener", e);
}
diff --git a/solr/solrj/src/java/org/apache/solr/common/Callable.java
b/solr/solrj/src/java/org/apache/solr/common/Callable.java
deleted file mode 100644
index 8e43ac8e391..00000000000
--- a/solr/solrj/src/java/org/apache/solr/common/Callable.java
+++ /dev/null
@@ -1,21 +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.common;
-
-public interface Callable<T> {
- public void call(T data); // data depends on the context
-}
diff --git
a/solr/solrj/src/java/org/apache/solr/common/ConditionalKeyMapWriter.java
b/solr/solrj/src/java/org/apache/solr/common/ConditionalKeyMapWriter.java
index c8833413015..09770931aac 100644
--- a/solr/solrj/src/java/org/apache/solr/common/ConditionalKeyMapWriter.java
+++ b/solr/solrj/src/java/org/apache/solr/common/ConditionalKeyMapWriter.java
@@ -18,7 +18,6 @@
package org.apache.solr.common;
import java.io.IOException;
-import java.util.Set;
import java.util.function.Predicate;
public class ConditionalKeyMapWriter implements MapWriter {
@@ -80,8 +79,4 @@ public class ConditionalKeyMapWriter implements MapWriter {
public void writeMap(EntryWriter ew) throws IOException {
if (delegate != null) delegate.writeMap(new EntryWriterWrapper(ew,
predicate));
}
-
- public static Predicate<CharSequence> dedupeKeyPredicate(Set<CharSequence>
keys) {
- return (k) -> keys.add(k);
- }
}
diff --git
a/solr/solrj/src/java/org/apache/solr/common/ConditionalMapWriter.java
b/solr/solrj/src/java/org/apache/solr/common/ConditionalMapWriter.java
deleted file mode 100644
index 54785685cda..00000000000
--- a/solr/solrj/src/java/org/apache/solr/common/ConditionalMapWriter.java
+++ /dev/null
@@ -1,84 +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.common;
-
-import java.io.IOException;
-import java.util.Set;
-import java.util.function.BiPredicate;
-
-public class ConditionalMapWriter implements MapWriter {
- private final MapWriter delegate;
- private final BiPredicate<CharSequence, Object> predicate;
-
- public ConditionalMapWriter(MapWriter delegate, BiPredicate<CharSequence,
Object> predicate) {
- this.delegate = delegate;
- this.predicate = predicate;
- }
-
- public static class EntryWriterWrapper implements EntryWriter {
- private final EntryWriter delegate;
- private final BiPredicate<CharSequence, Object> predicate;
-
- public EntryWriterWrapper(EntryWriter delegate, BiPredicate<CharSequence,
Object> predicate) {
- this.delegate = delegate;
- this.predicate = predicate;
- }
-
- @Override
- public EntryWriter put(CharSequence k, Object v) throws IOException {
- if (predicate.test(k, v)) delegate.put(k, v);
- return this;
- }
-
- @Override
- public EntryWriter put(CharSequence k, int v) throws IOException {
- return put(k, Integer.valueOf(v));
- }
-
- @Override
- public EntryWriter put(CharSequence k, long v) throws IOException {
- return put(k, Long.valueOf(v));
- }
-
- @Override
- public EntryWriter put(CharSequence k, float v) throws IOException {
- return put(k, Float.valueOf(v));
- }
-
- @Override
- public EntryWriter put(CharSequence k, double v) throws IOException {
- return put(k, Double.valueOf(v));
- }
-
- @Override
- public EntryWriter put(CharSequence k, boolean v) throws IOException {
- return put(k, Boolean.valueOf(v));
- }
- }
-
- @Override
- public void writeMap(EntryWriter ew) throws IOException {
- if (delegate != null) delegate.writeMap(new EntryWriterWrapper(ew,
predicate));
- }
-
- public static BiPredicate<CharSequence, Object>
dedupeKeyPredicate(Set<CharSequence> keys) {
- return (k, v) -> keys.add(k);
- }
-
- public static final BiPredicate<CharSequence, Object> NON_NULL_VAL = (s, o)
-> o != null;
-}
diff --git
a/solr/solrj/src/java/org/apache/solr/common/LinkedHashMapWriter.java
b/solr/solrj/src/java/org/apache/solr/common/LinkedHashMapWriter.java
index 57edf04c5b9..418f05d4254 100644
--- a/solr/solrj/src/java/org/apache/solr/common/LinkedHashMapWriter.java
+++ b/solr/solrj/src/java/org/apache/solr/common/LinkedHashMapWriter.java
@@ -20,24 +20,13 @@ package org.apache.solr.common;
import java.io.IOException;
import java.util.LinkedHashMap;
import java.util.List;
-import java.util.Map;
-import org.apache.solr.common.util.SuppressForbidden;
public class LinkedHashMapWriter<V> extends LinkedHashMap<String, V>
implements MapWriter {
- @SuppressForbidden(reason = "extends LinkedHashMap")
- public LinkedHashMapWriter(int initialCapacity) {
- super(initialCapacity);
- }
-
public LinkedHashMapWriter() {
super();
}
- public LinkedHashMapWriter(Map<? extends String, ? extends V> m) {
- super(m);
- }
-
@Override
public void writeMap(EntryWriter ew) throws IOException {
forEach(ew.getBiConsumer());
diff --git a/solr/solrj/src/java/org/apache/solr/common/MapWriter.java
b/solr/solrj/src/java/org/apache/solr/common/MapWriter.java
index d98d66f3bde..d9ab56867ce 100644
--- a/solr/solrj/src/java/org/apache/solr/common/MapWriter.java
+++ b/solr/solrj/src/java/org/apache/solr/common/MapWriter.java
@@ -18,7 +18,6 @@
package org.apache.solr.common;
import java.io.IOException;
-import java.util.Map;
import java.util.function.BiConsumer;
import java.util.function.BiPredicate;
import java.util.function.Supplier;
@@ -145,7 +144,4 @@ public interface MapWriter extends NavigableObject,
JSONWriter.Writable {
return this::putNoEx;
}
}
-
- @Deprecated // use SimpleOrderedMap.of()
- MapWriter EMPTY = new MapWriterMap(Map.of());
}
diff --git a/solr/solrj/src/java/org/apache/solr/common/NavigableObject.java
b/solr/solrj/src/java/org/apache/solr/common/NavigableObject.java
index 8b0004b4127..226dc3a90ab 100644
--- a/solr/solrj/src/java/org/apache/solr/common/NavigableObject.java
+++ b/solr/solrj/src/java/org/apache/solr/common/NavigableObject.java
@@ -61,15 +61,6 @@ public interface NavigableObject {
Utils.forEachMapEntry(this, path, fun);
}
- /**
- * Iterate through the entries of a navigable Object at a certain path
- *
- * @param path the json path
- */
- default void _forEachEntry(List<String> path,
@SuppressWarnings({"rawtypes"}) BiConsumer fun) {
- Utils.forEachMapEntry(this, path, fun);
- }
-
/** Iterate through each entry in this object */
default void _forEachEntry(@SuppressWarnings({"rawtypes"}) BiConsumer fun) {
Utils.forEachMapEntry(this, fun);
diff --git a/solr/solrj/src/java/org/apache/solr/common/SolrDocumentList.java
b/solr/solrj/src/java/org/apache/solr/common/SolrDocumentList.java
index cbc7f8dd2b5..9b9c427979d 100644
--- a/solr/solrj/src/java/org/apache/solr/common/SolrDocumentList.java
+++ b/solr/solrj/src/java/org/apache/solr/common/SolrDocumentList.java
@@ -86,7 +86,7 @@ public class SolrDocumentList extends ArrayList<SolrDocument>
implements MapWrit
return "{numFound="
+ numFound
+ ",numFoundExact="
- + String.valueOf(numFoundExact)
+ + numFoundExact
+ ",start="
+ start
+ (maxScore != null ? ",maxScore=" + maxScore : "")
diff --git a/solr/solrj/src/java/org/apache/solr/common/SolrException.java
b/solr/solrj/src/java/org/apache/solr/common/SolrException.java
index 66a5a4b4fb2..b8eceee17af 100644
--- a/solr/solrj/src/java/org/apache/solr/common/SolrException.java
+++ b/solr/solrj/src/java/org/apache/solr/common/SolrException.java
@@ -23,14 +23,10 @@ import java.util.List;
import java.util.Map;
import org.apache.solr.common.util.NamedList;
import org.apache.solr.common.util.SimpleOrderedMap;
-import org.slf4j.Logger;
-import org.slf4j.MDC;
/** */
public class SolrException extends RuntimeException {
- private final Map<String, String> mdcContext;
-
/**
* This list of valid HTTP Status error codes that Solr may return when
there is a "Server Side"
* error.
@@ -52,7 +48,7 @@ public class SolrException extends RuntimeException {
UNKNOWN(0);
public final int code;
- private ErrorCode(int c) {
+ ErrorCode(int c) {
code = c;
}
@@ -62,24 +58,21 @@ public class SolrException extends RuntimeException {
}
return UNKNOWN;
}
- };
+ }
public SolrException(ErrorCode code, String msg) {
super(msg);
this.code = code.code;
- this.mdcContext = MDC.getCopyOfContextMap();
}
public SolrException(ErrorCode code, String msg, Throwable th) {
super(msg, th);
this.code = code.code;
- this.mdcContext = MDC.getCopyOfContextMap();
}
public SolrException(ErrorCode code, Throwable th) {
super(th);
this.code = code.code;
- this.mdcContext = MDC.getCopyOfContextMap();
}
/**
@@ -90,10 +83,9 @@ public class SolrException extends RuntimeException {
protected SolrException(int code, String msg, Throwable th) {
super(msg, th);
this.code = code;
- this.mdcContext = MDC.getCopyOfContextMap();
}
- int code = 0;
+ int code;
protected NamedList<String> metadata;
protected List<Map<String, Object>> details;
@@ -180,34 +172,4 @@ public class SolrException extends RuntimeException {
return new SolrException(ErrorCode.SERVER_ERROR, e.getMessage(), e);
}
-
- public void logInfoWithMdc(Logger logger, String msg) {
- Map<String, String> previousMdcContext = MDC.getCopyOfContextMap();
- MDC.setContextMap(mdcContext);
- try {
- logger.info(msg);
- } finally {
- MDC.setContextMap(previousMdcContext);
- }
- }
-
- public void logDebugWithMdc(Logger logger, String msg) {
- Map<String, String> previousMdcContext = MDC.getCopyOfContextMap();
- MDC.setContextMap(mdcContext);
- try {
- logger.debug(msg);
- } finally {
- MDC.setContextMap(previousMdcContext);
- }
- }
-
- public void logWarnWithMdc(Logger logger, String msg) {
- Map<String, String> previousMdcContext = MDC.getCopyOfContextMap();
- MDC.setContextMap(mdcContext);
- try {
- logger.warn(msg);
- } finally {
- MDC.setContextMap(previousMdcContext);
- }
- }
}
diff --git
a/solr/solrj/src/java/org/apache/solr/common/ToleratedUpdateError.java
b/solr/solrj/src/java/org/apache/solr/common/ToleratedUpdateError.java
index 15d03b4792b..02839e35005 100644
--- a/solr/solrj/src/java/org/apache/solr/common/ToleratedUpdateError.java
+++ b/solr/solrj/src/java/org/apache/solr/common/ToleratedUpdateError.java
@@ -160,7 +160,7 @@ public final class ToleratedUpdateError {
* @see #parseMetadataIfToleratedUpdateError
*/
public String getMetadataValue() {
- return message.toString();
+ return message;
}
/**
@@ -202,10 +202,10 @@ public final class ToleratedUpdateError {
}
/** Helper class for dealing with SolrException metadata (String) keys */
- public static enum CmdType {
+ public enum CmdType {
ADD,
DELID,
- DELQ;
+ DELQ
// if we add support for things like commit, parsing/toString/hashCode
logic
// needs to be smarter to account for 'id' being null ... "usesId" should
be a prop of enum
diff --git a/solr/solrj/src/java/org/apache/solr/common/cloud/Aliases.java
b/solr/solrj/src/java/org/apache/solr/common/cloud/Aliases.java
index f09622c3b01..957d15769e9 100644
--- a/solr/solrj/src/java/org/apache/solr/common/cloud/Aliases.java
+++ b/solr/solrj/src/java/org/apache/solr/common/cloud/Aliases.java
@@ -355,7 +355,7 @@ public class Aliases {
*
* @param before previous alias name, must not be null
* @param after new alias name. If this is null then it's equivalent to
calling {@link
- * #cloneWithCollectionAlias(String, String)} with the second argument
set to null, ie.
+ * #cloneWithCollectionAlias(String, String)} with the second argument
set to null, i.e.
* removing an alias.
* @return new instance with the renamed alias
* @throws SolrException when either <code>before</code> or
<code>after</code> is empty, or the
diff --git
a/solr/solrj/src/java/org/apache/solr/common/cloud/CompositeIdRouter.java
b/solr/solrj/src/java/org/apache/solr/common/cloud/CompositeIdRouter.java
index fede4e6b453..925cb16ba53 100644
--- a/solr/solrj/src/java/org/apache/solr/common/cloud/CompositeIdRouter.java
+++ b/solr/solrj/src/java/org/apache/solr/common/cloud/CompositeIdRouter.java
@@ -44,12 +44,12 @@ import org.apache.solr.common.util.Hash;
*
* <pre>
* An Example:
- * If the id "contact!0000000KISS is passed 😘
- * Take "contact"" and hash it with murmurhash3_x86_32
+ * If the id "contact!0000000KISS" is passed 😘
+ * Take "contact" and hash it with murmurhash3_x86_32
* result: -541354036
* bits: 11011111101110111001011111001100
*
- * Take 0000000KISS and hash it with murmurhash3_x86_32
+ * Take "0000000KISS" and hash it with murmurhash3_x86_32
* result: 2099700320
* bits: 01111101001001101110001001100000
*
diff --git
a/solr/solrj/src/java/org/apache/solr/common/cloud/HashBasedRouter.java
b/solr/solrj/src/java/org/apache/solr/common/cloud/HashBasedRouter.java
index 9d38c3e95c4..6d702b61962 100644
--- a/solr/solrj/src/java/org/apache/solr/common/cloud/HashBasedRouter.java
+++ b/solr/solrj/src/java/org/apache/solr/common/cloud/HashBasedRouter.java
@@ -38,7 +38,7 @@ public abstract class HashBasedRouter extends DocRouter {
if (route != null) {
hash = sliceHash(route, sdoc, params, collection);
} else {
- if (id == null) id = getId(sdoc, params);
+ if (id == null) id = getId(sdoc);
hash = sliceHash(id, sdoc, params, collection);
}
return hashToSlice(hash, collection);
@@ -51,7 +51,7 @@ public abstract class HashBasedRouter extends DocRouter {
SolrParams params,
String shardId,
DocCollection collection) {
- if (id == null) id = getId(sdoc, params);
+ if (id == null) id = getId(sdoc);
int hash = sliceHash(id, sdoc, params, collection);
Range range = collection.getSlice(shardId).getRange();
return range != null && range.includes(hash);
@@ -62,7 +62,7 @@ public abstract class HashBasedRouter extends DocRouter {
return Hash.murmurhash3_x86_32(id, 0, id.length(), 0);
}
- protected String getId(SolrInputDocument sdoc, SolrParams params) {
+ protected String getId(SolrInputDocument sdoc) {
Object idObj = sdoc.getFieldValue(ID); // blech
String id = idObj != null ? idObj.toString() : "null"; // should only
happen on client side
return id;
diff --git
a/solr/solrj/src/java/org/apache/solr/common/cloud/PerReplicaStates.java
b/solr/solrj/src/java/org/apache/solr/common/cloud/PerReplicaStates.java
index e4ed2e0f0e0..0d1c26bb040 100644
--- a/solr/solrj/src/java/org/apache/solr/common/cloud/PerReplicaStates.java
+++ b/solr/solrj/src/java/org/apache/solr/common/cloud/PerReplicaStates.java
@@ -20,7 +20,6 @@ package org.apache.solr.common.cloud;
import static org.apache.solr.common.params.CommonParams.NAME;
import java.io.IOException;
-import java.lang.invoke.MethodHandles;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.LinkedHashMap;
@@ -35,20 +34,17 @@ import org.apache.solr.common.annotation.JsonProperty;
import org.apache.solr.common.cloud.Replica.ReplicaStateProps;
import org.apache.solr.common.util.ReflectMapWriter;
import org.apache.solr.common.util.StrUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
/**
* This represents the individual replica states in a collection This is an
immutable object. When
* states are modified, a new instance is constructed
*/
public class PerReplicaStates implements ReflectMapWriter {
- private static final Logger log =
LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
public static final char SEPARATOR = ':';
// no:of times to retry in case of a CAS failure
public static final int MAX_RETRIES = 5;
- // znode path where thisis loaded from
+ // znode path where this is loaded from
@JsonProperty public final String path;
// the child version of that znode
diff --git a/solr/solrj/src/java/org/apache/solr/common/cloud/RoutingRule.java
b/solr/solrj/src/java/org/apache/solr/common/cloud/RoutingRule.java
index d4f863a125d..d587236acdf 100644
--- a/solr/solrj/src/java/org/apache/solr/common/cloud/RoutingRule.java
+++ b/solr/solrj/src/java/org/apache/solr/common/cloud/RoutingRule.java
@@ -29,7 +29,7 @@ public class RoutingRule extends ZkNodeProps {
private final String targetCollectionName;
private final Long expireAt;
- public RoutingRule(String routeKey, Map<String, Object> propMap) {
+ public RoutingRule(Map<String, Object> propMap) {
super(propMap);
this.routeRangesStr = (String) propMap.get("routeRanges");
String[] rangesArr = this.routeRangesStr.split(",");
diff --git a/solr/solrj/src/java/org/apache/solr/common/cloud/Slice.java
b/solr/solrj/src/java/org/apache/solr/common/cloud/Slice.java
index c307a8f9f1c..0de9be921aa 100644
--- a/solr/solrj/src/java/org/apache/solr/common/cloud/Slice.java
+++ b/solr/solrj/src/java/org/apache/solr/common/cloud/Slice.java
@@ -207,7 +207,7 @@ public class Slice extends ZkNodeProps implements
Iterable<Replica> {
for (Map.Entry<String, Object> entry : rules.entrySet()) {
Object o = entry.getValue();
if (o instanceof Map map) {
- RoutingRule rule = new RoutingRule(entry.getKey(), map);
+ RoutingRule rule = new RoutingRule(map);
routingRules.put(entry.getKey(), rule);
} else {
routingRules.put(entry.getKey(), (RoutingRule) o);
diff --git
a/solr/solrj/src/java/org/apache/solr/common/params/AnalysisParams.java
b/solr/solrj/src/java/org/apache/solr/common/params/AnalysisParams.java
index d50db80de03..c7eeeccd52a 100644
--- a/solr/solrj/src/java/org/apache/solr/common/params/AnalysisParams.java
+++ b/solr/solrj/src/java/org/apache/solr/common/params/AnalysisParams.java
@@ -24,25 +24,25 @@ package org.apache.solr.common.params;
public interface AnalysisParams {
/** The prefix for all parameters. */
- static final String PREFIX = "analysis";
+ String PREFIX = "analysis";
/** Holds the query to be analyzed. */
- static final String QUERY = PREFIX + ".query";
+ String QUERY = PREFIX + ".query";
/**
* Set to {@code true} to indicate that the index tokens that match query
tokens should be marked
* as "matched".
*/
- static final String SHOW_MATCH = PREFIX + ".showmatch";
+ String SHOW_MATCH = PREFIX + ".showmatch";
// ===== FieldAnalysisRequestHandler Params =====
/** Holds the value of the field which should be analyzed. */
- static final String FIELD_NAME = PREFIX + ".fieldname";
+ String FIELD_NAME = PREFIX + ".fieldname";
- /** Holds a comma-separated list of field types that the analysis should be
peformed for. */
- static final String FIELD_TYPE = PREFIX + ".fieldtype";
+ /** Holds a comma-separated list of field types that the analysis should be
performed for. */
+ String FIELD_TYPE = PREFIX + ".fieldtype";
/** Holds a comma-separated list of field named that the analysis should be
performed for. */
- static final String FIELD_VALUE = PREFIX + ".fieldvalue";
+ String FIELD_VALUE = PREFIX + ".fieldvalue";
}
diff --git
a/solr/solrj/src/java/org/apache/solr/common/params/CommonParams.java
b/solr/solrj/src/java/org/apache/solr/common/params/CommonParams.java
index 2e9e5b89a82..3bed47aac57 100644
--- a/solr/solrj/src/java/org/apache/solr/common/params/CommonParams.java
+++ b/solr/solrj/src/java/org/apache/solr/common/params/CommonParams.java
@@ -92,9 +92,6 @@ public interface CommonParams {
// SOLR-4228 end
- /** stylesheet to apply to XML results */
- String XSL = "xsl";
-
/** query and init param for field list */
String FL = "fl";
@@ -313,7 +310,6 @@ public interface CommonParams {
String JAVABIN_MIME = "application/javabin";
String FILE = "file";
- String FILES = "files";
String CHILDDOC = "_childDocuments_";
}
diff --git
a/solr/solrj/src/java/org/apache/solr/common/params/ConfigSetParams.java
b/solr/solrj/src/java/org/apache/solr/common/params/ConfigSetParams.java
index f7bff105370..18fbfa54238 100644
--- a/solr/solrj/src/java/org/apache/solr/common/params/ConfigSetParams.java
+++ b/solr/solrj/src/java/org/apache/solr/common/params/ConfigSetParams.java
@@ -20,12 +20,12 @@ import java.util.Locale;
/** ConfigSets API related parameters and actions. */
public interface ConfigSetParams {
- public static final String ACTION = "action";
- public static final String OVERWRITE = "overwrite";
- public static final String CLEANUP = "cleanup";
- public static final String FILE_PATH = "filePath";
+ String ACTION = "action";
+ String OVERWRITE = "overwrite";
+ String CLEANUP = "cleanup";
+ String FILE_PATH = "filePath";
- public enum ConfigSetAction {
+ enum ConfigSetAction {
CREATE,
UPLOAD,
DELETE,
diff --git
a/solr/solrj/src/java/org/apache/solr/common/params/CursorMarkParams.java
b/solr/solrj/src/java/org/apache/solr/common/params/CursorMarkParams.java
index d641d3337e5..9c1953f6611 100644
--- a/solr/solrj/src/java/org/apache/solr/common/params/CursorMarkParams.java
+++ b/solr/solrj/src/java/org/apache/solr/common/params/CursorMarkParams.java
@@ -27,18 +27,18 @@ public interface CursorMarkParams {
* specified must either be {@link #CURSOR_MARK_START} indicating the first
page of results, or a
* value returned by a previous search via the {@link #CURSOR_MARK_NEXT} key.
*/
- public static final String CURSOR_MARK_PARAM = "cursorMark";
+ String CURSOR_MARK_PARAM = "cursorMark";
/**
* Key used in Solr response to inform the client what the "next" {@link
#CURSOR_MARK_PARAM} value
* should be to continue pagination
*/
- public static final String CURSOR_MARK_NEXT = "nextCursorMark";
+ String CURSOR_MARK_NEXT = "nextCursorMark";
/**
* Special value for {@link #CURSOR_MARK_PARAM} indicating that cursor
functionality should be
* used, and a new cursor value should be computed after the last result,
but that currently the
* "first page" of results is being requested
*/
- public static final String CURSOR_MARK_START = "*";
+ String CURSOR_MARK_START = "*";
}
diff --git
a/solr/solrj/src/java/org/apache/solr/common/params/DisMaxParams.java
b/solr/solrj/src/java/org/apache/solr/common/params/DisMaxParams.java
index 3168b1d60b9..e9615c78cf9 100644
--- a/solr/solrj/src/java/org/apache/solr/common/params/DisMaxParams.java
+++ b/solr/solrj/src/java/org/apache/solr/common/params/DisMaxParams.java
@@ -23,50 +23,47 @@ package org.apache.solr.common.params;
public interface DisMaxParams {
/** query and init param for tiebreaker value */
- public static String TIE = "tie";
+ String TIE = "tie";
/** query and init param for query fields */
- public static String QF = "qf";
+ String QF = "qf";
/** query and init param for phrase boost fields */
- public static String PF = "pf";
+ String PF = "pf";
/** query and init param for bigram phrase boost fields */
- public static String PF2 = "pf2";
+ String PF2 = "pf2";
/** query and init param for trigram phrase boost fields */
- public static String PF3 = "pf3";
+ String PF3 = "pf3";
/** query and init param for MinShouldMatch specification */
- public static String MM = "mm";
+ String MM = "mm";
/** If set to true, will try to reduce MM if tokens are removed from some
clauses but not all */
- public static String MM_AUTORELAX = "mm.autoRelax";
+ String MM_AUTORELAX = "mm.autoRelax";
/** query and init param for Phrase Slop value in phrase boost query (in pf
fields) */
- public static String PS = "ps";
+ String PS = "ps";
/** default phrase slop for bigram phrases (pf2) */
- public static String PS2 = "ps2";
+ String PS2 = "ps2";
/** default phrase slop for bigram phrases (pf3) */
- public static String PS3 = "ps3";
+ String PS3 = "ps3";
/**
* query and init param for phrase Slop value in phrases explicitly included
in the user's query
* string ( in qf fields)
*/
- public static String QS = "qs";
+ String QS = "qs";
/** query and init param for boosting query */
- public static String BQ = "bq";
+ String BQ = "bq";
/** query and init param for boosting functions */
- public static String BF = "bf";
+ String BF = "bf";
/** Alternate query (expressed in Solr QuerySyntax) to use if main query (q)
is empty */
- public static String ALTQ = "q.alt";
-
- /** query and init param for field list */
- public static String GEN = "gen";
+ String ALTQ = "q.alt";
}
diff --git a/solr/solrj/src/java/org/apache/solr/common/params/EventParams.java
b/solr/solrj/src/java/org/apache/solr/common/params/EventParams.java
index c38b93ef38b..d676901bd59 100644
--- a/solr/solrj/src/java/org/apache/solr/common/params/EventParams.java
+++ b/solr/solrj/src/java/org/apache/solr/common/params/EventParams.java
@@ -19,8 +19,8 @@ package org.apache.solr.common.params;
/** */
public interface EventParams {
/** Event param for things like newSearcher, firstSearcher* */
- public static final String EVENT = "event";
+ String EVENT = "event";
- public static final String NEW_SEARCHER = "newSearcher";
- public static final String FIRST_SEARCHER = "firstSearcher";
+ String NEW_SEARCHER = "newSearcher";
+ String FIRST_SEARCHER = "firstSearcher";
}
diff --git
a/solr/solrj/src/java/org/apache/solr/common/params/ExpandParams.java
b/solr/solrj/src/java/org/apache/solr/common/params/ExpandParams.java
index 2584f816b31..905d4b68370 100644
--- a/solr/solrj/src/java/org/apache/solr/common/params/ExpandParams.java
+++ b/solr/solrj/src/java/org/apache/solr/common/params/ExpandParams.java
@@ -19,11 +19,11 @@ package org.apache.solr.common.params;
/** Expand parameters */
public interface ExpandParams {
- public static final String EXPAND = "expand";
- public static final String EXPAND_SORT = EXPAND + ".sort";
- public static final String EXPAND_ROWS = EXPAND + ".rows";
- public static final String EXPAND_FIELD = EXPAND + ".field";
- public static final String EXPAND_Q = EXPAND + ".q";
- public static final String EXPAND_FQ = EXPAND + ".fq";
- public static final String EXPAND_NULL = EXPAND + ".nullGroup";
+ String EXPAND = "expand";
+ String EXPAND_SORT = EXPAND + ".sort";
+ String EXPAND_ROWS = EXPAND + ".rows";
+ String EXPAND_FIELD = EXPAND + ".field";
+ String EXPAND_Q = EXPAND + ".q";
+ String EXPAND_FQ = EXPAND + ".fq";
+ String EXPAND_NULL = EXPAND + ".nullGroup";
}
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 53fce3670bd..f52ba0eb33b 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
@@ -24,83 +24,83 @@ import org.apache.solr.common.SolrException;
public interface FacetParams {
/** Should facet counts be calculated? */
- public static final String FACET = "facet";
+ String FACET = "facet";
/**
* Numeric option indicating the maximum number of threads to be used in
counting facet field
* vales
*/
- public static final String FACET_THREADS = FACET + ".threads";
+ String FACET_THREADS = FACET + ".threads";
/** What method should be used to do the faceting */
- public static final String FACET_METHOD = FACET + ".method";
+ String FACET_METHOD = FACET + ".method";
/**
* Value for FACET_METHOD param to indicate that Solr should enumerate over
terms in a field to
* calculate the facet counts.
*/
- public static final String FACET_METHOD_enum = "enum";
+ String FACET_METHOD_enum = "enum";
/**
* Value for FACET_METHOD param to indicate that Solr should enumerate over
documents and count up
* terms by consulting an uninverted representation of the field values
(such as the FieldCache
* used for sorting).
*/
- public static final String FACET_METHOD_fc = "fc";
+ String FACET_METHOD_fc = "fc";
/** Value for FACET_METHOD param, like FACET_METHOD_fc but counts
per-segment. */
- public static final String FACET_METHOD_fcs = "fcs";
+ String FACET_METHOD_fcs = "fcs";
/** Value for FACET_METHOD param to indicate that Solr should use an
UnInvertedField */
- public static final String FACET_METHOD_uif = "uif";
+ String FACET_METHOD_uif = "uif";
/**
* Any lucene formatted queries the user would like to use for Facet
Constraint Counts
* (multi-value)
*/
- public static final String FACET_QUERY = FACET + ".query";
+ String FACET_QUERY = FACET + ".query";
/**
* Any field whose terms the user wants to enumerate over for Facet
Constraint Counts
* (multi-value)
*/
- public static final String FACET_FIELD = FACET + ".field";
+ String FACET_FIELD = FACET + ".field";
/** The offset into the list of facets. Can be overridden on a per field
basis. */
- public static final String FACET_OFFSET = FACET + ".offset";
+ String FACET_OFFSET = FACET + ".offset";
/**
* Numeric option indicating the maximum number of facet field counts be
included in the response
* for each field - in descending order of count. Can be overridden on a per
field basis.
*/
- public static final String FACET_LIMIT = FACET + ".limit";
+ String FACET_LIMIT = FACET + ".limit";
/**
* Numeric option indicating the minimum number of hits before a facet
should be included in the
* response. Can be overridden on a per field basis.
*/
- public static final String FACET_MINCOUNT = FACET + ".mincount";
+ String FACET_MINCOUNT = FACET + ".mincount";
/**
* Boolean option indicating whether facet field counts of "0" should be
included in the response.
* Can be overridden on a per field basis.
*/
- public static final String FACET_ZEROS = FACET + ".zeros";
+ String FACET_ZEROS = FACET + ".zeros";
/**
* Boolean option indicating whether the response should include a facet
field count for all
* records which have no value for the facet field. Can be overridden on a
per field basis.
*/
- public static final String FACET_MISSING = FACET + ".missing";
+ String FACET_MISSING = FACET + ".missing";
- static final String FACET_OVERREQUEST = FACET + ".overrequest";
+ String FACET_OVERREQUEST = FACET + ".overrequest";
/**
* The percentage to over-request by when performing initial distributed
requests.
*
* <p>default value is 1.5
*/
- public static final String FACET_OVERREQUEST_RATIO = FACET_OVERREQUEST +
".ratio";
+ String FACET_OVERREQUEST_RATIO = FACET_OVERREQUEST + ".ratio";
/**
* An additional amount to over-request by when performing initial
distributed requests. This
@@ -108,81 +108,81 @@ public interface FacetParams {
*
* <p>default value is 10
*/
- public static final String FACET_OVERREQUEST_COUNT = FACET_OVERREQUEST +
".count";
+ String FACET_OVERREQUEST_COUNT = FACET_OVERREQUEST + ".count";
/**
* Comma separated list of fields to pivot
*
* <p>example: author,type (for types by author / types within author)
*/
- public static final String FACET_PIVOT = FACET + ".pivot";
+ String FACET_PIVOT = FACET + ".pivot";
/**
* Minimum number of docs that need to match to be included in the sublist
*
* <p>default value is 1
*/
- public static final String FACET_PIVOT_MINCOUNT = FACET_PIVOT + ".mincount";
+ String FACET_PIVOT_MINCOUNT = FACET_PIVOT + ".mincount";
/**
* String option: "count" causes facets to be sorted by the count, "index"
results in index order.
*/
- public static final String FACET_SORT = FACET + ".sort";
+ String FACET_SORT = FACET + ".sort";
- public static final String FACET_SORT_COUNT = "count";
- public static final String FACET_SORT_COUNT_LEGACY = "true";
- public static final String FACET_SORT_INDEX = "index";
- public static final String FACET_SORT_INDEX_LEGACY = "false";
+ String FACET_SORT_COUNT = "count";
+ String FACET_SORT_COUNT_LEGACY = "true";
+ String FACET_SORT_INDEX = "index";
+ String FACET_SORT_INDEX_LEGACY = "false";
/** Only return constraints of a facet field with the given prefix. */
- public static final String FACET_PREFIX = FACET + ".prefix";
+ String FACET_PREFIX = FACET + ".prefix";
/** Only return constraints of a facet field containing the given string. */
- public static final String FACET_CONTAINS = FACET + ".contains";
+ String FACET_CONTAINS = FACET + ".contains";
/** Only return constraints of a facet field containing the given string. */
- public static final String FACET_MATCHES = FACET + ".matches";
+ String FACET_MATCHES = FACET + ".matches";
/** If using facet contains, ignore case when comparing values. */
- public static final String FACET_CONTAINS_IGNORE_CASE = FACET_CONTAINS +
".ignoreCase";
+ String FACET_CONTAINS_IGNORE_CASE = FACET_CONTAINS + ".ignoreCase";
/** Only return constraints of a facet field excluding the given string. */
- public static final String FACET_EXCLUDETERMS = FACET + ".excludeTerms";
+ String FACET_EXCLUDETERMS = FACET + ".excludeTerms";
/**
* When faceting by enumerating the terms in a field, only use the
filterCache for terms with a df
* >= to this parameter.
*/
- public static final String FACET_ENUM_CACHE_MINDF = FACET +
".enum.cache.minDf";
+ String FACET_ENUM_CACHE_MINDF = FACET + ".enum.cache.minDf";
/**
* A boolean parameter that caps the facet counts at 1. With this set, a
returned count will only
* be 0 or 1. For apps that don't need the count, this should be an
optimization
*/
- public static final String FACET_EXISTS = FACET + ".exists";
+ String FACET_EXISTS = FACET + ".exists";
/**
* Any field whose terms the user wants to enumerate over for Facet
Contraint Counts (multi-value)
*/
- public static final String FACET_DATE = FACET + ".date";
+ String FACET_DATE = FACET + ".date";
/**
* Date string indicating the starting point for a date facet range. Can be
overridden on a per
* field basis.
*/
- public static final String FACET_DATE_START = FACET_DATE + ".start";
+ String FACET_DATE_START = FACET_DATE + ".start";
/**
* Date string indicating the ending point for a date facet range. Can be
overridden on a per
* field basis.
*/
- public static final String FACET_DATE_END = FACET_DATE + ".end";
+ String FACET_DATE_END = FACET_DATE + ".end";
/**
* Date Math string indicating the interval of sub-ranges for a date facet
range. Can be
* overridden on a per field basis.
*/
- public static final String FACET_DATE_GAP = FACET_DATE + ".gap";
+ String FACET_DATE_GAP = FACET_DATE + ".gap";
/**
* Boolean indicating how counts should be computed if the range between
'start' and 'end' is not
@@ -196,7 +196,7 @@ public interface FacetParams {
*
* <p>Can be overridden on a per field basis.
*/
- public static final String FACET_DATE_HARD_END = FACET_DATE + ".hardend";
+ String FACET_DATE_HARD_END = FACET_DATE + ".hardend";
/**
* String indicating what "other" ranges should be computed for a date facet
range (multi-value).
@@ -205,45 +205,45 @@ public interface FacetParams {
*
* @see FacetRangeOther
*/
- public static final String FACET_DATE_OTHER = FACET_DATE + ".other";
+ String FACET_DATE_OTHER = FACET_DATE + ".other";
/**
* Multivalued string indicating what rules should be applied to determine
when the ranges
* generated for date faceting should be inclusive or exclusive of their end
points.
*
* <p>The default value if none are specified is: [lower,upper,edge]
<i>(NOTE: This is different
- * then FACET_RANGE_INCLUDE)</i>
+ * from FACET_RANGE_INCLUDE)</i>
*
* <p>Can be overridden on a per field basis.
*
* @see FacetRangeInclude
* @see #FACET_RANGE_INCLUDE
*/
- public static final String FACET_DATE_INCLUDE = FACET_DATE + ".include";
+ String FACET_DATE_INCLUDE = FACET_DATE + ".include";
/**
* Any numerical field whose terms the user wants to enumerate over Facet
Constraint Counts for
* selected ranges.
*/
- public static final String FACET_RANGE = FACET + ".range";
+ String FACET_RANGE = FACET + ".range";
/**
* Number indicating the starting point for a numerical range facet. Can be
overridden on a per
* field basis.
*/
- public static final String FACET_RANGE_START = FACET_RANGE + ".start";
+ String FACET_RANGE_START = FACET_RANGE + ".start";
/**
* Number indicating the ending point for a numerical range facet. Can be
overridden on a per
* field basis.
*/
- public static final String FACET_RANGE_END = FACET_RANGE + ".end";
+ String FACET_RANGE_END = FACET_RANGE + ".end";
/**
* Number indicating the interval of sub-ranges for a numerical facet range.
Can be overridden on
* a per field basis.
*/
- public static final String FACET_RANGE_GAP = FACET_RANGE + ".gap";
+ String FACET_RANGE_GAP = FACET_RANGE + ".gap";
/**
* Boolean indicating how counts should be computed if the range between
'start' and 'end' is not
@@ -257,13 +257,13 @@ public interface FacetParams {
*
* <p>Can be overridden on a per field basis.
*/
- public static final String FACET_RANGE_HARD_END = FACET_RANGE + ".hardend";
+ String FACET_RANGE_HARD_END = FACET_RANGE + ".hardend";
/**
* String indicating what "other" ranges should be computed for a numerical
range facet
* (multi-value). Can be overridden on a per field basis.
*/
- public static final String FACET_RANGE_OTHER = FACET_RANGE + ".other";
+ String FACET_RANGE_OTHER = FACET_RANGE + ".other";
/**
* Multivalued string indicating what rules should be applied to determine
when the ranges
@@ -275,7 +275,7 @@ public interface FacetParams {
*
* @see FacetRangeInclude
*/
- public static final String FACET_RANGE_INCLUDE = FACET_RANGE + ".include";
+ String FACET_RANGE_INCLUDE = FACET_RANGE + ".include";
/**
* String indicating the method to use to resolve range facets.
@@ -284,23 +284,23 @@ public interface FacetParams {
*
* @see FacetRangeMethod
*/
- public static final String FACET_RANGE_METHOD = FACET_RANGE + ".method";
+ String FACET_RANGE_METHOD = FACET_RANGE + ".method";
/** Any field whose values the user wants to enumerate as explicit intervals
of terms. */
- public static final String FACET_INTERVAL = FACET + ".interval";
+ String FACET_INTERVAL = FACET + ".interval";
/** Set of terms for a single interval to facet on. */
- public static final String FACET_INTERVAL_SET = FACET_INTERVAL + ".set";
+ String FACET_INTERVAL_SET = FACET_INTERVAL + ".set";
/**
* A spatial RPT field to generate a 2D "heatmap" (grid of facet counts) on.
Just like the other
* faceting types, this may include a 'key' or local-params to facet
multiple times. All
* parameters with this suffix can be overridden on a per-field basis.
*/
- public static final String FACET_HEATMAP = "facet.heatmap";
+ String FACET_HEATMAP = "facet.heatmap";
/** The format of the heatmap: either png or ints2D (default). */
- public static final String FACET_HEATMAP_FORMAT = FACET_HEATMAP + ".format";
+ String FACET_HEATMAP_FORMAT = FACET_HEATMAP + ".format";
/**
* The region the heatmap should minimally enclose. It defaults to the world
if not set. The
@@ -311,12 +311,12 @@ public interface FacetParams {
* (the first is bottom-left and second is bottom-right, both of which are
parsed as points are
* parsed). OR, any WKT can be provided, and it's bounding box will be taken.
*/
- public static final String FACET_HEATMAP_GEOM = FACET_HEATMAP + ".geom";
+ String FACET_HEATMAP_GEOM = FACET_HEATMAP + ".geom";
/**
* Specify the heatmap grid level explicitly, instead of deriving it via
distErr or distErrPct.
*/
- public static final String FACET_HEATMAP_LEVEL = FACET_HEATMAP +
".gridLevel";
+ String FACET_HEATMAP_LEVEL = FACET_HEATMAP + ".gridLevel";
/**
* Used to determine the heatmap grid level to compute, defaulting to 0.15.
It has the same
@@ -324,7 +324,7 @@ public interface FacetParams {
* fraction (not a %) of the radius of the shape that grid squares must fit
into without
* exceeding. > 0 and <= 0.5. Mutually exclusive with distErr &
gridLevel.
*/
- public static final String FACET_HEATMAP_DIST_ERR_PCT = FACET_HEATMAP +
".distErrPct";
+ String FACET_HEATMAP_DIST_ERR_PCT = FACET_HEATMAP + ".distErrPct";
/**
* Used to determine the heatmap grid level to compute (optional). It has
the same interpretation
@@ -334,13 +334,13 @@ public interface FacetParams {
* grid levels translate to. This can in turn be used with knowledge of the
size of 'bbox' to get
* a target minimum number of grid cells. Mutually exclusive with distErrPct
& gridLevel.
*/
- public static final String FACET_HEATMAP_DIST_ERR = FACET_HEATMAP +
".distErr";
+ String FACET_HEATMAP_DIST_ERR = FACET_HEATMAP + ".distErr";
/**
* The maximum number of cells (grid squares) the client is willing to
handle. If this limit would
* be exceeded, we throw an error instead. Defaults to 100k.
*/
- public static final String FACET_HEATMAP_MAX_CELLS = FACET_HEATMAP +
".maxCells";
+ String FACET_HEATMAP_MAX_CELLS = FACET_HEATMAP + ".maxCells";
/**
* An enumeration of the legal values for {@link #FACET_RANGE_OTHER} and
{@link #FACET_DATE_OTHER}
@@ -357,7 +357,7 @@ public interface FacetParams {
* @see #FACET_RANGE_OTHER
* @see #FACET_DATE_OTHER
*/
- public enum FacetRangeOther {
+ enum FacetRangeOther {
BEFORE,
AFTER,
BETWEEN,
@@ -399,7 +399,7 @@ public interface FacetParams {
* @see #FACET_DATE_INCLUDE
* @see #FACET_RANGE_INCLUDE
*/
- public enum FacetRangeInclude {
+ enum FacetRangeInclude {
ALL,
LOWER,
UPPER,
@@ -454,7 +454,7 @@ public interface FacetParams {
*
* @see #FACET_RANGE_METHOD
*/
- public enum FacetRangeMethod {
+ enum FacetRangeMethod {
FILTER,
DV;
diff --git a/solr/solrj/src/java/org/apache/solr/common/params/GroupParams.java
b/solr/solrj/src/java/org/apache/solr/common/params/GroupParams.java
index 43d5380a7b4..14e1cc49d5f 100644
--- a/solr/solrj/src/java/org/apache/solr/common/params/GroupParams.java
+++ b/solr/solrj/src/java/org/apache/solr/common/params/GroupParams.java
@@ -18,31 +18,31 @@ package org.apache.solr.common.params;
/** Group parameters */
public interface GroupParams {
- public static final String GROUP = "group";
+ String GROUP = "group";
- public static final String GROUP_QUERY = GROUP + ".query";
- public static final String GROUP_FIELD = GROUP + ".field";
- public static final String GROUP_FUNC = GROUP + ".func";
- public static final String GROUP_SORT = GROUP + ".sort";
+ String GROUP_QUERY = GROUP + ".query";
+ String GROUP_FIELD = GROUP + ".field";
+ String GROUP_FUNC = GROUP + ".func";
+ String GROUP_SORT = GROUP + ".sort";
/** the limit for the number of documents in each group */
- public static final String GROUP_LIMIT = GROUP + ".limit";
+ String GROUP_LIMIT = GROUP + ".limit";
/** the offset for the doclist of each group */
- public static final String GROUP_OFFSET = GROUP + ".offset";
+ String GROUP_OFFSET = GROUP + ".offset";
/** treat the first group result as the main result. true/false */
- public static final String GROUP_MAIN = GROUP + ".main";
+ String GROUP_MAIN = GROUP + ".main";
/** treat the first group result as the main result. true/false */
- public static final String GROUP_FORMAT = GROUP + ".format";
+ String GROUP_FORMAT = GROUP + ".format";
/**
* Whether to cache the first pass search (doc ids and score) for the second
pass search. Also
* defines the maximum size of the group cache relative to maxdoc in a
percentage. Values can be a
* positive integer, from 0 till 100. A value of 0 will disable the group
cache. The default is 0.
*/
- public static final String GROUP_CACHE_PERCENTAGE = GROUP + ".cache.percent";
+ String GROUP_CACHE_PERCENTAGE = GROUP + ".cache.percent";
// Note: Since you can supply multiple fields to group on, but only have a
facets for the whole
// result. It only makes sense to me to support these parameters for the
first group.
@@ -51,22 +51,22 @@ public interface GroupParams {
* UNGROUPED) or on the groups (a.k.a. GROUPED). The docSet will only the
most relevant documents
* per group. It is if you query for everything with group.limit=1
*/
- public static final String GROUP_TRUNCATE = GROUP + ".truncate";
+ String GROUP_TRUNCATE = GROUP + ".truncate";
/** Whether the group count should be included in the response. */
- public static final String GROUP_TOTAL_COUNT = GROUP + ".ngroups";
+ String GROUP_TOTAL_COUNT = GROUP + ".ngroups";
/** Whether to compute grouped facets based on the first specified group. */
- public static final String GROUP_FACET = GROUP + ".facet";
+ String GROUP_FACET = GROUP + ".facet";
/** Retrieve the top search groups (top group values) from the shards being
queried. */
- public static final String GROUP_DISTRIBUTED_FIRST = GROUP +
".distributed.first";
+ String GROUP_DISTRIBUTED_FIRST = GROUP + ".distributed.first";
/**
* Retrieve the top groups from the shards being queries based on the
specified search groups in
* the {@link #GROUP_DISTRIBUTED_TOPGROUPS_PREFIX} parameters.
*/
- public static final String GROUP_DISTRIBUTED_SECOND = GROUP +
".distributed.second";
+ String GROUP_DISTRIBUTED_SECOND = GROUP + ".distributed.second";
- public static final String GROUP_DISTRIBUTED_TOPGROUPS_PREFIX = GROUP +
".topgroups.";
+ String GROUP_DISTRIBUTED_TOPGROUPS_PREFIX = GROUP + ".topgroups.";
}
diff --git
a/solr/solrj/src/java/org/apache/solr/common/params/HighlightParams.java
b/solr/solrj/src/java/org/apache/solr/common/params/HighlightParams.java
index e0ce04b08f2..42625a605d3 100644
--- a/solr/solrj/src/java/org/apache/solr/common/params/HighlightParams.java
+++ b/solr/solrj/src/java/org/apache/solr/common/params/HighlightParams.java
@@ -21,10 +21,10 @@ package org.apache.solr.common.params;
*/
public interface HighlightParams {
// primary
- public static final String HIGHLIGHT = "hl";
- public static final String METHOD = HIGHLIGHT + ".method"; //
original|fastVector|postings|unified
- public static final String FIELDS = HIGHLIGHT + ".fl";
- public static final String SNIPPETS = HIGHLIGHT + ".snippets";
+ String HIGHLIGHT = "hl";
+ String METHOD = HIGHLIGHT + ".method"; //
original|fastVector|postings|unified
+ String FIELDS = HIGHLIGHT + ".fl";
+ String SNIPPETS = HIGHLIGHT + ".snippets";
// KEY:
// OH = (original) Highlighter (AKA the standard Highlighter)
@@ -32,71 +32,66 @@ public interface HighlightParams {
// UH = UnifiedHighlighter (evolved from PostingsHighlighter)
// query interpretation
- public static final String Q = HIGHLIGHT + ".q"; // all
- public static final String QPARSER = HIGHLIGHT + ".qparser"; // all
- public static final String FIELD_MATCH = HIGHLIGHT + ".requireFieldMatch";
// OH, FVH, UH
- public static final String QUERY_FIELD_PATTERN = HIGHLIGHT +
".queryFieldPattern"; // UH
- public static final String USE_PHRASE_HIGHLIGHTER =
- HIGHLIGHT + ".usePhraseHighlighter"; // OH, FVH, UH
- public static final String HIGHLIGHT_MULTI_TERM = HIGHLIGHT +
".highlightMultiTerm"; // all
+ String Q = HIGHLIGHT + ".q"; // all
+ String QPARSER = HIGHLIGHT + ".qparser"; // all
+ String FIELD_MATCH = HIGHLIGHT + ".requireFieldMatch"; // OH, FVH, UH
+ String QUERY_FIELD_PATTERN = HIGHLIGHT + ".queryFieldPattern"; // UH
+ String USE_PHRASE_HIGHLIGHTER = HIGHLIGHT + ".usePhraseHighlighter"; // OH,
FVH, UH
+ String HIGHLIGHT_MULTI_TERM = HIGHLIGHT + ".highlightMultiTerm"; // all
// if no snippets...
- public static final String DEFAULT_SUMMARY = HIGHLIGHT + ".defaultSummary";
// UH
- public static final String ALTERNATE_FIELD = HIGHLIGHT + ".alternateField";
// OH, FVH
- public static final String ALTERNATE_FIELD_LENGTH =
- HIGHLIGHT + ".maxAlternateFieldLength"; // OH, FVH
- public static final String HIGHLIGHT_ALTERNATE = HIGHLIGHT +
".highlightAlternate"; // OH, FVH
+ String DEFAULT_SUMMARY = HIGHLIGHT + ".defaultSummary"; // UH
+ String ALTERNATE_FIELD = HIGHLIGHT + ".alternateField"; // OH, FVH
+ String ALTERNATE_FIELD_LENGTH = HIGHLIGHT + ".maxAlternateFieldLength"; //
OH, FVH
+ String HIGHLIGHT_ALTERNATE = HIGHLIGHT + ".highlightAlternate"; // OH, FVH
// sizing
- public static final String FRAGSIZE = HIGHLIGHT + ".fragsize"; // OH, FVH, UH
- public static final String FRAGSIZEISMINIMUM = HIGHLIGHT +
".fragsizeIsMinimum"; // UH
- public static final String FRAGALIGNRATIO = HIGHLIGHT + ".fragAlignRatio";
// UH
- public static final String FRAGMENTER = HIGHLIGHT + ".fragmenter"; // OH
- public static final String INCREMENT = HIGHLIGHT + ".increment"; // OH
- public static final String REGEX = "regex"; // OH
- public static final String SLOP = HIGHLIGHT + "." + REGEX + ".slop"; // OH
- public static final String PATTERN = HIGHLIGHT + "." + REGEX + ".pattern";
// OH
- public static final String MAX_RE_CHARS = HIGHLIGHT + "." + REGEX +
".maxAnalyzedChars"; // OH
- public static final String BOUNDARY_SCANNER = HIGHLIGHT +
".boundaryScanner"; // FVH
- public static final String BS_MAX_SCAN = HIGHLIGHT + ".bs.maxScan"; // FVH
- public static final String BS_CHARS = HIGHLIGHT + ".bs.chars"; // FVH
- public static final String BS_TYPE = HIGHLIGHT + ".bs.type"; // FVH, UH
- public static final String BS_LANGUAGE = HIGHLIGHT + ".bs.language"; // FVH,
UH
- public static final String BS_COUNTRY = HIGHLIGHT + ".bs.country"; // FVH, UH
- public static final String BS_VARIANT = HIGHLIGHT + ".bs.variant"; // FVH, UH
- public static final String BS_SEP = HIGHLIGHT + ".bs.separator"; // UH
+ String FRAGSIZE = HIGHLIGHT + ".fragsize"; // OH, FVH, UH
+ String FRAGSIZEISMINIMUM = HIGHLIGHT + ".fragsizeIsMinimum"; // UH
+ String FRAGALIGNRATIO = HIGHLIGHT + ".fragAlignRatio"; // UH
+ String FRAGMENTER = HIGHLIGHT + ".fragmenter"; // OH
+ String INCREMENT = HIGHLIGHT + ".increment"; // OH
+ String REGEX = "regex"; // OH
+ String SLOP = HIGHLIGHT + "." + REGEX + ".slop"; // OH
+ String PATTERN = HIGHLIGHT + "." + REGEX + ".pattern"; // OH
+ String MAX_RE_CHARS = HIGHLIGHT + "." + REGEX + ".maxAnalyzedChars"; // OH
+ String BOUNDARY_SCANNER = HIGHLIGHT + ".boundaryScanner"; // FVH
+ String BS_MAX_SCAN = HIGHLIGHT + ".bs.maxScan"; // FVH
+ String BS_CHARS = HIGHLIGHT + ".bs.chars"; // FVH
+ String BS_TYPE = HIGHLIGHT + ".bs.type"; // FVH, UH
+ String BS_LANGUAGE = HIGHLIGHT + ".bs.language"; // FVH, UH
+ String BS_COUNTRY = HIGHLIGHT + ".bs.country"; // FVH, UH
+ String BS_VARIANT = HIGHLIGHT + ".bs.variant"; // FVH, UH
+ String BS_SEP = HIGHLIGHT + ".bs.separator"; // UH
// formatting
- public static final String FORMATTER = HIGHLIGHT + ".formatter"; // OH
- public static final String ENCODER = HIGHLIGHT + ".encoder"; // all
- public static final String MERGE_CONTIGUOUS_FRAGMENTS = HIGHLIGHT +
".mergeContiguous"; // OH
- public static final String SIMPLE = "simple"; // OH
- public static final String SIMPLE_PRE = HIGHLIGHT + "." + SIMPLE + ".pre";
// OH
- public static final String SIMPLE_POST = HIGHLIGHT + "." + SIMPLE + ".post";
// OH
- public static final String FRAGMENTS_BUILDER = HIGHLIGHT +
".fragmentsBuilder"; // FVH
- public static final String TAG_PRE = HIGHLIGHT + ".tag.pre"; // FVH, UH
- public static final String TAG_POST = HIGHLIGHT + ".tag.post"; // FVH, UH
- public static final String TAG_ELLIPSIS = HIGHLIGHT + ".tag.ellipsis"; //
FVH, UH
- public static final String MULTI_VALUED_SEPARATOR =
- HIGHLIGHT + ".multiValuedSeparatorChar"; // FVH
+ String FORMATTER = HIGHLIGHT + ".formatter"; // OH
+ String ENCODER = HIGHLIGHT + ".encoder"; // all
+ String MERGE_CONTIGUOUS_FRAGMENTS = HIGHLIGHT + ".mergeContiguous"; // OH
+ String SIMPLE = "simple"; // OH
+ String SIMPLE_PRE = HIGHLIGHT + "." + SIMPLE + ".pre"; // OH
+ String SIMPLE_POST = HIGHLIGHT + "." + SIMPLE + ".post"; // OH
+ String FRAGMENTS_BUILDER = HIGHLIGHT + ".fragmentsBuilder"; // FVH
+ String TAG_PRE = HIGHLIGHT + ".tag.pre"; // FVH, UH
+ String TAG_POST = HIGHLIGHT + ".tag.post"; // FVH, UH
+ String TAG_ELLIPSIS = HIGHLIGHT + ".tag.ellipsis"; // FVH, UH
+ String MULTI_VALUED_SEPARATOR = HIGHLIGHT + ".multiValuedSeparatorChar"; //
FVH
// ordering
- public static final String PRESERVE_MULTI = HIGHLIGHT + ".preserveMulti"; //
OH
- public static final String FRAG_LIST_BUILDER = HIGHLIGHT +
".fragListBuilder"; // FVH
- public static final String SCORE = "score"; // UH
- public static final String SCORE_K1 = HIGHLIGHT + "." + SCORE + ".k1"; // UH
- public static final String SCORE_B = HIGHLIGHT + "." + SCORE + ".b"; // UH
- public static final String SCORE_PIVOT = HIGHLIGHT + "." + SCORE + ".pivot";
// UH
+ String PRESERVE_MULTI = HIGHLIGHT + ".preserveMulti"; // OH
+ String FRAG_LIST_BUILDER = HIGHLIGHT + ".fragListBuilder"; // FVH
+ String SCORE = "score"; // UH
+ String SCORE_K1 = HIGHLIGHT + "." + SCORE + ".k1"; // UH
+ String SCORE_B = HIGHLIGHT + "." + SCORE + ".b"; // UH
+ String SCORE_PIVOT = HIGHLIGHT + "." + SCORE + ".pivot"; // UH
// misc
- public static final String MAX_CHARS = HIGHLIGHT + ".maxAnalyzedChars"; //
all
- public static final String PAYLOADS = HIGHLIGHT + ".payloads"; // OH
- public static final String MAX_MULTIVALUED_TO_EXAMINE =
- HIGHLIGHT + ".maxMultiValuedToExamine"; // OH
- public static final String MAX_MULTIVALUED_TO_MATCH = HIGHLIGHT +
".maxMultiValuedToMatch"; // OH
- public static final String PHRASE_LIMIT = HIGHLIGHT + ".phraseLimit"; // FVH
- public static final String OFFSET_SOURCE = HIGHLIGHT + ".offsetSource"; // UH
- public static final String CACHE_FIELD_VAL_CHARS_THRESHOLD =
- HIGHLIGHT + ".cacheFieldValCharsThreshold"; // UH
- public static final String WEIGHT_MATCHES = HIGHLIGHT + ".weightMatches"; //
UH
+ String MAX_CHARS = HIGHLIGHT + ".maxAnalyzedChars"; // all
+ String PAYLOADS = HIGHLIGHT + ".payloads"; // OH
+ String MAX_MULTIVALUED_TO_EXAMINE = HIGHLIGHT + ".maxMultiValuedToExamine";
// OH
+ String MAX_MULTIVALUED_TO_MATCH = HIGHLIGHT + ".maxMultiValuedToMatch"; // OH
+ String PHRASE_LIMIT = HIGHLIGHT + ".phraseLimit"; // FVH
+ String OFFSET_SOURCE = HIGHLIGHT + ".offsetSource"; // UH
+ String CACHE_FIELD_VAL_CHARS_THRESHOLD = HIGHLIGHT +
".cacheFieldValCharsThreshold"; // UH
+ String WEIGHT_MATCHES = HIGHLIGHT + ".weightMatches"; // UH
}
diff --git
a/solr/solrj/src/java/org/apache/solr/common/params/MoreLikeThisParams.java
b/solr/solrj/src/java/org/apache/solr/common/params/MoreLikeThisParams.java
index 8c98012e368..72901c28a3f 100644
--- a/solr/solrj/src/java/org/apache/solr/common/params/MoreLikeThisParams.java
+++ b/solr/solrj/src/java/org/apache/solr/common/params/MoreLikeThisParams.java
@@ -20,39 +20,38 @@ import java.util.Locale;
/** Params for {@code MoreLikeThisHandler}. */
public interface MoreLikeThisParams {
- public static final String MLT = "mlt";
+ String MLT = "mlt";
- public static final String PREFIX = "mlt.";
+ String PREFIX = "mlt.";
- public static final String SIMILARITY_FIELDS = PREFIX + "fl";
- public static final String MIN_TERM_FREQ = PREFIX + "mintf";
- public static final String MAX_DOC_FREQ = PREFIX + "maxdf";
- public static final String MAX_DOC_FREQ_PCT = PREFIX + "maxdfpct";
- public static final String MIN_DOC_FREQ = PREFIX + "mindf";
- public static final String MIN_WORD_LEN = PREFIX + "minwl";
- public static final String MAX_WORD_LEN = PREFIX + "maxwl";
- public static final String MAX_QUERY_TERMS = PREFIX + "maxqt";
- public static final String MAX_NUM_TOKENS_PARSED = PREFIX + "maxntp";
- public static final String BOOST = PREFIX + "boost"; // boost or not?
- public static final String QF = PREFIX + "qf"; // boosting applied to mlt
fields
+ String SIMILARITY_FIELDS = PREFIX + "fl";
+ String MIN_TERM_FREQ = PREFIX + "mintf";
+ String MAX_DOC_FREQ = PREFIX + "maxdf";
+ String MAX_DOC_FREQ_PCT = PREFIX + "maxdfpct";
+ String MIN_DOC_FREQ = PREFIX + "mindf";
+ String MIN_WORD_LEN = PREFIX + "minwl";
+ String MAX_WORD_LEN = PREFIX + "maxwl";
+ String MAX_QUERY_TERMS = PREFIX + "maxqt";
+ String MAX_NUM_TOKENS_PARSED = PREFIX + "maxntp";
+ String BOOST = PREFIX + "boost"; // boost or not?
+ String QF = PREFIX + "qf"; // boosting applied to mlt fields
// the /mlt request handler uses 'rows'
- public static final String DOC_COUNT = PREFIX + "count";
+ String DOC_COUNT = PREFIX + "count";
// Do you want to include the original document in the results or not
- public static final String MATCH_INCLUDE = PREFIX + "match.include";
+ String MATCH_INCLUDE = PREFIX + "match.include";
// If multiple docs are matched in the query, what offset do you want?
- public static final String MATCH_OFFSET = PREFIX + "match.offset";
+ String MATCH_OFFSET = PREFIX + "match.offset";
// Do you want to include the original document in the results or not
- public static final String INTERESTING_TERMS =
- PREFIX + "interestingTerms"; // false,details,(list or true)
+ String INTERESTING_TERMS = PREFIX + "interestingTerms"; //
false,details,(list or true)
// the default doc count
- public static final int DEFAULT_DOC_COUNT = 5;
+ int DEFAULT_DOC_COUNT = 5;
- public enum TermStyle {
+ enum TermStyle {
NONE,
LIST,
DETAILS;
diff --git
a/solr/solrj/src/java/org/apache/solr/common/params/SimpleParams.java
b/solr/solrj/src/java/org/apache/solr/common/params/SimpleParams.java
index a921d251aca..6d9d5651cbd 100644
--- a/solr/solrj/src/java/org/apache/solr/common/params/SimpleParams.java
+++ b/solr/solrj/src/java/org/apache/solr/common/params/SimpleParams.java
@@ -19,38 +19,38 @@ package org.apache.solr.common.params;
/** Parameters used by the SimpleQParser. */
public interface SimpleParams {
/** Query fields and boosts. */
- public static String QF = "qf";
+ String QF = "qf";
/** Override the currently enabled/disabled query operators. */
- public static String QO = "q.operators";
+ String QO = "q.operators";
/** Enables {@code AND} operator (+) */
- public static final String AND_OPERATOR = "AND";
+ String AND_OPERATOR = "AND";
/** Enables {@code NOT} operator (-) */
- public static final String NOT_OPERATOR = "NOT";
+ String NOT_OPERATOR = "NOT";
/** Enables {@code OR} operator (|) */
- public static final String OR_OPERATOR = "OR";
+ String OR_OPERATOR = "OR";
/** Enables {@code PREFIX} operator (*) */
- public static final String PREFIX_OPERATOR = "PREFIX";
+ String PREFIX_OPERATOR = "PREFIX";
/** Enables {@code PHRASE} operator (") */
- public static final String PHRASE_OPERATOR = "PHRASE";
+ String PHRASE_OPERATOR = "PHRASE";
/** Enables {@code PRECEDENCE} operators: {@code (} and {@code )} */
- public static final String PRECEDENCE_OPERATORS = "PRECEDENCE";
+ String PRECEDENCE_OPERATORS = "PRECEDENCE";
/** Enables {@code ESCAPE} operator (\) */
- public static final String ESCAPE_OPERATOR = "ESCAPE";
+ String ESCAPE_OPERATOR = "ESCAPE";
/** Enables {@code WHITESPACE} operators: ' ' '\n' '\r' '\t' */
- public static final String WHITESPACE_OPERATOR = "WHITESPACE";
+ String WHITESPACE_OPERATOR = "WHITESPACE";
/** Enables {@code FUZZY} operator (~) */
- public static final String FUZZY_OPERATOR = "FUZZY";
+ String FUZZY_OPERATOR = "FUZZY";
/** Enables {@code NEAR} operator (~) */
- public static final String NEAR_OPERATOR = "NEAR";
+ String NEAR_OPERATOR = "NEAR";
}
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 e06cc4cd7cb..0f0e0f59676 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
@@ -193,23 +193,12 @@ public abstract class SolrParams
* Returns the Boolean value of the field param, or the value for param, or
null if neither is
* set. Use this method only when you want to be explicit about absence of a
value (<code>null
* </code>) vs the default value <code>false</code>.
- *
- * @see #getFieldBool(String, String, boolean)
- * @see #getPrimitiveFieldBool(String, String)
*/
public Boolean getFieldBool(String field, String param) {
String val = getFieldParam(field, param);
return val == null ? null : StrUtils.parseBool(val);
}
- /**
- * Returns the boolean value of the field param, or the value for param or
the default value of
- * boolean - <code>false</code>
- */
- public boolean getPrimitiveFieldBool(String field, String param) {
- return getFieldBool(field, param, false);
- }
-
/**
* Returns the boolean value of the field param, or the value for param, or
def if neither is set.
*/
@@ -360,7 +349,6 @@ public abstract class SolrParams
* about absence of a value (<code>null</code>) vs the default value zero
(<code>0.0f</code>).
*
* @see #getFieldFloat(String, String, float)
- * @see #getPrimitiveFieldFloat(String, String)
*/
public Float getFieldFloat(String field, String param) {
String val = getFieldParam(field, param);
@@ -371,14 +359,6 @@ public abstract class SolrParams
}
}
- /**
- * Returns the float value of the field param or the value for param or the
default value for
- * float - zero (<code>0.0f</code>)
- */
- public float getPrimitiveFieldFloat(String field, String param) {
- return getFieldFloat(field, param, 0.0f);
- }
-
/**
* Returns the float value of the field param, or the value for param, or
def if neither is set.
*/
diff --git
a/solr/solrj/src/java/org/apache/solr/common/params/SpatialParams.java
b/solr/solrj/src/java/org/apache/solr/common/params/SpatialParams.java
index 9fdbe175d61..32980b6014a 100644
--- a/solr/solrj/src/java/org/apache/solr/common/params/SpatialParams.java
+++ b/solr/solrj/src/java/org/apache/solr/common/params/SpatialParams.java
@@ -18,17 +18,17 @@ package org.apache.solr.common.params;
/** */
public interface SpatialParams {
- public static final String POINT = "pt";
- public static final String DISTANCE = "d";
+ String POINT = "pt";
+ String DISTANCE = "d";
// the field that contains the points we are measuring from "pt"
- public static final String FIELD = "sfield";
+ String FIELD = "sfield";
/** km - kilometers mi - miles */
- public static final String UNITS = "units";
+ String UNITS = "units";
/** The distance measure to use. */
- public static final String MEASURE = "meas";
+ String MEASURE = "meas";
/** The radius of the sphere to use to in calculating spherical distances
like Haversine */
- public static final String SPHERE_RADIUS = "sphere_radius";
+ String SPHERE_RADIUS = "sphere_radius";
}
diff --git
a/solr/solrj/src/java/org/apache/solr/common/params/SpellingParams.java
b/solr/solrj/src/java/org/apache/solr/common/params/SpellingParams.java
index db03b003098..aff99191cf6 100644
--- a/solr/solrj/src/java/org/apache/solr/common/params/SpellingParams.java
+++ b/solr/solrj/src/java/org/apache/solr/common/params/SpellingParams.java
@@ -23,13 +23,13 @@ package org.apache.solr.common.params;
*/
public interface SpellingParams {
- public static final String SPELLCHECK_PREFIX = "spellcheck.";
+ String SPELLCHECK_PREFIX = "spellcheck.";
/**
* The name of the dictionary to be used for giving the suggestion for a
request. The value for
* this parameter is configured in solrconfig.xml
*/
- public static final String SPELLCHECK_DICT = SPELLCHECK_PREFIX +
"dictionary";
+ String SPELLCHECK_DICT = SPELLCHECK_PREFIX + "dictionary";
/**
* The count of suggestions to return for each query term not in the index
and/or dictionary.
@@ -37,7 +37,7 @@ public interface SpellingParams {
* <p>If this parameter is absent in the request then only one suggestion is
returned. If it is
* more than one then a maximum of given suggestions are returned for each
token in the query.
*/
- public static final String SPELLCHECK_COUNT = SPELLCHECK_PREFIX + "count";
+ String SPELLCHECK_COUNT = SPELLCHECK_PREFIX + "count";
/**
* The count of suggestions to return for each query term existing in the
index and/or dictionary.
@@ -45,8 +45,7 @@ public interface SpellingParams {
* <p>If this parameter is absent in the request then no suggestions are
generated. This parameter
* allows for receiving alternative terms to use in context-sensitive
spelling corrections.
*/
- public static final String SPELLCHECK_ALTERNATIVE_TERM_COUNT =
- SPELLCHECK_PREFIX + "alternativeTermCount";
+ String SPELLCHECK_ALTERNATIVE_TERM_COUNT = SPELLCHECK_PREFIX +
"alternativeTermCount";
/**
* The maximum number of hits the request can return in order to both
generate spelling
@@ -65,16 +64,14 @@ public interface SpellingParams {
* zero is useful for creating "did-you-mean" suggestions for queries that
return a low number of
* hits.
*/
- public static final String SPELLCHECK_MAX_RESULTS_FOR_SUGGEST =
- SPELLCHECK_PREFIX + "maxResultsForSuggest";
+ String SPELLCHECK_MAX_RESULTS_FOR_SUGGEST = SPELLCHECK_PREFIX +
"maxResultsForSuggest";
/**
* To be used when {@link SpellingParams#SPELLCHECK_MAX_RESULTS_FOR_SUGGEST}
is expressed as a
* fractional percentage. Specify a filter query whose result count is used
to determine the
* maximum number of documents.
*/
- public static final String SPELLCHECK_MAX_RESULTS_FOR_SUGGEST_FQ =
- SPELLCHECK_MAX_RESULTS_FOR_SUGGEST + ".fq";
+ String SPELLCHECK_MAX_RESULTS_FOR_SUGGEST_FQ =
SPELLCHECK_MAX_RESULTS_FOR_SUGGEST + ".fq";
/**
* When this parameter is set to true and the misspelled word exists in the
user field, only words
@@ -83,7 +80,7 @@ public interface SpellingParams {
*
* <p><b>This is applicable only for dictionaries built from Solr fields.</b>
*/
- public static final String SPELLCHECK_ONLY_MORE_POPULAR = SPELLCHECK_PREFIX
+ "onlyMorePopular";
+ String SPELLCHECK_ONLY_MORE_POPULAR = SPELLCHECK_PREFIX + "onlyMorePopular";
/**
* Whether to use the extended response format, which is more complicated
but richer. Returns the
@@ -92,29 +89,29 @@ public interface SpellingParams {
*
* <p><b>This is applicable only for dictionaries built from Solr fields.</b>
*/
- public static final String SPELLCHECK_EXTENDED_RESULTS = SPELLCHECK_PREFIX +
"extendedResults";
+ String SPELLCHECK_EXTENDED_RESULTS = SPELLCHECK_PREFIX + "extendedResults";
/**
* Use the value for this parameter as the query to spell check.
*
* <p>This parameter is <b>optional</b>. If absent, then the q parameter is
used.
*/
- public static final String SPELLCHECK_Q = SPELLCHECK_PREFIX + "q";
+ String SPELLCHECK_Q = SPELLCHECK_PREFIX + "q";
/** Whether to build the index or not. Optional and false by default. */
- public static final String SPELLCHECK_BUILD = SPELLCHECK_PREFIX + "build";
+ String SPELLCHECK_BUILD = SPELLCHECK_PREFIX + "build";
/** Whether to reload the index. Optional and false by default. */
- public static final String SPELLCHECK_RELOAD = SPELLCHECK_PREFIX + "reload";
+ String SPELLCHECK_RELOAD = SPELLCHECK_PREFIX + "reload";
/** Take the top suggestion for each token and create a new query from it */
- public static final String SPELLCHECK_COLLATE = SPELLCHECK_PREFIX +
"collate";
+ String SPELLCHECK_COLLATE = SPELLCHECK_PREFIX + "collate";
/**
* The maximum number of collations to return. Default=1. Ignored if
"spellcheck.collate" is
* false.
*/
- public static final String SPELLCHECK_MAX_COLLATIONS = SPELLCHECK_PREFIX +
"maxCollations";
+ String SPELLCHECK_MAX_COLLATIONS = SPELLCHECK_PREFIX + "maxCollations";
/**
* The maximum number of collations to test by querying against the index.
When testing, the
@@ -122,16 +119,14 @@ public interface SpellingParams {
* set to zero, does not test for hits before returning collations (returned
collations may result
* in zero hits). Default=0. Ignored of "spellcheck.collate" is false.
*/
- public static final String SPELLCHECK_MAX_COLLATION_TRIES =
- SPELLCHECK_PREFIX + "maxCollationTries";
+ String SPELLCHECK_MAX_COLLATION_TRIES = SPELLCHECK_PREFIX +
"maxCollationTries";
/**
* The maximum number of word correction combinations to rank and evaluate
prior to deciding which
* collation candidates to test against the index. This is a performance
safety-net in cases a
* user enters a query with many misspelled words. The default is 10,000
combinations.
*/
- public static final String SPELLCHECK_MAX_COLLATION_EVALUATIONS =
- SPELLCHECK_PREFIX + "maxCollationEvaluations";
+ String SPELLCHECK_MAX_COLLATION_EVALUATIONS = SPELLCHECK_PREFIX +
"maxCollationEvaluations";
/**
* For use with {@link SpellingParams#SPELLCHECK_MAX_COLLATION_TRIES} and
{@link
@@ -146,8 +141,7 @@ public interface SpellingParams {
* SpellingParams#SPELLCHECK_COLLATE_EXTENDED_RESULTS} is FALSE, this
optimization is always
* performed.
*/
- public static final String SPELLCHECK_COLLATE_MAX_COLLECT_DOCS =
- SPELLCHECK_PREFIX + "collateMaxCollectDocs";
+ String SPELLCHECK_COLLATE_MAX_COLLECT_DOCS = SPELLCHECK_PREFIX +
"collateMaxCollectDocs";
/**
* Whether to use the Extended Results Format for collations. Includes
"before>after" pairs to
@@ -158,8 +152,7 @@ public interface SpellingParams {
* <p>Note: that if {@link
SpellingParams#SPELLCHECK_COLLATE_MAX_COLLECT_DOCS} is set to a value
* greater than 0, then the hit counts returned by this will be estimated.
*/
- public static final String SPELLCHECK_COLLATE_EXTENDED_RESULTS =
- SPELLCHECK_PREFIX + "collateExtendedResults";
+ String SPELLCHECK_COLLATE_EXTENDED_RESULTS = SPELLCHECK_PREFIX +
"collateExtendedResults";
/**
* For use with {@link SpellingParams#SPELLCHECK_MAX_COLLATION_TRIES}, use
this to override any
@@ -167,9 +160,8 @@ public interface SpellingParams {
* "mm=1" but it is preferred to test collations with "mm=100%", then use
* "spellcheck.collateParam.mm=100%".
*/
- public static final String SPELLCHECK_COLLATE_PARAM_OVERRIDE =
- SPELLCHECK_PREFIX + "collateParam.";
+ String SPELLCHECK_COLLATE_PARAM_OVERRIDE = SPELLCHECK_PREFIX +
"collateParam.";
/** Certain spelling implementations may allow for an accuracy setting. */
- public static final String SPELLCHECK_ACCURACY = SPELLCHECK_PREFIX +
"accuracy";
+ String SPELLCHECK_ACCURACY = SPELLCHECK_PREFIX + "accuracy";
}
diff --git a/solr/solrj/src/java/org/apache/solr/common/params/StatsParams.java
b/solr/solrj/src/java/org/apache/solr/common/params/StatsParams.java
index 0c747e9f338..8b1031532f0 100644
--- a/solr/solrj/src/java/org/apache/solr/common/params/StatsParams.java
+++ b/solr/solrj/src/java/org/apache/solr/common/params/StatsParams.java
@@ -18,8 +18,8 @@ package org.apache.solr.common.params;
/** Stats Parameters */
public interface StatsParams {
- public static final String STATS = "stats";
- public static final String STATS_FIELD = STATS + ".field";
- public static final String STATS_FACET = STATS + ".facet";
- public static final String STATS_CALC_DISTINCT = STATS + ".calcdistinct";
+ String STATS = "stats";
+ String STATS_FIELD = STATS + ".field";
+ String STATS_FACET = STATS + ".facet";
+ String STATS_CALC_DISTINCT = STATS + ".calcdistinct";
}
diff --git
a/solr/solrj/src/java/org/apache/solr/common/params/TermVectorParams.java
b/solr/solrj/src/java/org/apache/solr/common/params/TermVectorParams.java
index a26ba14d970..aacc82b911e 100644
--- a/solr/solrj/src/java/org/apache/solr/common/params/TermVectorParams.java
+++ b/solr/solrj/src/java/org/apache/solr/common/params/TermVectorParams.java
@@ -19,32 +19,32 @@ package org.apache.solr.common.params;
/** */
public interface TermVectorParams {
- public static final String TV_PREFIX = "tv.";
+ String TV_PREFIX = "tv.";
/** Return Term Frequency info */
- public static final String TF = TV_PREFIX + "tf";
+ String TF = TV_PREFIX + "tf";
/** Return Term Vector position information */
- public static final String POSITIONS = TV_PREFIX + "positions";
+ String POSITIONS = TV_PREFIX + "positions";
/** Return Term Vector payloads information */
- public static final String PAYLOADS = TV_PREFIX + "payloads";
+ String PAYLOADS = TV_PREFIX + "payloads";
/** Return offset information, if available */
- public static final String OFFSETS = TV_PREFIX + "offsets";
+ String OFFSETS = TV_PREFIX + "offsets";
/** Return IDF information. May be expensive */
- public static final String DF = TV_PREFIX + "df";
+ String DF = TV_PREFIX + "df";
/** Return TF-IDF calculation, i.e. (tf / idf). May be expensive. */
- public static final String TF_IDF = TV_PREFIX + "tf_idf";
+ String TF_IDF = TV_PREFIX + "tf_idf";
/** Return all the options: TF, positions, offsets, idf */
- public static final String ALL = TV_PREFIX + "all";
+ String ALL = TV_PREFIX + "all";
/** The fields to get term vectors for */
- public static final String FIELDS = TV_PREFIX + "fl";
+ String FIELDS = TV_PREFIX + "fl";
/** The Doc Ids (Lucene internal ids) of the docs to get the term vectors
for */
- public static final String DOC_IDS = TV_PREFIX + "docIds";
+ String DOC_IDS = TV_PREFIX + "docIds";
}
diff --git a/solr/solrj/src/java/org/apache/solr/common/params/TermsParams.java
b/solr/solrj/src/java/org/apache/solr/common/params/TermsParams.java
index d9dc41d1f4a..ad6f5fbd8a4 100644
--- a/solr/solrj/src/java/org/apache/solr/common/params/TermsParams.java
+++ b/solr/solrj/src/java/org/apache/solr/common/params/TermsParams.java
@@ -23,22 +23,22 @@ import java.util.regex.Pattern;
/** */
public interface TermsParams {
/** The component name. Set to true to turn on the TermsComponent */
- public static final String TERMS = "terms";
+ String TERMS = "terms";
/** Used for building up the other terms */
- public static final String TERMS_PREFIX = TERMS + ".";
+ String TERMS_PREFIX = TERMS + ".";
/** Required. Specify the field to look up terms in. */
- public static final String TERMS_FIELD = TERMS_PREFIX + "fl";
+ String TERMS_FIELD = TERMS_PREFIX + "fl";
/** Optional. The list of terms to be retrieved. */
- public static final String TERMS_LIST = TERMS_PREFIX + "list";
+ String TERMS_LIST = TERMS_PREFIX + "list";
/** Optional. If true, also returns index-level statistics, such as numDocs.
*/
- public static final String TERMS_STATS = TERMS_PREFIX + "stats";
+ String TERMS_STATS = TERMS_PREFIX + "stats";
/** Optional. If true, also returns terms' total term frequency. */
- public static final String TERMS_TTF = TERMS_PREFIX + "ttf";
+ String TERMS_TTF = TERMS_PREFIX + "ttf";
/**
* Optional. The lower bound term to start at. The TermEnum will start at
the next term after this
@@ -46,36 +46,36 @@ public interface TermsParams {
*
* <p>If not specified, the empty string is used
*/
- public static final String TERMS_LOWER = TERMS_PREFIX + "lower";
+ String TERMS_LOWER = TERMS_PREFIX + "lower";
/**
* Optional. The term to stop at.
*
* @see #TERMS_UPPER_INCLUSIVE
*/
- public static final String TERMS_UPPER = TERMS_PREFIX + "upper";
+ String TERMS_UPPER = TERMS_PREFIX + "upper";
/** Optional. If true, include the upper bound term in the results. False by
default. */
- public static final String TERMS_UPPER_INCLUSIVE = TERMS_PREFIX +
"upper.incl";
+ String TERMS_UPPER_INCLUSIVE = TERMS_PREFIX + "upper.incl";
/**
* Optional. If true, include the lower bound term in the results, otherwise
skip to the next one.
* True by default.
*/
- public static final String TERMS_LOWER_INCLUSIVE = TERMS_PREFIX +
"lower.incl";
+ String TERMS_LOWER_INCLUSIVE = TERMS_PREFIX + "lower.incl";
/**
* Optional. The number of results to return. If not specified, looks for
{@link
* org.apache.solr.common.params.CommonParams#ROWS}. If that's not
specified, uses {@link
* org.apache.solr.common.params.CommonParams#ROWS_DEFAULT}.
*/
- public static final String TERMS_LIMIT = TERMS_PREFIX + "limit";
+ String TERMS_LIMIT = TERMS_PREFIX + "limit";
- public static final String TERMS_PREFIX_STR = TERMS_PREFIX + "prefix";
+ String TERMS_PREFIX_STR = TERMS_PREFIX + "prefix";
- public static final String TERMS_REGEXP_STR = TERMS_PREFIX + "regex";
+ String TERMS_REGEXP_STR = TERMS_PREFIX + "regex";
- public static final String TERMS_REGEXP_FLAG = TERMS_REGEXP_STR + ".flag";
+ String TERMS_REGEXP_FLAG = TERMS_REGEXP_STR + ".flag";
enum TermsRegexpFlag {
UNIX_LINES(Pattern.UNIX_LINES),
@@ -99,7 +99,7 @@ public interface TermsParams {
}
/** Optional. The minimum value of docFreq to be returned. 1 by default */
- public static final String TERMS_MINCOUNT = TERMS_PREFIX + "mincount";
+ String TERMS_MINCOUNT = TERMS_PREFIX + "mincount";
/** Optional. The maximum value of docFreq to be returned. -1 by default
means no boundary */
String TERMS_MAXCOUNT = TERMS_PREFIX + "maxcount";
diff --git
a/solr/solrj/src/java/org/apache/solr/common/params/UpdateParams.java
b/solr/solrj/src/java/org/apache/solr/common/params/UpdateParams.java
index df6b11f1f3a..8185a9629dc 100644
--- a/solr/solrj/src/java/org/apache/solr/common/params/UpdateParams.java
+++ b/solr/solrj/src/java/org/apache/solr/common/params/UpdateParams.java
@@ -24,59 +24,59 @@ package org.apache.solr.common.params;
public interface UpdateParams {
/** Open up a new searcher as part of a commit */
- public static String OPEN_SEARCHER = "openSearcher";
+ String OPEN_SEARCHER = "openSearcher";
/** wait for the searcher to be registered/visible */
- public static String WAIT_SEARCHER = "waitSearcher";
+ String WAIT_SEARCHER = "waitSearcher";
- public static String SOFT_COMMIT = "softCommit";
+ String SOFT_COMMIT = "softCommit";
/** overwrite indexing fields */
- public static String OVERWRITE = "overwrite";
+ String OVERWRITE = "overwrite";
/** Commit everything after the command completes */
- public static String COMMIT = "commit";
+ String COMMIT = "commit";
/** Commit within a certain time period (in ms) */
- public static String COMMIT_WITHIN = "commitWithin";
+ String COMMIT_WITHIN = "commitWithin";
/** Optimize the index and commit everything after the command completes */
- public static String OPTIMIZE = "optimize";
+ String OPTIMIZE = "optimize";
/** expert: calls IndexWriter.prepareCommit */
- public static String PREPARE_COMMIT = "prepareCommit";
+ String PREPARE_COMMIT = "prepareCommit";
/** Fail a commit when the core or collection is in read-only mode */
- public static String FAIL_ON_READ_ONLY = "failOnReadOnly";
+ String FAIL_ON_READ_ONLY = "failOnReadOnly";
/** Rollback update commands */
- public static String ROLLBACK = "rollback";
+ String ROLLBACK = "rollback";
- public static String COLLECTION = "collection";
+ String COLLECTION = "collection";
/**
* Select the update processor chain to use. A RequestHandler may or may not
respect this
* parameter
*/
- public static final String UPDATE_CHAIN = "update.chain";
+ String UPDATE_CHAIN = "update.chain";
/** Override the content type used for UpdateLoader * */
- public static final String ASSUME_CONTENT_TYPE = "update.contentType";
+ String ASSUME_CONTENT_TYPE = "update.contentType";
/**
* If optimizing, set the maximum number of segments left in the index after
optimization.
* Integer.MAX_INT is the default to respect maxMergeSegmentsMB
*/
- public static final String MAX_OPTIMIZE_SEGMENTS = "maxSegments";
+ String MAX_OPTIMIZE_SEGMENTS = "maxSegments";
- public static final String EXPUNGE_DELETES = "expungeDeletes";
+ String EXPUNGE_DELETES = "expungeDeletes";
/** Return versions of updates? */
- public static final String VERSIONS = "versions";
+ String VERSIONS = "versions";
/**
* If set to true, then Solr must fail to process any Atomic Update which
can not be done
* "In-Place" without re-indexing the entire document.
*/
- public static final String REQUIRE_PARTIAL_DOC_UPDATES_INPLACE =
"update.partial.requireInPlace";
+ String REQUIRE_PARTIAL_DOC_UPDATES_INPLACE = "update.partial.requireInPlace";
}
diff --git
a/solr/solrj/src/java/org/apache/solr/common/util/ByteArrayUtf8CharSequence.java
b/solr/solrj/src/java/org/apache/solr/common/util/ByteArrayUtf8CharSequence.java
index 052514e75c9..01f4a312358 100644
---
a/solr/solrj/src/java/org/apache/solr/common/util/ByteArrayUtf8CharSequence.java
+++
b/solr/solrj/src/java/org/apache/solr/common/util/ByteArrayUtf8CharSequence.java
@@ -72,14 +72,6 @@ public class ByteArrayUtf8CharSequence implements
Utf8CharSequence {
return buf[offset + idx];
}
- /**
- * this is for internal use, to get a cached string value. returns null if
there is no cached
- * String value
- */
- public String getStringOrNull() {
- return utf16;
- }
-
@Override
public int write(int start, byte[] buffer, int pos) {
return _writeBytes(buf, offset, length, start, buffer, pos);
@@ -203,7 +195,7 @@ public class ByteArrayUtf8CharSequence implements
Utf8CharSequence {
}
}
if (needsCopy) {
- Collection<Object> copy = null;
+ Collection<Object> copy;
if (vals instanceof Set) {
copy = CollectionUtil.newHashSet(vals.size());
} else {
@@ -217,7 +209,7 @@ public class ByteArrayUtf8CharSequence implements
Utf8CharSequence {
public static Object convertCharSeq(Object o) {
if (o == null) return null;
- if (o instanceof Utf8CharSequence) return ((Utf8CharSequence)
o).toString();
+ if (o instanceof Utf8CharSequence) return o.toString();
if (o instanceof Collection) return convertCharSeq((Collection<?>) o);
return o;
}
diff --git a/solr/solrj/src/java/org/apache/solr/common/util/ByteUtils.java
b/solr/solrj/src/java/org/apache/solr/common/util/ByteUtils.java
index b7a13dca974..173517baec9 100644
--- a/solr/solrj/src/java/org/apache/solr/common/util/ByteUtils.java
+++ b/solr/solrj/src/java/org/apache/solr/common/util/ByteUtils.java
@@ -75,13 +75,6 @@ public class ByteUtils {
out.setEnd(out.getEnd() + n);
}
- /** Convert UTF8 bytes into a String */
- public static String UTF8toUTF16(byte[] utf8, int offset, int len) {
- char[] out = new char[len];
- int n = UTF8toUTF16(utf8, offset, len, out, 0);
- return new String(out, 0, n);
- }
-
/**
* Writes UTF8 into the byte array, starting at offset. The caller should
ensure that there is
* enough space for the worst-case scenario.
@@ -94,7 +87,7 @@ public class ByteUtils {
int upto = resultOffset;
for (int i = offset; i < end; i++) {
- final int code = (int) s.charAt(i);
+ final int code = s.charAt(i);
if (code < 0x80) result[upto++] = (byte) code;
else if (code < 0x800) {
@@ -108,7 +101,7 @@ public class ByteUtils {
// surrogate pair
// confirm valid high surrogate
if (code < 0xDC00 && (i < end - 1)) {
- int utf32 = (int) s.charAt(i + 1);
+ int utf32 = s.charAt(i + 1);
// confirm valid low surrogate and write pair
if (utf32 >= 0xDC00 && utf32 <= 0xDFFF) {
utf32 = ((code - 0xD7C0) << 10) + (utf32 & 0x3FF);
@@ -144,7 +137,7 @@ public class ByteUtils {
int upto = 0, totalBytes = 0;
for (int i = offset; i < end; i++) {
- final int code = (int) s.charAt(i);
+ final int code = s.charAt(i);
if (upto > scratch.length - 4) {
// a code point may take up to 4 bytes, and we don't have enough
space, so reset
@@ -166,7 +159,7 @@ public class ByteUtils {
// surrogate pair
// confirm valid high surrogate
if (code < 0xDC00 && (i < end - 1)) {
- int utf32 = (int) s.charAt(i + 1);
+ int utf32 = s.charAt(i + 1);
// confirm valid low surrogate and write pair
if (utf32 >= 0xDC00 && utf32 <= 0xDFFF) {
utf32 = ((code - 0xD7C0) << 10) + (utf32 & 0x3FF);
@@ -202,7 +195,7 @@ public class ByteUtils {
int res = 0;
for (int i = offset; i < end; i++) {
- final int code = (int) s.charAt(i);
+ final int code = s.charAt(i);
if (code < 0x80) res++;
else if (code < 0x800) {
@@ -213,7 +206,7 @@ public class ByteUtils {
// surrogate pair
// confirm valid high surrogate
if (code < 0xDC00 && (i < end - 1)) {
- int utf32 = (int) s.charAt(i + 1);
+ int utf32 = s.charAt(i + 1);
// confirm valid low surrogate and write pair
if (utf32 >= 0xDC00 && utf32 <= 0xDFFF) {
i++;
diff --git
a/solr/solrj/src/java/org/apache/solr/common/util/CommandOperation.java
b/solr/solrj/src/java/org/apache/solr/common/util/CommandOperation.java
index 7598e90fcbb..f7c2b560c0a 100644
--- a/solr/solrj/src/java/org/apache/solr/common/util/CommandOperation.java
+++ b/solr/solrj/src/java/org/apache/solr/common/util/CommandOperation.java
@@ -25,7 +25,6 @@ import java.io.Reader;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.HashMap;
-import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -175,19 +174,6 @@ public class CommandOperation {
errors.add(s);
}
- /** Get all the values from the metadata for the command without the
specified keys */
- public Map<String, Object> getValuesExcluding(String... keys) {
- getMapVal(null);
- if (hasError()) return Map.of(); // just to verify the type is Map
- @SuppressWarnings("unchecked")
- LinkedHashMap<String, Object> cp = new LinkedHashMap<>((Map<String,
Object>) commandData);
- if (keys == null) return cp;
- for (String key : keys) {
- cp.remove(key);
- }
- return cp;
- }
-
public List<String> getErrors() {
return errors;
}
@@ -258,11 +244,7 @@ public class CommandOperation {
*/
public static List<CommandOperation> parse(Reader rdr, Set<String>
singletonCommands)
throws IOException {
- JSONParser parser = new JSONParser(rdr);
- parser.setFlags(
- parser.getFlags()
- | JSONParser.ALLOW_MISSING_COLON_COMMA_BEFORE_OBJECT
- | JSONParser.OPTIONAL_OUTER_BRACES);
+ JSONParser parser = Utils.getJSONParser(rdr);
ObjectBuilder ob = new ObjectBuilder(parser);
diff --git
a/solr/solrj/src/java/org/apache/solr/common/util/CommonTestInjection.java
b/solr/solrj/src/java/org/apache/solr/common/util/CommonTestInjection.java
index 3acf4d75163..984d15cf6fe 100644
--- a/solr/solrj/src/java/org/apache/solr/common/util/CommonTestInjection.java
+++ b/solr/solrj/src/java/org/apache/solr/common/util/CommonTestInjection.java
@@ -21,7 +21,6 @@ import java.io.Closeable;
import java.io.IOException;
import java.lang.invoke.MethodHandles;
import java.util.HashSet;
-import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
@@ -36,23 +35,13 @@ import org.slf4j.LoggerFactory;
public class CommonTestInjection {
private static final Logger log =
LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
- private static volatile Map<String, String> additionalSystemProps = null;
private static volatile Integer delay = null;
private static final ConcurrentMap<String, Breakpoint> breakpoints = new
ConcurrentHashMap<>();
public static void reset() {
- additionalSystemProps = null;
delay = null;
}
- public static void setAdditionalProps(Map<String, String>
additionalSystemProps) {
- CommonTestInjection.additionalSystemProps = additionalSystemProps;
- }
-
- public static Map<String, String> injectAdditionalProps() {
- return additionalSystemProps;
- }
-
/**
* Set test delay (sleep) in unit of milliseconds
*
diff --git
a/solr/solrj/src/java/org/apache/solr/common/util/ContentStreamBase.java
b/solr/solrj/src/java/org/apache/solr/common/util/ContentStreamBase.java
index bd87e049b8a..e97e9bf4285 100644
--- a/solr/solrj/src/java/org/apache/solr/common/util/ContentStreamBase.java
+++ b/solr/solrj/src/java/org/apache/solr/common/util/ContentStreamBase.java
@@ -304,10 +304,6 @@ public abstract class ContentStreamBase implements
ContentStream {
return sourceInfo;
}
- public void setSourceInfo(String sourceInfo) {
- this.sourceInfo = sourceInfo;
- }
-
public static ContentStream create(
RequestWriter requestWriter, @SuppressWarnings({"rawtypes"}) SolrRequest
req)
throws IOException {
diff --git a/solr/solrj/src/java/org/apache/solr/common/util/DOMUtil.java
b/solr/solrj/src/java/org/apache/solr/common/util/DOMUtil.java
index 0a2c93d9aa9..6c561cb80d0 100644
--- a/solr/solrj/src/java/org/apache/solr/common/util/DOMUtil.java
+++ b/solr/solrj/src/java/org/apache/solr/common/util/DOMUtil.java
@@ -20,7 +20,6 @@ import static org.apache.solr.common.params.CommonParams.NAME;
import java.util.ArrayList;
import java.util.HashMap;
-import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Properties;
@@ -78,11 +77,6 @@ public class DOMUtil {
return getAttr(nd.getAttributes(), name);
}
- public static String getAttrOrDefault(Node nd, String name, String def) {
- String attr = getAttr(nd.getAttributes(), name);
- return attr == null ? def : attr;
- }
-
public static String getAttr(NamedNodeMap attrs, String name, String
missing_err) {
Node attr = attrs == null ? null : attrs.getNamedItem(name);
if (attr == null) {
@@ -278,17 +272,6 @@ public class DOMUtil {
}
}
- /**
- * Replaces ${system.property[:default value]} references in all attributes
and text nodes of
- * supplied node. If the system property is not defined and no default value
is provided, a
- * runtime exception is thrown.
- *
- * @param node DOM node to walk for substitutions
- */
- public static void substituteSystemProperties(Node node) {
- substituteProperties(node, null);
- }
-
/**
* Replaces ${property[:default value]} references in all attributes and
text nodes of supplied
* node. If the property is not defined, either in the given Properties
instance nor in
@@ -321,106 +304,4 @@ public class DOMUtil {
}
}
}
-
- public static String substituteProperty(String value, Properties
coreProperties) {
- if (value == null || value.indexOf('$') == -1) {
- return value;
- }
-
- List<String> fragments = new ArrayList<>();
- List<String> propertyRefs = new ArrayList<>();
- parsePropertyString(value, fragments, propertyRefs);
-
- StringBuilder sb = new StringBuilder();
- Iterator<String> i = fragments.iterator();
- Iterator<String> j = propertyRefs.iterator();
-
- while (i.hasNext()) {
- String fragment = i.next();
- if (fragment == null) {
- String propertyName = j.next();
- String defaultValue = null;
- int colon_index = propertyName.indexOf(':');
- if (colon_index > -1) {
- defaultValue = propertyName.substring(colon_index + 1);
- propertyName = propertyName.substring(0, colon_index);
- }
- if (coreProperties != null) {
- fragment = coreProperties.getProperty(propertyName);
- }
- if (fragment == null) {
- fragment = System.getProperty(propertyName, defaultValue);
- }
- if (fragment == null) {
- throw new SolrException(
- SolrException.ErrorCode.SERVER_ERROR,
- "No system property or default value specified for "
- + propertyName
- + " value:"
- + value);
- }
- }
- sb.append(fragment);
- }
- return sb.toString();
- }
-
- /*
- * This method borrowed from Ant's PropertyHelper.parsePropertyStringDefault:
- *
http://svn.apache.org/repos/asf/ant/core/trunk/src/main/org/apache/tools/ant/PropertyHelper.java
- */
- private static void parsePropertyString(
- String value, List<String> fragments, List<String> propertyRefs) {
- int prev = 0;
- int pos;
- // search for the next instance of $ from the 'prev' position
- while ((pos = value.indexOf('$', prev)) >= 0) {
-
- // if there was any text before this, add it as a fragment
- // TODO, this check could be modified to go if pos>prev;
- // seems like this current version could stick empty strings
- // into the list
- if (pos > 0) {
- fragments.add(value.substring(prev, pos));
- }
- // if we are at the end of the string, we tack on a $
- // then move past it
- if (pos == (value.length() - 1)) {
- fragments.add("$");
- prev = pos + 1;
- } else if (value.charAt(pos + 1) != '{') {
- // peek ahead to see if the next char is a property or
- // not a property: insert the char as a literal
- /*
- fragments.addElement(value.substring(pos + 1, pos + 2));
- prev = pos + 2;
- */
- if (value.charAt(pos + 1) == '$') {
- // backwards compatibility two $ map to one mode
- fragments.add("$");
- prev = pos + 2;
- } else {
- // new behaviour: $X maps to $X for all values of X!='$'
- fragments.add(value.substring(pos, pos + 2));
- prev = pos + 2;
- }
-
- } else {
- // property found, extract its name or bail on a typo
- int endName = value.indexOf('}', pos);
- if (endName < 0) {
- throw new RuntimeException("Syntax error in property: " + value);
- }
- String propertyName = value.substring(pos + 2, endName);
- fragments.add(null);
- propertyRefs.add(propertyName);
- prev = endName + 1;
- }
- }
- // no more $ signs found
- // if there is any tail to the string, append it
- if (prev < value.length()) {
- fragments.add(value.substring(prev));
- }
- }
}
diff --git
a/solr/solrj/src/java/org/apache/solr/common/util/DataInputInputStream.java
b/solr/solrj/src/java/org/apache/solr/common/util/DataInputInputStream.java
index d5724e882dc..c10d699a259 100644
--- a/solr/solrj/src/java/org/apache/solr/common/util/DataInputInputStream.java
+++ b/solr/solrj/src/java/org/apache/solr/common/util/DataInputInputStream.java
@@ -26,7 +26,7 @@ public abstract class DataInputInputStream extends
InputStream implements DataIn
/**
* If possible, read UTF8 bytes directly from the underlying buffer
*
- * @param utf8 the utf8 ubject to read into
+ * @param utf8 the utf8 subject to read into
* @param len length of the utf8 stream
* @return whether it is possible to do a direct read or not
*/
@@ -42,5 +42,4 @@ public abstract class DataInputInputStream extends
InputStream implements DataIn
public ByteBuffer readDirectByteBuffer(int sz) {
return null;
}
- ;
}
diff --git a/solr/solrj/src/java/org/apache/solr/common/util/ExecutorUtil.java
b/solr/solrj/src/java/org/apache/solr/common/util/ExecutorUtil.java
index 48ac61f55d8..e4814f7b094 100644
--- a/solr/solrj/src/java/org/apache/solr/common/util/ExecutorUtil.java
+++ b/solr/solrj/src/java/org/apache/solr/common/util/ExecutorUtil.java
@@ -119,24 +119,6 @@ public class ExecutorUtil {
awaitTermination(pool);
}
- /**
- * Shutdown the {@link ExecutorService} and wait forever for the threads to
complete. More detail
- * on the waiting can be found in {@link
#awaitTerminationForever(ExecutorService)}.
- *
- * <p>This should likely not be used in {@code close()} methods, as we want
to time bound when
- * shutting down. However, sometimes {@link ExecutorService}s are used to
submit a list of tasks
- * and awaiting termination is akin to waiting on the list of {@link
Future}s to complete. In that
- * case, this method should be used as there is no inherent time bound to
waiting on those tasks
- * to complete.
- *
- * @param pool The ExecutorService to shut down and wait on
- */
- public static void shutdownAndAwaitTerminationForever(ExecutorService pool) {
- if (pool == null) return;
- pool.shutdown(); // Disable new tasks from being submitted
- awaitTerminationForever(pool);
- }
-
public static void shutdownNowAndAwaitTermination(ExecutorService pool) {
if (pool == null) return;
pool.shutdownNow(); // Disable new tasks from being submitted; interrupt
existing tasks
diff --git
a/solr/solrj/src/java/org/apache/solr/common/util/FastJavaBinDecoder.java
b/solr/solrj/src/java/org/apache/solr/common/util/FastJavaBinDecoder.java
index 37d82822cad..57330fe7b2a 100644
--- a/solr/solrj/src/java/org/apache/solr/common/util/FastJavaBinDecoder.java
+++ b/solr/solrj/src/java/org/apache/solr/common/util/FastJavaBinDecoder.java
@@ -285,7 +285,7 @@ public class FastJavaBinDecoder implements
DataEntry.FastDecoder {
void reset() {
this.doubleVal = 0.0d;
- this.numericVal = 0l;
+ this.numericVal = 0L;
this.objVal = null;
this.ctx = null;
this.entryListener = null;
@@ -338,7 +338,7 @@ public class FastJavaBinDecoder implements
DataEntry.FastDecoder {
@Override
public Object readObject(StreamCodec codec, EntryImpl entry) {
- return Byte.valueOf((byte) entry.numericVal);
+ return (byte) entry.numericVal;
}
},
_SHORT(SHORT, LOWER_5_BITS, DataEntry.Type.INT) {
@@ -350,7 +350,7 @@ public class FastJavaBinDecoder implements
DataEntry.FastDecoder {
@Override
public Object readObject(StreamCodec codec, EntryImpl entry) {
- return Short.valueOf((short) entry.numericVal);
+ return (short) entry.numericVal;
}
},
_DOUBLE(DOUBLE, LOWER_5_BITS, DataEntry.Type.DOUBLE) {
@@ -362,7 +362,7 @@ public class FastJavaBinDecoder implements
DataEntry.FastDecoder {
@Override
public Object readObject(StreamCodec codec, EntryImpl entry) {
- return Double.valueOf(entry.doubleVal);
+ return entry.doubleVal;
}
},
_INT(INT, LOWER_5_BITS, DataEntry.Type.INT) {
@@ -373,7 +373,7 @@ public class FastJavaBinDecoder implements
DataEntry.FastDecoder {
@Override
public Object readObject(StreamCodec codec, EntryImpl entry) {
- return Integer.valueOf((int) entry.numericVal);
+ return (int) entry.numericVal;
}
}, // signed integer
_LONG(LONG, LOWER_5_BITS, DataEntry.Type.LONG) {
@@ -384,7 +384,7 @@ public class FastJavaBinDecoder implements
DataEntry.FastDecoder {
@Override
public Object readObject(StreamCodec codec, EntryImpl entry) {
- return Long.valueOf(entry.numericVal);
+ return entry.numericVal;
}
},
_FLOAT(FLOAT, LOWER_5_BITS, DataEntry.Type.FLOAT) {
@@ -395,7 +395,7 @@ public class FastJavaBinDecoder implements
DataEntry.FastDecoder {
@Override
public Object readObject(StreamCodec codec, EntryImpl entry) {
- return Float.valueOf((float) entry.doubleVal);
+ return (float) entry.doubleVal;
}
},
_DATE(DATE, LOWER_5_BITS, DataEntry.Type.DATE) {
diff --git
a/solr/solrj/src/java/org/apache/solr/common/util/FastOutputStream.java
b/solr/solrj/src/java/org/apache/solr/common/util/FastOutputStream.java
index 8c3cdbd394a..dc90d7d5f9a 100644
--- a/solr/solrj/src/java/org/apache/solr/common/util/FastOutputStream.java
+++ b/solr/solrj/src/java/org/apache/solr/common/util/FastOutputStream.java
@@ -52,7 +52,7 @@ public class FastOutputStream extends OutputStream implements
DataOutput {
}
@Override
- public void write(byte b[]) throws IOException {
+ public void write(byte[] b) throws IOException {
write(b, 0, b.length);
}
@@ -66,7 +66,7 @@ public class FastOutputStream extends OutputStream implements
DataOutput {
}
@Override
- public void write(byte arr[], int off, int len) throws IOException {
+ public void write(byte[] arr, int off, int len) throws IOException {
for (; ; ) {
int space = buf.length - pos;
diff --git a/solr/solrj/src/java/org/apache/solr/common/util/FastWriter.java
b/solr/solrj/src/java/org/apache/solr/common/util/FastWriter.java
index 3989d38341a..6d54bda77a3 100644
--- a/solr/solrj/src/java/org/apache/solr/common/util/FastWriter.java
+++ b/solr/solrj/src/java/org/apache/solr/common/util/FastWriter.java
@@ -66,7 +66,7 @@ public class FastWriter extends Writer {
}
@Override
- public void write(char arr[], int off, int len) throws IOException {
+ public void write(char[] arr, int off, int len) throws IOException {
for (; ; ) {
int space = buf.length - pos;
diff --git
a/solr/solrj/src/java/org/apache/solr/common/util/GlobPatternUtil.java
b/solr/solrj/src/java/org/apache/solr/common/util/GlobPatternUtil.java
index 2c370718701..ac352ccdd3e 100644
--- a/solr/solrj/src/java/org/apache/solr/common/util/GlobPatternUtil.java
+++ b/solr/solrj/src/java/org/apache/solr/common/util/GlobPatternUtil.java
@@ -136,7 +136,7 @@ public class GlobPatternUtil {
char prevChar = 0;
for (final char ch : array) {
if (ch == '?' || ch == '*') {
- if (buffer.length() != 0) {
+ if (!buffer.isEmpty()) {
list.add(buffer.toString());
buffer.setLength(0);
}
@@ -150,7 +150,7 @@ public class GlobPatternUtil {
}
prevChar = ch;
}
- if (buffer.length() != 0) {
+ if (!buffer.isEmpty()) {
list.add(buffer.toString());
}
diff --git a/solr/solrj/src/java/org/apache/solr/common/util/JavaBinCodec.java
b/solr/solrj/src/java/org/apache/solr/common/util/JavaBinCodec.java
index f47ff63b980..12f7f4cf4bb 100644
--- a/solr/solrj/src/java/org/apache/solr/common/util/JavaBinCodec.java
+++ b/solr/solrj/src/java/org/apache/solr/common/util/JavaBinCodec.java
@@ -359,7 +359,7 @@ public class JavaBinCodec implements PushWriter {
throw new RuntimeException("Unknown type " + tagByte);
}
- @SuppressWarnings({"unchecked", "rawtypes"})
+ @SuppressWarnings({"rawtypes"})
public boolean writeKnownType(Object val) throws IOException {
if (writePrimitive(val)) return true;
if (val instanceof NamedList) {
@@ -1250,16 +1250,16 @@ public class JavaBinCodec implements PushWriter {
} else if (val instanceof Number) {
if (val instanceof Integer) {
- writeInt(((Integer) val).intValue());
+ writeInt((Integer) val);
return true;
} else if (val instanceof Long) {
- writeLong(((Long) val).longValue());
+ writeLong((Long) val);
return true;
} else if (val instanceof Float) {
- writeFloat(((Float) val).floatValue());
+ writeFloat((Float) val);
return true;
} else if (val instanceof Double) {
- writeDouble(((Double) val).doubleValue());
+ writeDouble((Double) val);
return true;
} else if (val instanceof Byte) {
daos.writeByte(BYTE);
diff --git
a/solr/solrj/src/java/org/apache/solr/common/util/JsonRecordReader.java
b/solr/solrj/src/java/org/apache/solr/common/util/JsonRecordReader.java
index 86d3b94c236..5d9ef1b883c 100644
--- a/solr/solrj/src/java/org/apache/solr/common/util/JsonRecordReader.java
+++ b/solr/solrj/src/java/org/apache/solr/common/util/JsonRecordReader.java
@@ -57,7 +57,7 @@ public class JsonRecordReader {
fieldName = s.substring(0, idx);
path = s.substring(idx + 1);
}
- jsonRecordReader.addField(path, fieldName, true, false);
+ jsonRecordReader.addField(path, fieldName, false);
}
return jsonRecordReader;
}
@@ -82,9 +82,9 @@ public class JsonRecordReader {
split = split.trim();
if (split.startsWith("//"))
throw new RuntimeException("split cannot start with '//': " + split);
- if (split.length() == 0) continue;
+ if (split.isEmpty()) continue;
// The created Node has a name set to the full split attribute path
- addField(split, split, false, true);
+ addField(split, split, true);
}
}
@@ -95,19 +95,18 @@ public class JsonRecordReader {
*
* @param path The path expression for this field
* @param fieldName The name for this field in the emitted record
- * @param multiValued If 'true' then the emitted record will have values in
a List<String>
* @param isRecord Flags that this PATH is from a forEach statement
*/
- private void addField(String path, String fieldName, boolean multiValued,
boolean isRecord) {
+ private void addField(String path, String fieldName, boolean isRecord) {
if (!path.startsWith("/")) throw new RuntimeException("All paths must
start with '/' " + path);
List<String> paths = splitEscapeQuote(path);
- if (paths.size() == 0) {
+ if (paths.isEmpty()) {
if (isRecord) rootNode.setAsRecord();
return; // the path is "/"
}
// deal with how split behaves when separator starts with an empty string!
if (paths.get(0).trim().isEmpty()) paths.remove(0);
- rootNode.build(paths, fieldName, multiValued, isRecord, path);
+ rootNode.build(paths, fieldName, isRecord, path);
rootNode.buildOptimize();
}
@@ -138,7 +137,7 @@ public class JsonRecordReader {
}
public void streamRecords(JSONParser parser, Handler handler) throws
IOException {
- rootNode.parse(parser, handler, new LinkedHashMap<>());
+ rootNode.parse(parser, handler);
}
/**
@@ -170,12 +169,6 @@ public class JsonRecordReader {
parent = p;
}
- public Node(String name, String fieldName) {
- // This is only called from build() when describing an attribute.
- this.name = name; // a segment from the path
- this.fieldName = fieldName; // name to store collected values against
- }
-
void setAsRecord() {
if (isMyChildARecord())
throw new RuntimeException(name + " has a parent node at my level or
lower");
@@ -218,13 +211,12 @@ public class JsonRecordReader {
private void build(
List<String> paths, // a List of segments from the split paths
String fieldName, // the fieldName assoc with this path
- boolean multiValued, // flag if this fieldName is multiValued or not
boolean record, // is this path a record or a field
String path) {
// recursively walk the paths Lists adding new Nodes as required
String segment = paths.remove(0); // shift out next path segment
- if (segment.length() < 1)
+ if (segment.isEmpty())
throw new RuntimeException("all pieces in path must be non empty " +
path);
// does this "name" already exist as a child node.
@@ -263,7 +255,7 @@ public class JsonRecordReader {
if (WILDCARD_PATH.equals(name) || RECURSIVE_WILDCARD_PATH.equals(name))
throw new RuntimeException("wild cards are allowed only in the end "
+ path);
// recurse to handle next paths segment
- n.build(paths, fieldName, multiValued, record, path);
+ n.build(paths, fieldName, record, path);
}
}
@@ -275,8 +267,7 @@ public class JsonRecordReader {
return n;
}
- private void parse(JSONParser parser, Handler handler, Map<String, Object>
values)
- throws IOException {
+ private void parse(JSONParser parser, Handler handler) throws IOException {
int event = -1;
boolean recordStarted = false;
diff --git
a/solr/solrj/src/java/org/apache/solr/common/util/JsonSchemaValidator.java
b/solr/solrj/src/java/org/apache/solr/common/util/JsonSchemaValidator.java
index 9d19c35b8ac..fa8b41aac73 100644
--- a/solr/solrj/src/java/org/apache/solr/common/util/JsonSchemaValidator.java
+++ b/solr/solrj/src/java/org/apache/solr/common/util/JsonSchemaValidator.java
@@ -99,7 +99,6 @@ public class JsonSchemaValidator {
abstract class Validator<T> {
Validator(Map<?, ?> schema, T properties) {}
- ;
abstract boolean validate(Object o, List<String> errs);
}
diff --git
a/solr/solrj/src/java/org/apache/solr/common/util/JsonTextWriter.java
b/solr/solrj/src/java/org/apache/solr/common/util/JsonTextWriter.java
index e3e9ff67b82..89e9e0fc4eb 100644
--- a/solr/solrj/src/java/org/apache/solr/common/util/JsonTextWriter.java
+++ b/solr/solrj/src/java/org/apache/solr/common/util/JsonTextWriter.java
@@ -314,85 +314,27 @@ public interface JsonTextWriter extends TextWriter {
default void writeNamedList(String name, NamedList<?> val) throws
IOException {
String namedListStyle = getNamedListStyle();
if (val instanceof SimpleOrderedMap) {
- writeNamedListAsMapWithDups(name, val);
+ writeNamedListAsMapWithDups(val);
} else if (Objects.equals(namedListStyle, JSON_NL_FLAT)) {
- writeNamedListAsFlat(name, val);
+ writeNamedListAsFlat(val);
} else if (Objects.equals(namedListStyle, JSON_NL_MAP)) {
- writeNamedListAsMapWithDups(name, val);
+ writeNamedListAsMapWithDups(val);
} else if (Objects.equals(namedListStyle, JSON_NL_ARROFARR)) {
- writeNamedListAsArrArr(name, val);
+ writeNamedListAsArrArr(val);
} else if (Objects.equals(namedListStyle, JSON_NL_ARROFMAP)) {
- writeNamedListAsArrMap(name, val);
+ writeNamedListAsArrMap(val);
} else if (Objects.equals(namedListStyle, JSON_NL_ARROFNTV)) {
throw new UnsupportedOperationException(
namedListStyle + " namedListStyle must only be used with
ArrayOfNameTypeValueJSONWriter");
}
}
- /**
- * Represents a NamedList directly as a JSON Object (essentially a Map) Map
null to "" and name
- * mangle any repeated keys to avoid repeats in the output.
- */
- default void writeNamedListAsMapMangled(String name, NamedList<?> val)
throws IOException {
- int sz = val.size();
- writeMapOpener(sz);
- incLevel();
-
- // In JSON objects (maps) we can't have null keys or duplicates...
- // map null to "" and append a qualifier to duplicates.
- //
- // a=123,a=456 will be mapped to {a=1,a__1=456}
- // Disad: this is ambiguous since a real key could be called a__1
- //
- // Another possible mapping could aggregate multiple keys to an array:
- // a=123,a=456 maps to a=[123,456]
- // Disad: this is ambiguous with a real single value that happens to be an
array
- //
- // Both of these mappings have ambiguities.
- Map<String, Integer> repeats = CollectionUtil.newHashMap(4);
-
- boolean first = true;
- for (int i = 0; i < sz; i++) {
- String key = val.getName(i);
- if (key == null) key = "";
-
- if (first) {
- first = false;
- repeats.put(key, 0);
- } else {
- writeMapSeparator();
-
- Integer repeatCount = repeats.get(key);
- if (repeatCount == null) {
- repeats.put(key, 0);
- } else {
- String newKey = key;
- int newCount = repeatCount;
- do { // avoid generated key clashing with a real key
- newKey = key + ' ' + (++newCount);
- repeatCount = repeats.get(newKey);
- } while (repeatCount != null);
-
- repeats.put(key, newCount);
- key = newKey;
- }
- }
-
- indent();
- writeKey(key, true);
- writeVal(key, val.getVal(i));
- }
-
- decLevel();
- writeMapCloser();
- }
-
/**
* Represents a NamedList directly as a JSON Object (essentially a Map)
repeating any keys if they
* are repeated in the NamedList. null key is mapped to "".
*/
// NamedList("a"=1,"bar"="foo",null=3,null=null) =>
{"a":1,"bar":"foo","":3,"":null}
- default void writeNamedListAsMapWithDups(String name, NamedList<?> val)
throws IOException {
+ default void writeNamedListAsMapWithDups(NamedList<?> val) throws
IOException {
int sz = val.size();
writeMapOpener(sz);
incLevel();
@@ -415,7 +357,7 @@ public interface JsonTextWriter extends TextWriter {
// Represents a NamedList directly as an array of JSON objects...
// NamedList("a"=1,"b"=2,null=3,null=null) => [{"a":1},{"b":2},3,null]
- default void writeNamedListAsArrMap(String name, NamedList<?> val) throws
IOException {
+ default void writeNamedListAsArrMap(NamedList<?> val) throws IOException {
int sz = val.size();
indent();
writeArrayOpener(sz);
@@ -449,7 +391,7 @@ public interface JsonTextWriter extends TextWriter {
// Represents a NamedList directly as an array of JSON objects...
// NamedList("a"=1,"b"=2,null=3,null=null) =>
[["a",1],["b",2],[null,3],[null,null]]
- default void writeNamedListAsArrArr(String name, NamedList<?> val) throws
IOException {
+ default void writeNamedListAsArrArr(NamedList<?> val) throws IOException {
int sz = val.size();
indent();
writeArrayOpener(sz);
@@ -493,7 +435,7 @@ public interface JsonTextWriter extends TextWriter {
// Represents a NamedList directly as an array with keys/values
// interleaved.
// NamedList("a"=1,"b"=2,null=3,null=null) => ["a",1,"b",2,null,3,null,null]
- default void writeNamedListAsFlat(String name, NamedList<?> val) throws
IOException {
+ default void writeNamedListAsFlat(NamedList<?> val) throws IOException {
int sz = val.size();
writeArrayOpener(sz * 2);
incLevel();
diff --git a/solr/solrj/src/java/org/apache/solr/common/util/NamedList.java
b/solr/solrj/src/java/org/apache/solr/common/util/NamedList.java
index 6b43da26de9..e4f27c4025b 100644
--- a/solr/solrj/src/java/org/apache/solr/common/util/NamedList.java
+++ b/solr/solrj/src/java/org/apache/solr/common/util/NamedList.java
@@ -135,7 +135,7 @@ public class NamedList<T>
/**
* Method to serialize Map.Entry<String, ?> to a List in which the
even indexed elements
- * (0,2,4, etc.) are Strings and odd elements (1,3,5,) are of the type "T".
+ * (0,2,4, etc.) are Strings and odd elements (1,3,5) are of the type "T".
*
* <p>NOTE: This a temporary placeholder method until the guts of the class
are actually replaced
* by List<String, ?>.
diff --git
a/solr/solrj/src/java/org/apache/solr/common/util/ObjectReleaseTracker.java
b/solr/solrj/src/java/org/apache/solr/common/util/ObjectReleaseTracker.java
index 5ee278997f5..f3e5e05c355 100644
--- a/solr/solrj/src/java/org/apache/solr/common/util/ObjectReleaseTracker.java
+++ b/solr/solrj/src/java/org/apache/solr/common/util/ObjectReleaseTracker.java
@@ -21,7 +21,6 @@ import java.io.PrintWriter;
import java.io.StringWriter;
import java.lang.invoke.MethodHandles;
import java.util.ArrayList;
-import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
@@ -35,16 +34,6 @@ import org.slf4j.LoggerFactory;
public class ObjectReleaseTracker {
private static final Logger log =
LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
- private static final List<String> DEFAULT_STACK_FILTERS =
- Arrays.asList(
- new String[] {
- "org.junit.",
- "junit.framework.",
- "sun.",
- "java.lang.reflect.",
- "com.carrotsearch.randomizedtesting.",
- });
-
public static final Map<Object, Exception> OBJECTS = new
ConcurrentHashMap<>();
public static boolean track(Object object) {
diff --git a/solr/solrj/src/java/org/apache/solr/common/util/PathTrie.java
b/solr/solrj/src/java/org/apache/solr/common/util/PathTrie.java
index 0fde7c457b2..9eb74a0bc19 100644
--- a/solr/solrj/src/java/org/apache/solr/common/util/PathTrie.java
+++ b/solr/solrj/src/java/org/apache/solr/common/util/PathTrie.java
@@ -32,8 +32,6 @@ public class PathTrie<T> {
private final Set<String> reserved = new HashSet<>();
Node root = new Node(List.of(), null, null);
- public PathTrie() {}
-
public PathTrie(Set<String> reserved) {
this.reserved.addAll(reserved);
}
diff --git
a/solr/solrj/src/java/org/apache/solr/common/util/PropertiesUtil.java
b/solr/solrj/src/java/org/apache/solr/common/util/PropertiesUtil.java
index 9ae768c1f0a..94ba0149622 100644
--- a/solr/solrj/src/java/org/apache/solr/common/util/PropertiesUtil.java
+++ b/solr/solrj/src/java/org/apache/solr/common/util/PropertiesUtil.java
@@ -139,23 +139,4 @@ public class PropertiesUtil {
fragments.add(value.substring(prev));
}
}
-
- /**
- * Parse the given String value as an integer. If the string cannot be
parsed, returns the default
- *
- * @param value the value to parse
- * @param defValue the default to return if the value cannot be parsed
- * @return an integer version of the passed in value
- */
- public static Integer toInteger(String value, Integer defValue) {
- try {
- return Integer.parseInt(value);
- } catch (NumberFormatException e) {
- return defValue;
- }
- }
-
- public static boolean toBoolean(String value) {
- return "true".equalsIgnoreCase(value) || "on".equalsIgnoreCase(value);
- }
}
diff --git a/solr/solrj/src/java/org/apache/solr/common/util/Template.java
b/solr/solrj/src/java/org/apache/solr/common/util/Template.java
deleted file mode 100644
index 9d846dcca22..00000000000
--- a/solr/solrj/src/java/org/apache/solr/common/util/Template.java
+++ /dev/null
@@ -1,61 +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.common.util;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-import java.util.function.Function;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-public class Template {
- public final String template;
- public static final Pattern DOLLAR_BRACES_PLACEHOLDER_PATTERN =
Pattern.compile("[$][{](.*?)[}]");
- public static final Pattern BRACES_PLACEHOLDER_PATTERN =
Pattern.compile("[{](.*?)[}]");
-
- public Template(String template, Pattern pattern) {
- this.template = template;
- List<String> variables = new ArrayList<>(2);
- Matcher m = pattern.matcher(template);
- while (m.find()) {
- String variable = m.group(1);
- startIndexes.add(m.start(0));
- endOffsets.add(m.end(0));
- variables.add(variable);
- }
- this.variables = Collections.unmodifiableList(variables);
- }
-
- public String apply(Function<String, Object> valueSupplier) {
- if (startIndexes != null) {
- StringBuilder sb = new StringBuilder(template);
- for (int i = startIndexes.size() - 1; i >= 0; i--) {
- String replacement = valueSupplier.apply(variables.get(i)).toString();
- sb.replace(startIndexes.get(i), endOffsets.get(i), replacement);
- }
- return sb.toString();
- } else {
- return template;
- }
- }
-
- private List<Integer> startIndexes = new ArrayList<>(2);
- private List<Integer> endOffsets = new ArrayList<>(2);
- public final List<String> variables;
-}
diff --git a/solr/solrj/src/java/org/apache/solr/common/util/URLUtil.java
b/solr/solrj/src/java/org/apache/solr/common/util/URLUtil.java
index e4e97e355ac..75ee914ea1a 100644
--- a/solr/solrj/src/java/org/apache/solr/common/util/URLUtil.java
+++ b/solr/solrj/src/java/org/apache/solr/common/util/URLUtil.java
@@ -179,7 +179,7 @@ public class URLUtil {
* @param baseUri the base URI (e.g., URI for "http://localhost:8983/solr")
* @param path the path to append (e.g., "/config/overlay" or
"admin/cores"). May include a query
* string (e.g., "/select?q=test")
- * @param queryParams optional query parameters to append (may be null). If
the path already
+ * @param queryParams optional query parameters to append (can be null). If
the path already
* contains a query string, these params will be added to it.
* @return a properly encoded URI
* @throws IllegalArgumentException if the baseUri or path are invalid
diff --git a/solr/solrj/src/java/org/apache/solr/common/util/Utils.java
b/solr/solrj/src/java/org/apache/solr/common/util/Utils.java
index acbbdac41d7..1657366840d 100644
--- a/solr/solrj/src/java/org/apache/solr/common/util/Utils.java
+++ b/solr/solrj/src/java/org/apache/solr/common/util/Utils.java
@@ -17,7 +17,6 @@
package org.apache.solr.common.util;
import static java.nio.charset.StandardCharsets.UTF_8;
-import static java.util.concurrent.TimeUnit.NANOSECONDS;
import static org.apache.solr.common.SolrException.ErrorCode.SERVER_ERROR;
import com.fasterxml.jackson.annotation.JsonAnyGetter;
@@ -63,7 +62,6 @@ import java.util.Random;
import java.util.Set;
import java.util.TreeMap;
import java.util.TreeSet;
-import java.util.concurrent.Callable;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.TimeUnit;
import java.util.function.BiConsumer;
@@ -82,7 +80,6 @@ import org.noggit.CharArr;
import org.noggit.JSONParser;
import org.noggit.JSONWriter;
import org.noggit.ObjectBuilder;
-import org.slf4j.Logger;
public class Utils {
@@ -366,20 +363,6 @@ public class Utils {
}
};
- public static final Function<JSONParser, ObjectBuilder> MAPOBJBUILDER =
- jsonParser -> {
- try {
- return new ObjectBuilder(jsonParser) {
- @Override
- public Object newObject() {
- return new HashMap<>();
- }
- };
- } catch (IOException e) {
- throw new RuntimeException(e);
- }
- };
-
/**
* Util function to convert {@link Object} to {@link String} Specially
handles {@link Date} to
* string conversion
@@ -714,19 +697,6 @@ public class Utils {
return isModified;
}
- /**
- * Given a URL string with or without a scheme, return a new URL with the
correct scheme applied.
- *
- * @param url A URL to change the scheme (http|https)
- * @return A new URL with the correct scheme
- */
- public static String applyUrlScheme(final String url, final String
urlScheme) {
- Objects.requireNonNull(url, "URL must not be null!");
- // heal an incorrect scheme if needed, otherwise return null indicating no
change
- final int at = url.indexOf("://");
- return (at == -1) ? (urlScheme + "://" + url) : urlScheme +
url.substring(at);
- }
-
/**
* Construct a V1 base url for the Solr node, given its name (e.g.,
'app-node-1:8983_solr') and a
* URL scheme.
@@ -764,19 +734,6 @@ public class Utils {
return unit.convert(timeSource.getTimeNs(), TimeUnit.NANOSECONDS);
}
- public static long timeElapsed(TimeSource timeSource, long start, TimeUnit
unit) {
- return unit.convert(timeSource.getTimeNs() - NANOSECONDS.convert(start,
unit), NANOSECONDS);
- }
-
- public static <T> T handleExp(Logger logger, T def, Callable<T> c) {
- try {
- return c.call();
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- }
- return def;
- }
-
public interface InputStreamConsumer<T> {
T accept(InputStream is) throws IOException;
diff --git a/solr/solrj/src/java/org/apache/solr/common/util/XML.java
b/solr/solrj/src/java/org/apache/solr/common/util/XML.java
index 168b1b8b8ea..a0cf62c6570 100644
--- a/solr/solrj/src/java/org/apache/solr/common/util/XML.java
+++ b/solr/solrj/src/java/org/apache/solr/common/util/XML.java
@@ -18,8 +18,6 @@ package org.apache.solr.common.util;
import java.io.IOException;
import java.io.Writer;
-import java.util.Map;
-import java.util.stream.Stream;
/** */
public class XML {
@@ -82,43 +80,26 @@ public class XML {
escape(str, out, attribute_escapes);
}
- public static void escapeAttributeValue(char[] chars, int start, int length,
Writer out)
- throws IOException {
- escape(chars, start, length, out, attribute_escapes);
- }
-
/**
* does NOT escape character data in val; it must already be valid XML.
Attributes are always
* escaped.
*/
- public static final void writeUnescapedXML(Writer out, String tag, String
val, Object... attrs)
+ public static void writeUnescapedXML(Writer out, String tag, String val,
Object... attrs)
throws IOException {
writeXML(out, tag, (writer1) -> writer1.write(val), attrs);
}
/** escapes character data in val and attributes */
- public static final void writeXML(Writer out, String tag, String val,
Object... attrs)
+ public static void writeXML(Writer out, String tag, String val, Object...
attrs)
throws IOException {
final Writable writable = val != null ? (writer1) ->
XML.escapeCharData(val, writer1) : null;
writeXML(out, tag, writable, attrs);
}
- /** escapes character data in val and attributes */
- public static void writeXML(Writer out, String tag, String val, Map<String,
String> attrs)
- throws IOException {
- writeXML(
- out,
- tag,
- val,
- attrs.entrySet().stream()
- .flatMap((entry) -> Stream.of(entry.getKey(), entry.getValue()))
- .toArray());
- }
-
/**
* @lucene.internal
*/
- public static final void writeXML(Writer out, String tag, Writable
valWritable, Object... attrs)
+ public static void writeXML(Writer out, String tag, Writable valWritable,
Object... attrs)
throws IOException {
out.write('<');
out.write(tag);
@@ -149,21 +130,6 @@ public class XML {
void write(Writer w) throws IOException;
}
- private static void escape(char[] chars, int offset, int length, Writer out,
String[] escapes)
- throws IOException {
- for (int i = offset; i < length; i++) {
- char ch = chars[i];
- if (ch < escapes.length) {
- String replacement = escapes[ch];
- if (replacement != null) {
- out.write(replacement);
- continue;
- }
- }
- out.write(ch);
- }
- }
-
private static void escape(String str, Writer out, String[] escapes) throws
IOException {
for (int i = 0; i < str.length(); i++) {
char ch = str.charAt(i);