Skip to content

armgit / solr

Public Imported from GitHub
0

Apache Solr open-source search software

Small content fixes (#4759)

Eric Pughce99ba52aac5
diff --git a/solr/modules/analysis-extras/src/java/org/apache/solr/schema/ICUCollationField.java b/solr/modules/analysis-extras/src/java/org/apache/solr/schema/ICUCollationField.java
index 277bbfc214a..23d0e41588c 100644
--- a/solr/modules/analysis-extras/src/java/org/apache/solr/schema/ICUCollationField.java
+++ b/solr/modules/analysis-extras/src/java/org/apache/solr/schema/ICUCollationField.java
@@ -105,9 +105,9 @@ public class ICUCollationField extends FieldType {
private static void warnOrFailUdvas(boolean failHardOnUdvas) {
// NOTE: it may seem odd that we're checking these conditions ourselves rather than relying on
- // the internal
- // checking of `assertWarnOrFail(...)`. But the main reason we're logging this error via
- // `XMLConfigFile.assertWarnOrFail(...)` is because this is at its root an xml config file
+ // the internal checking of `assertWarnOrFail(...)`. But the main reason we're logging this
+ // error via `XMLConfigFile.assertWarnOrFail(...)` is because this is at its root a xml config
+ // file
// error, so we log in a way that's consistent with that.
assertWarnOrFail(UDVAS_MESSAGE, false, failHardOnUdvas);
}
@@ -134,7 +134,7 @@ public class ICUCollationField extends FieldType {
super.init(schema, args);
}
- /** Setup the field according to the provided parameters */
+ /** Set up the field according to the provided parameters */
private void setup(ResourceLoader loader, Map<String, String> args) {
String custom = args.remove("custom");
String localeID = args.remove("locale");
diff --git a/solr/modules/analysis-extras/src/java/org/apache/solr/update/processor/DocumentCategorizerUpdateProcessorFactory.java b/solr/modules/analysis-extras/src/java/org/apache/solr/update/processor/DocumentCategorizerUpdateProcessorFactory.java
index b045c28ac77..db8abcddcb3 100644
--- a/solr/modules/analysis-extras/src/java/org/apache/solr/update/processor/DocumentCategorizerUpdateProcessorFactory.java
+++ b/solr/modules/analysis-extras/src/java/org/apache/solr/update/processor/DocumentCategorizerUpdateProcessorFactory.java
@@ -43,7 +43,6 @@ import org.apache.solr.common.util.NamedList;
import org.apache.solr.common.util.Pair;
import org.apache.solr.core.SolrCore;
import org.apache.solr.filestore.ClusterFileStore;
-import org.apache.solr.filestore.FileStore;
import org.apache.solr.request.SolrQueryRequest;
import org.apache.solr.response.SolrQueryResponse;
import org.apache.solr.update.AddUpdateCommand;
@@ -59,7 +58,7 @@ import org.slf4j.LoggerFactory;
*
* <p>See the <a
* href="https://solr.apache.org/guide/solr/latest/getting-started/tutorial-opennlp.html">Tutorial</a>
- * for the step by step guide.
+ * for a step-by-step guide.
*
* <p>The <code>source</code> field(s) can be configured as either:
*
@@ -473,8 +472,6 @@ public class DocumentCategorizerUpdateProcessorFactory extends UpdateRequestProc
{
// Initialize the categorizer.
- FileStore fs = req.getCoreContainer().getFileStore();
-
var path = solrHome.resolve(ClusterFileStore.FILESTORE_DIRECTORY);
Path modelFile = Path.of(model);
Path vocabFile = Path.of(vocab);
diff --git a/solr/modules/analysis-extras/src/test/org/apache/solr/schema/TestICUCollationField.java b/solr/modules/analysis-extras/src/test/org/apache/solr/schema/TestICUCollationField.java
index de19490f5bc..b85a5884f0c 100644
--- a/solr/modules/analysis-extras/src/test/org/apache/solr/schema/TestICUCollationField.java
+++ b/solr/modules/analysis-extras/src/test/org/apache/solr/schema/TestICUCollationField.java
@@ -165,7 +165,7 @@ public class TestICUCollationField extends SolrTestCaseJ4 {
/**
* Test canonical decomposition with turkish primary strength. With this sort order, İ is the
- * uppercase form of i, and I is the uppercase form of ı. We index a decomposed form of İ.
+ * uppercase form of i, and "I" is the uppercase form of ı. We index a decomposed form of İ.
*/
public void testCanonicalDecomposition() {
assertQ(
diff --git a/solr/modules/analysis-extras/src/test/org/apache/solr/schema/TestICUCollationFieldDocValues.java b/solr/modules/analysis-extras/src/test/org/apache/solr/schema/TestICUCollationFieldDocValues.java
index 09bd67d885a..b9f098b7ad9 100644
--- a/solr/modules/analysis-extras/src/test/org/apache/solr/schema/TestICUCollationFieldDocValues.java
+++ b/solr/modules/analysis-extras/src/test/org/apache/solr/schema/TestICUCollationFieldDocValues.java
@@ -100,7 +100,7 @@ public class TestICUCollationFieldDocValues extends SolrTestCaseJ4 {
}
/**
- * Test rangequery again with the DIN 5007-1 collator. We do a range query of tone .. tp, in
+ * Test rangequery again with the DIN 5007-1 collator. We do a range query of "tone" to "tp", in
* binary order this would retrieve nothing due to case and accent differences.
*/
public void testBasicRangeQuery() {
@@ -148,7 +148,7 @@ public class TestICUCollationFieldDocValues extends SolrTestCaseJ4 {
/**
* Test canonical decomposition with turkish primary strength. With this sort order, İ is the
- * uppercase form of i, and I is the uppercase form of ı. We index a decomposed form of İ.
+ * uppercase form of i, and "I" is the uppercase form of ı. We index a decomposed form of İ.
*/
public void testCanonicalDecomposition() {
assertQ(
diff --git a/solr/modules/clustering/src/java/org/apache/solr/handler/clustering/FlatKeysAttrVisitor.java b/solr/modules/clustering/src/java/org/apache/solr/handler/clustering/FlatKeysAttrVisitor.java
index 31f73b5dcee..037af6772d2 100644
--- a/solr/modules/clustering/src/java/org/apache/solr/handler/clustering/FlatKeysAttrVisitor.java
+++ b/solr/modules/clustering/src/java/org/apache/solr/handler/clustering/FlatKeysAttrVisitor.java
@@ -49,7 +49,7 @@ class FlatKeysAttrVisitor implements AttrVisitor {
/**
* @param attrs A map of attributes to set. Note the map has ordered keys: this is required for
- * complex sub-types so that instantiation of a value precedes setting its attributes.
+ * complex subtypes so that instantiation of a value precedes setting its attributes.
*/
FlatKeysAttrVisitor(LinkedHashMap<String, String> attrs) {
this.attrs = attrs;
diff --git a/solr/modules/clustering/src/test/org/apache/solr/handler/clustering/ClusteringComponentDistributedTest.java b/solr/modules/clustering/src/test/org/apache/solr/handler/clustering/ClusteringComponentDistributedTest.java
index f240b9b8640..87d6e711351 100644
--- a/solr/modules/clustering/src/test/org/apache/solr/handler/clustering/ClusteringComponentDistributedTest.java
+++ b/solr/modules/clustering/src/test/org/apache/solr/handler/clustering/ClusteringComponentDistributedTest.java
@@ -20,7 +20,6 @@ import java.io.IOException;
import java.nio.file.Path;
import java.util.List;
import java.util.function.Consumer;
-import java.util.stream.Collectors;
import org.apache.solr.BaseDistributedSearchTestCase;
import org.apache.solr.SolrTestCaseJ4.SuppressSSL;
import org.apache.solr.client.solrj.response.Cluster;
@@ -118,7 +117,7 @@ public class ClusteringComponentDistributedTest extends BaseDistributedSearchTes
clusters.forEach(
c -> {
sb.append(indent);
- sb.append("- " + c.getLabels().stream().collect(Collectors.joining("; ")));
+ sb.append("- " + String.join("; ", c.getLabels()));
if (!c.getDocs().isEmpty()) {
sb.append(" [" + c.getDocs().size() + "]");
}
diff --git a/solr/modules/clustering/src/test/org/apache/solr/handler/clustering/ClusteringComponentTest.java b/solr/modules/clustering/src/test/org/apache/solr/handler/clustering/ClusteringComponentTest.java
index 4194ac2dc3e..74d7c7a7e92 100644
--- a/solr/modules/clustering/src/test/org/apache/solr/handler/clustering/ClusteringComponentTest.java
+++ b/solr/modules/clustering/src/test/org/apache/solr/handler/clustering/ClusteringComponentTest.java
@@ -130,7 +130,7 @@ public class ClusteringComponentTest extends SolrTestCaseJ4 {
* shorter when highlighter is in use.
*/
@Test
- public void testClusteringOnHighlights() throws Exception {
+ public void testClusteringOnHighlights() {
String query = "+snippet:mine +" + QUERY_TESTSET_SAMPLE_DOCUMENTS;
Consumer<ModifiableSolrParams> common =
@@ -179,7 +179,7 @@ public class ClusteringComponentTest extends SolrTestCaseJ4 {
* check that the results differ.
*/
@Test
- public void testSummaryFragSize() throws Exception {
+ public void testSummaryFragSize() {
String query = "+snippet:mine +" + QUERY_TESTSET_SAMPLE_DOCUMENTS;
Consumer<ModifiableSolrParams> common =
@@ -243,7 +243,7 @@ public class ClusteringComponentTest extends SolrTestCaseJ4 {
/** Test maximum label truncation. */
@Test
- public void testParamMaxLabels() throws Exception {
+ public void testParamMaxLabels() {
List<Cluster<SolrDocument>> clusters =
clusters(
"mock",
@@ -339,7 +339,7 @@ public class ClusteringComponentTest extends SolrTestCaseJ4 {
clusters.forEach(
c -> {
sb.append(indent);
- sb.append("- " + c.getLabels().stream().collect(Collectors.joining("; ")));
+ sb.append("- " + String.join("; ", c.getLabels()));
if (!c.getDocuments().isEmpty()) {
sb.append(" [" + c.getDocuments().size() + "]");
}
diff --git a/solr/modules/cuvs/src/test/org/apache/solr/cuvs/TestCuVSCodecSupportIT.java b/solr/modules/cuvs/src/test/org/apache/solr/cuvs/TestCuVSCodecSupportIT.java
index 0da5bdd86b0..18ff0e51179 100644
--- a/solr/modules/cuvs/src/test/org/apache/solr/cuvs/TestCuVSCodecSupportIT.java
+++ b/solr/modules/cuvs/src/test/org/apache/solr/cuvs/TestCuVSCodecSupportIT.java
@@ -135,16 +135,16 @@ public class TestCuVSCodecSupportIT extends SolrTestCaseJ4 {
if (log.isInfoEnabled()) {
log.info("Rank {}: doc {} (id={}), score: {}", r, sd.doc, doc.get("id"), sd.score);
}
- int idx = Integer.valueOf(doc.get("id"));
+ int idx = Integer.parseInt(doc.get("id"));
assertTrue("Expected doc id is missing:" + idx, expected.contains(idx));
}
- assertTrue(numResults + " TopK results were returned instead of " + TOPK, numResults == TOPK);
+ assertEquals(numResults + " TopK results were returned instead of " + TOPK, TOPK, numResults);
}
private static List<List<Float>> generateRandomVectors(Random random, int size, int dimensions) {
List<List<Float>> dataset = new ArrayList<List<Float>>();
for (int i = 0; i < size; i++) {
- List<Float> row = new ArrayList<Float>();
+ List<Float> row = new ArrayList<>();
for (int j = 0; j < dimensions; j++) {
row.add(random.nextFloat() * 100);
}