Skip to content
Permalink

Comparing changes

This is a direct comparison between two commits made in this repository or its related repositories. View the default comparison for this range or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: apache/solr
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 734b0cce8d7c2a5f918f250ea7f188e6d4efd77d
Choose a base ref
..
head repository: apache/solr
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 235167b1f9c9813961c9821f38bafabf8047f8ce
Choose a head ref
Showing with 2,073 additions and 474 deletions.
  1. +3 −0 gradle/validation/forbidden-apis/defaults.all.txt
  2. +16 −0 solr/CHANGES.txt
  3. +27 −33 solr/core/src/java/org/apache/solr/cli/PostTool.java
  4. +3 −3 solr/core/src/java/org/apache/solr/cli/RunExampleTool.java
  5. +2 −1 solr/core/src/java/org/apache/solr/cli/SolrCLI.java
  6. +2 −2 solr/core/src/java/org/apache/solr/cli/StatusTool.java
  7. +49 −38 solr/core/src/java/org/apache/solr/cluster/placement/plugins/OrderedNodePlacementPlugin.java
  8. +4 −4 solr/core/src/java/org/apache/solr/core/CoreDescriptor.java
  9. +3 −3 solr/core/src/java/org/apache/solr/handler/admin/AdminHandlersProxy.java
  10. +4 −3 solr/core/src/java/org/apache/solr/packagemanager/DefaultPackageRepository.java
  11. +2 −2 solr/core/src/java/org/apache/solr/packagemanager/RepositoryManager.java
  12. +2 −2 solr/core/src/java/org/apache/solr/schema/OpenExchangeRatesOrgProvider.java
  13. +2 −0 solr/core/src/java/org/apache/solr/search/QParserPlugin.java
  14. +209 −0 solr/core/src/java/org/apache/solr/search/neural/AbstractVectorQParserBase.java
  15. +5 −178 solr/core/src/java/org/apache/solr/search/neural/KnnQParser.java
  16. +75 −0 solr/core/src/java/org/apache/solr/search/neural/VectorSimilarityQParser.java
  17. +33 −0 solr/core/src/java/org/apache/solr/search/neural/VectorSimilarityQParserPlugin.java
  18. +4 −4 solr/core/src/java/org/apache/solr/security/AllowListUrlChecker.java
  19. +3 −2 solr/core/src/java/org/apache/solr/security/SolrNodeKeyPair.java
  20. +2 −2 solr/core/src/java/org/apache/solr/servlet/SolrRequestParsers.java
  21. +1 −1 solr/core/src/java/org/apache/solr/update/processor/URLClassifyProcessor.java
  22. +23 −15 solr/core/src/test/org/apache/solr/cli/PostToolTest.java
  23. +4 −4 solr/core/src/test/org/apache/solr/cloud/MigrateReplicasTest.java
  24. +2 −2 solr/core/src/test/org/apache/solr/cloud/OverseerRolesTest.java
  25. +9 −10 solr/core/src/test/org/apache/solr/cloud/TestPullReplicaErrorHandling.java
  26. +9 −1 solr/core/src/test/org/apache/solr/cloud/TestRequestForwarding.java
  27. +1 −1 solr/core/src/test/org/apache/solr/cluster/placement/plugins/MinimizeCoresPlacementFactoryTest.java
  28. +370 −0 solr/core/src/test/org/apache/solr/cluster/placement/plugins/SimplePlacementFactoryTest.java
  29. +3 −2 solr/core/src/test/org/apache/solr/handler/ReplicationTestHelper.java
  30. +2 −1 solr/core/src/test/org/apache/solr/handler/TestReplicationHandler.java
  31. +2 −1 solr/core/src/test/org/apache/solr/handler/TestReplicationHandlerBackup.java
  32. +2 −2 solr/core/src/test/org/apache/solr/request/TestRemoteStreaming.java
  33. +8 −6 solr/core/src/test/org/apache/solr/response/transform/TestSubQueryTransformerDistrib.java
  34. +74 −0 solr/core/src/test/org/apache/solr/search/QueryEqualityTest.java
  35. +1 −1 solr/core/src/test/org/apache/solr/search/neural/KnnQParserTest.java
  36. +902 −0 solr/core/src/test/org/apache/solr/search/neural/VectorSimilarityQParserTest.java
  37. +2 −2 solr/core/src/test/org/apache/solr/security/AuditLoggerIntegrationTest.java
  38. +3 −2 solr/core/src/test/org/apache/solr/servlet/HttpSolrCallCloudTest.java
  39. +0 −1 solr/modules/hdfs/src/test/org/apache/solr/hdfs/cloud/MoveReplicaHdfsFailoverTest.java
  40. +4 −3 solr/modules/jwt-auth/src/java/org/apache/solr/security/jwt/JWTIssuerConfig.java
  41. +4 −3 solr/modules/jwt-auth/src/test/org/apache/solr/security/jwt/JWTAuthPluginIntegrationTest.java
  42. +0 −1 solr/solr-ref-guide/modules/deployment-guide/deployment-nav.adoc
  43. +0 −53 solr/solr-ref-guide/modules/deployment-guide/pages/indexupgrader-tool.adoc
  44. +5 −1 solr/solr-ref-guide/modules/deployment-guide/pages/upgrading-a-solr-cluster.adoc
  45. +1 −1 solr/solr-ref-guide/modules/indexing-guide/pages/field-types-included-with-solr.adoc
  46. +76 −30 solr/solr-ref-guide/modules/query-guide/pages/dense-vector-search.adoc
  47. +0 −1 solr/solr-ref-guide/modules/upgrade-notes/pages/major-changes-in-solr-7.adoc
  48. +9 −3 solr/solrj-streaming/src/java/org/apache/solr/client/solrj/io/Tuple.java
  49. +10 −8 solr/solrj/src/java/org/apache/solr/client/solrj/util/ClientUtils.java
  50. +9 −4 solr/solrj/src/java/org/apache/solr/common/params/SolrParams.java
  51. +2 −1 solr/solrj/src/test/org/apache/solr/client/solrj/TestSolrJErrorHandling.java
  52. +2 −2 solr/solrj/src/test/org/apache/solr/client/solrj/embedded/JettyWebappTest.java
  53. +3 −3 solr/solrj/src/test/org/apache/solr/client/solrj/impl/CloudHttp2SolrClientTest.java
  54. +3 −3 solr/solrj/src/test/org/apache/solr/client/solrj/impl/CloudSolrClientTest.java
  55. +42 −0 solr/solrj/src/test/org/apache/solr/common/params/SolrParamTest.java
  56. +4 −9 solr/solrj/src/test/org/apache/solr/common/util/ContentStreamTest.java
  57. +11 −3 solr/test-framework/src/java/org/apache/solr/embedded/JettySolrRunner.java
  58. +2 −1 solr/test-framework/src/java/org/apache/solr/handler/BackupRestoreUtils.java
  59. +2 −1 solr/test-framework/src/java/org/apache/solr/handler/TestRestoreCoreUtil.java
  60. +14 −12 solr/test-framework/src/java/org/apache/solr/util/ExternalPaths.java
  61. +1 −1 versions.lock
  62. +1 −1 versions.props
3 changes: 3 additions & 0 deletions gradle/validation/forbidden-apis/defaults.all.txt
Original file line number Diff line number Diff line change
@@ -83,3 +83,6 @@ java.util.logging.**

@defaultMessage Use List.sort(Comparator) instead of Collections.sort(List, Comparator) please.
java.util.Collections#sort(java.util.List, java.util.Comparator)

@defaultMessage Use URI.toURL() to construct an instance of URL.
java.net.URL#<init>(**)
16 changes: 16 additions & 0 deletions solr/CHANGES.txt
Original file line number Diff line number Diff line change
@@ -100,6 +100,8 @@ Other Changes

* SOLR-17279: Introduce SecurityJson.java file to Test Framework to consolidate setting up authentication in tests. (Rudy Seitz via Eric Pugh)

* SOLR-15582: Remove deprecated APIs in solrj Tuple class. (Christine Poerschke via Eric Pugh)

================== 9.7.0 ==================
New Features
---------------------
@@ -113,6 +115,8 @@ New Features
* SOLR-17277: Circuit breakers may now be configured in a "soft" or "warnOnly" mode in order to more easily test out new thresholds. Soft breakers will log out a
message on each relevant request when tripped, but will not otherwise impact or short circuit the requests. (Jason Gerlowski)

* SOLR-17335: New "vectorSimilarity" QParser for matching documents mased on a minimum vector similarity threshold. (hossman)

Improvements
---------------------
* SOLR-17137: Enable Prometheus exporter to communicate with SSL protected Solr. (Eivind Bergstøl via Eric Pugh)
@@ -129,6 +133,10 @@ Improvements

* SOLR-17109: Give security manager explicit read access to sharedLib (Tomás Fernández Löbbe via Eric Pugh)

* SOLR-17331: OrderedNodePlacementPlugin will give an even more optimal replica placements during ReplicaMigration commands (Houston Putman, Yohann Callea)

* SOLR-15591: Make using debugger in Solr easier by avoiding NPE in ExternalPaths.determineSourceHome. (@charlygrappa via Eric Pugh)

Optimizations
---------------------
* SOLR-17257: Both Minimize Cores and the Affinity replica placement strategies would over-gather
@@ -138,6 +146,8 @@ Optimizations

* SOLR-17269: Prevent the "Coordinator node" feature from registering synthetic cores in ZooKeeper (Patson Luk)

* SOLR-17330: When not set, loadOnStartup defaults to true, which is the default choice for a core. (Pierre Salagnac via Eric Pugh)

Bug Fixes
---------------------
* SOLR-12813: subqueries should respect basic auth. (Rudy Seitz via Eric Pugh)
@@ -163,6 +173,8 @@ Bug Fixes
to the `<updateLog>` element in `solrconfig.xml`, which has long been silently ignored, will now be
respected (Michael Gibney, David Smiley)

* SOLR-17255: Fix bugs in SolrParams.toLocalParamsString() (hossman)

Dependency Upgrades
---------------------
(No changes)
@@ -178,6 +190,10 @@ Other Changes

* SOLR-16503: Use Jetty HTTP2 for SyncStrategy and PeerSyncWithLeader for "recovery" operations (Sanjay Dutt, David Smiley)

* SOLR-16796: Include cyclonedx SBOMs with maven artifacts (Arnout Engelen, Houston Putman, Kevin Risden)

* SOLR-17321: Remove Deprecated URL and replace it with URI in Preparation for Java 21 (Sanjay Dutt, David Smiley, Uwe Schindler)

================== 9.6.1 ==================
Bug Fixes
---------------------
60 changes: 27 additions & 33 deletions solr/core/src/java/org/apache/solr/cli/PostTool.java
Original file line number Diff line number Diff line change
@@ -98,7 +98,7 @@ public class PostTool extends ToolBase {
int recursive = 0;
int delay = 0;
String fileTypes = PostTool.DEFAULT_FILE_TYPES;
URL solrUpdateUrl;
URI solrUpdateUrl;
String credentials;
OutputStream out = null;
String type;
@@ -256,10 +256,10 @@ public void runImpl(CommandLine cli) throws Exception {
solrUpdateUrl = null;
if (cli.hasOption("url")) {
String url = cli.getOptionValue("url");
solrUpdateUrl = new URL(url);
solrUpdateUrl = new URI(url);
} else if (cli.hasOption("c")) {
String url = SolrCLI.getDefaultSolrUrl() + "/solr/" + cli.getOptionValue("c") + "/update";
solrUpdateUrl = new URL(url);
solrUpdateUrl = new URI(url);
} else {
throw new IllegalArgumentException(
"Must specify either -url or -c parameter to post documents.");
@@ -389,7 +389,7 @@ private void doWebMode() {
numPagesPosted = postWebPages(args, 0, out);
info(numPagesPosted + " web pages indexed.");

} catch (MalformedURLException e) {
} catch (URISyntaxException e) {
warn("Wrong URL trying to append /extract to " + solrUpdateUrl);
}
}
@@ -515,7 +515,7 @@ int postFiles(File[] files, OutputStream out, String type) {
postFile(srcFile, out, type);
Thread.sleep(delay * 1000L);
filesPosted++;
} catch (InterruptedException | MalformedURLException e) {
} catch (InterruptedException | URISyntaxException e) {
throw new RuntimeException(e);
}
}
@@ -623,8 +623,8 @@ protected int webCrawl(int level, OutputStream out) {
PostTool.PageFetcherResult result = pageFetcher.readPageFromUrl(url);
if (result.httpStatus == 200) {
url = (result.redirectUrl != null) ? result.redirectUrl : url;
URL postUrl =
new URL(
URI postUri =
new URI(
appendParam(
solrUpdateUrl.toString(),
"literal.id="
@@ -638,7 +638,7 @@ protected int webCrawl(int level, OutputStream out) {
null,
out,
result.contentType,
postUrl);
postUri);
if (success) {
info("POSTed web resource " + url + " (depth: " + level + ")");
Thread.sleep(delay * 1000L);
@@ -651,7 +651,7 @@ protected int webCrawl(int level, OutputStream out) {
new ByteArrayInputStream(
content.array(), content.arrayOffset(), content.limit()),
result.contentType,
postUrl);
postUri);
subStack.addAll(children);
}
} else {
@@ -782,10 +782,10 @@ public static String appendParam(String url, String param) {
}

/** Opens the file and posts its contents to the solrUrl, writes to response to output. */
public void postFile(File file, OutputStream output, String type) throws MalformedURLException {
public void postFile(File file, OutputStream output, String type) throws URISyntaxException {
InputStream is = null;

URL url = solrUpdateUrl;
URI uri = solrUpdateUrl;
String suffix = "";
if (auto) {
if (type == null) {
@@ -797,7 +797,7 @@ public void postFile(File file, OutputStream output, String type) throws Malform
if (type.equals("application/json") && !PostTool.FORMAT_SOLR.equals(format)) {
suffix = "/json/docs";
String urlStr = appendUrlPath(solrUpdateUrl, suffix).toString();
url = new URL(urlStr);
uri = new URI(urlStr);
} else if (type.equals("application/xml")
|| type.equals("text/csv")
|| type.equals("application/json")) {
@@ -815,7 +815,7 @@ public void postFile(File file, OutputStream output, String type) throws Malform
urlStr =
appendParam(urlStr, "literal.id=" + URLEncoder.encode(file.getAbsolutePath(), UTF_8));
}
url = new URL(urlStr);
uri = new URI(urlStr);
}
} else {
if (type == null) {
@@ -838,7 +838,7 @@ public void postFile(File file, OutputStream output, String type) throws Malform
+ " to [base]"
+ suffix);
is = new FileInputStream(file);
postData(is, file.length(), output, type, url);
postData(is, file.length(), output, type, uri);
} catch (IOException e) {
warn("Can't open/read file: " + file);
} finally {
@@ -856,18 +856,13 @@ public void postFile(File file, OutputStream output, String type) throws Malform
/**
* Appends to the path of the URL
*
* @param url the URL
* @param uri the URI
* @param append the path to append
* @return the final URL version
*/
protected static URL appendUrlPath(URL url, String append) throws MalformedURLException {
return new URL(
url.getProtocol()
+ "://"
+ url.getAuthority()
+ url.getPath()
+ append
+ (url.getQuery() != null ? "?" + url.getQuery() : ""));
protected static URI appendUrlPath(URI uri, String append) throws URISyntaxException {
var newPath = uri.getPath() + append;
return new URI(uri.getScheme(), uri.getAuthority(), newPath, uri.getQuery(), uri.getFragment());
}

/**
@@ -890,7 +885,7 @@ protected static String guessType(File file) {
* @return true if success
*/
public boolean postData(
InputStream data, Long length, OutputStream output, String type, URL url) {
InputStream data, Long length, OutputStream output, String type, URI uri) {
if (dryRun) {
return true;
}
@@ -902,7 +897,7 @@ public boolean postData(
HttpURLConnection urlConnection = null;
try {
try {
urlConnection = (HttpURLConnection) url.openConnection();
urlConnection = (HttpURLConnection) (uri.toURL()).openConnection();
try {
urlConnection.setRequestMethod("POST");
} catch (ProtocolException e) {
@@ -1200,9 +1195,9 @@ public boolean isDisallowedByRobots(URL url) {
disallows = new ArrayList<>();
URL urlRobot;
try {
urlRobot = new URL(strRobot);
urlRobot = new URI(strRobot).toURL();
disallows = parseRobotsTxt(urlRobot.openStream());
} catch (MalformedURLException e) {
} catch (URISyntaxException | MalformedURLException e) {
return true; // We cannot trust this robots URL, should not happen
} catch (IOException e) {
// There is no robots.txt, will cache an empty disallow list
@@ -1250,17 +1245,16 @@ protected List<String> parseRobotsTxt(InputStream is) throws IOException {
* @param url the URL of the web page
* @param is the input stream of the page
* @param type the content-type
* @param postUrl the URL (typically /solr/extract) in order to pull out links
* @param postUri the URI (typically /solr/extract) in order to pull out links
* @return a set of URIs parsed from the page
*/
protected Set<URI> getLinksFromWebPage(URL url, InputStream is, String type, URL postUrl) {
protected Set<URI> getLinksFromWebPage(URL url, InputStream is, String type, URI postUri) {
Set<URI> linksFromPage = new HashSet<>();

try {
ByteArrayOutputStream os = new ByteArrayOutputStream();
URL extractUrl = new URL(appendParam(postUrl.toString(), "extractOnly=true"));
extractUrl = new URL(appendParam(extractUrl.toString(), "wt=xml"));
boolean success = postData(is, null, os, type, extractUrl);
URI extractUri = new URI(appendParam(postUri.toString(), "extractOnly=true"));
boolean success = postData(is, null, os, type, extractUri);
if (success) {
Document d = makeDom(os.toByteArray());
String innerXml = getXP(d, "/response/str/text()[1]", false);
@@ -1279,7 +1273,7 @@ protected Set<URI> getLinksFromWebPage(URL url, InputStream is, String type, URL
}
}
}
} catch (MalformedURLException e) {
} catch (URISyntaxException e) {
warn("Malformed URL " + url);
} catch (IOException e) {
warn("IOException opening URL " + url + ": " + e.getMessage());
6 changes: 3 additions & 3 deletions solr/core/src/java/org/apache/solr/cli/RunExampleTool.java
Original file line number Diff line number Diff line change
@@ -22,7 +22,7 @@
import java.io.InputStream;
import java.io.PrintStream;
import java.net.Socket;
import java.net.URL;
import java.net.URI;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.util.Arrays;
@@ -890,7 +890,7 @@ protected Map<String, Object> getNodeStatus(String solrUrl, String credentials,
StatusTool statusTool = new StatusTool();
if (verbose) echo("\nChecking status of Solr at " + solrUrl + " ...");

URL solrURL = new URL(solrUrl);
URI solrURI = new URI(solrUrl);
Map<String, Object> nodeStatus =
statusTool.waitToSeeSolrUp(solrUrl, credentials, maxWaitSecs, TimeUnit.SECONDS);
nodeStatus.put("baseUrl", solrUrl);
@@ -900,7 +900,7 @@ protected Map<String, Object> getNodeStatus(String solrUrl, String credentials,
if (verbose)
echo(
"\nSolr is running on "
+ solrURL.getPort()
+ solrURI.getPort()
+ " in "
+ mode
+ " mode with status:\n"
3 changes: 2 additions & 1 deletion solr/core/src/java/org/apache/solr/cli/SolrCLI.java
Original file line number Diff line number Diff line change
@@ -28,6 +28,7 @@
import java.io.IOException;
import java.lang.invoke.MethodHandles;
import java.net.SocketException;
import java.net.URI;
import java.net.URL;
import java.util.ArrayList;
import java.util.Arrays;
@@ -359,7 +360,7 @@ private static Set<String> findClasses(String path, String packageName) throws E
Set<String> classes = new TreeSet<>();
if (path.startsWith("file:") && path.contains("!")) {
String[] split = path.split("!");
URL jar = new URL(split[0]);
URL jar = new URI(split[0]).toURL();
try (ZipInputStream zip = new ZipInputStream(jar.openStream())) {
ZipEntry entry;
while ((entry = zip.getNextEntry()) != null) {
4 changes: 2 additions & 2 deletions solr/core/src/java/org/apache/solr/cli/StatusTool.java
Original file line number Diff line number Diff line change
@@ -18,7 +18,7 @@
package org.apache.solr.cli;

import java.io.PrintStream;
import java.net.URL;
import java.net.URI;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
@@ -94,7 +94,7 @@ public void runImpl(CommandLine cli) throws Exception {
int maxWaitSecs = Integer.parseInt(cli.getOptionValue("maxWaitSecs", "0"));
String solrUrl = SolrCLI.normalizeSolrUrl(cli);
if (maxWaitSecs > 0) {
int solrPort = (new URL(solrUrl)).getPort();
int solrPort = new URI(solrUrl).getPort();
echo("Waiting up to " + maxWaitSecs + " seconds to see Solr running on port " + solrPort);
try {
waitToSeeSolrUp(
Loading