From a410053d3bdeadbea2aa69088dcb1a36ad41592c Mon Sep 17 00:00:00 2001 From: Eric Pugh Date: Wed, 19 Aug 2026 10:43:28 -0400 Subject: [PATCH] Small content fixes --- .../java/org/apache/solr/schema/ICUCollationField.java | 8 ++++---- .../DocumentCategorizerUpdateProcessorFactory.java | 5 +---- .../org/apache/solr/schema/TestICUCollationField.java | 2 +- .../solr/schema/TestICUCollationFieldDocValues.java | 4 ++-- .../solr/handler/clustering/FlatKeysAttrVisitor.java | 2 +- .../clustering/ClusteringComponentDistributedTest.java | 3 +-- .../solr/handler/clustering/ClusteringComponentTest.java | 8 ++++---- .../test/org/apache/solr/cuvs/TestCuVSCodecSupportIT.java | 6 +++--- 8 files changed, 17 insertions(+), 21 deletions(-) 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 277bbfc214a7..23d0e41588c0 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 @@ protected void init(IndexSchema schema, Map args) { 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 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 b045c28ac77b..db8abcddcb37 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.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 @@ * *

See the Tutorial - * for the step by step guide. + * for a step-by-step guide. * *

The source field(s) can be configured as either: * @@ -473,8 +472,6 @@ public final UpdateRequestProcessor getInstance( { // 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 de19490f5bc9..b85a5884f0c1 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 void testNegativeRangeQuery() { /** * 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 09bd67d885a7..b9f098b7ad95 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 void testBasicTermQuery() { } /** - * 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 void testNegativeRangeQuery() { /** * 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 31f73b5dcee2..037af6772d27 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 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 f240b9b86406..87d6e7113514 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.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 @@ private StringBuilder toString(List clusters, String indent, StringBuil 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 4194ac2dc3e4..74d7c7a7e928 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 void testParamOtherTopics() throws Exception { * shorter when highlighter is in use. */ @Test - public void testClusteringOnHighlights() throws Exception { + public void testClusteringOnHighlights() { String query = "+snippet:mine +" + QUERY_TESTSET_SAMPLE_DOCUMENTS; Consumer common = @@ -179,7 +179,7 @@ public void testClusteringOnHighlights() throws Exception { * check that the results differ. */ @Test - public void testSummaryFragSize() throws Exception { + public void testSummaryFragSize() { String query = "+snippet:mine +" + QUERY_TESTSET_SAMPLE_DOCUMENTS; Consumer common = @@ -243,7 +243,7 @@ public void testPassingAttributesViaSolrConfig() throws Exception { /** Test maximum label truncation. */ @Test - public void testParamMaxLabels() throws Exception { + public void testParamMaxLabels() { List> clusters = clusters( "mock", @@ -339,7 +339,7 @@ private StringBuilder toString( 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 0da5bdd86b07..18ff0e511795 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 @@ private static void assertSearchResults( 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> generateRandomVectors(Random random, int size, int dimensions) { List> dataset = new ArrayList>(); for (int i = 0; i < size; i++) { - List row = new ArrayList(); + List row = new ArrayList<>(); for (int j = 0; j < dimensions; j++) { row.add(random.nextFloat() * 100); }