Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* #%L
* BroadleafCommerce Open Admin Platform
* %%
* Copyright (C) 2009 - 2025 Broadleaf Commerce
* Copyright (C) 2009 - 2026 Broadleaf Commerce
* %%
* Licensed under the Broadleaf Fair Use License Agreement, Version 1.0
* (the "Fair Use License" located at http://license.broadleafcommerce.org/fair_use_license-1.0.txt)
Expand Down Expand Up @@ -74,4 +74,4 @@ protected static boolean getExploitProtection() {
return BLCSystemProperty.resolveBooleanSystemProperty("exploitProtection.xssEnabled", false);
}

}
}
16 changes: 8 additions & 8 deletions common/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -142,11 +142,11 @@
</exclusions>
</dependency>
<dependency>
<groupId>org.hibernate.orm</groupId>
<artifactId>hibernate-core</artifactId>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core-jakarta</artifactId>
</dependency>
<dependency>
<groupId>org.hibernate.orm</groupId>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-jcache</artifactId>
</dependency>
<dependency>
Expand All @@ -171,8 +171,8 @@
<artifactId>easymockclassextension</artifactId>
</dependency>
<dependency>
<groupId>org.hibernate.orm</groupId>
<artifactId>hibernate-envers</artifactId>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-envers-jakarta</artifactId>
</dependency>
<dependency>
<groupId>jakarta.mail</groupId>
Expand Down Expand Up @@ -479,9 +479,9 @@
<artifactId>javassist</artifactId>
</dependency>
<dependency>
<groupId>jakarta.cache</groupId>
<artifactId>jakarta.cache-api</artifactId>
<version>3.0.0</version>
<groupId>javax.cache</groupId>
<artifactId>cache-api</artifactId>
<version>1.1.0</version>
</dependency>
</dependencies>
</project>
4 changes: 4 additions & 0 deletions core/broadleaf-framework/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,10 @@
<groupId>org.apache.solr</groupId>
<artifactId>solr-solrj</artifactId>
</dependency>
<dependency>
<groupId>org.apache.solr</groupId>
<artifactId>solr-solrj-jetty</artifactId>
</dependency>
<dependency>
<groupId>org.apache.zookeeper</groupId>
<artifactId>zookeeper</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
*/
package org.broadleafcommerce.core.search.service.solr;

import org.apache.solr.client.solrj.SolrQuery;
import org.apache.solr.client.solrj.request.SolrQuery;
import org.apache.solr.client.solrj.response.QueryResponse;
import org.apache.solr.common.SolrDocument;
import org.broadleafcommerce.common.extension.AbstractExtensionHandler;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@
import org.apache.solr.client.solrj.SolrRequest;
import org.apache.solr.client.solrj.SolrRequest.METHOD;
import org.apache.solr.client.solrj.SolrServerException;
import org.apache.solr.client.solrj.StreamingResponseCallback;
import org.apache.solr.client.solrj.beans.DocumentObjectBinder;
import org.apache.solr.client.solrj.impl.HttpSolrClient;
import org.apache.solr.client.solrj.response.StreamingResponseCallback;
import org.apache.solr.client.solrj.jetty.HttpJettySolrClient;
import org.apache.solr.client.solrj.response.QueryResponse;
import org.apache.solr.client.solrj.response.SolrPingResponse;
import org.apache.solr.client.solrj.response.UpdateResponse;
Expand All @@ -42,35 +42,35 @@
import java.util.List;

/**
* Wrapper implementation of Solr that delegates to an {@link HttpSolrClient}. With older versions of SolrJ, there was no ability to specify a
* a collection on an {@link HttpSolrClient}. As a result, you needed two different clients, one for each collection. For example, you might have
* Wrapper implementation of Solr that delegates to an {@link HttpJettySolrClient}. With older versions of SolrJ, there was no ability to specify a
* a collection on an {@link HttpJettySolrClient}. As a result, you needed two different clients, one for each collection. For example, you might have
* a client with the base URL: http://localhost:8983/solr/catalogs and another with the base URL of http://localhost:8983/solr/catalogs_reindex.
* <p/>
* What this class allows for is a "defaultCollection". If the base URL is http://localhost:8983/solr for example, and the default collection is "catalog", then a call
* to {@link DelegatingHttpSolrClient#query(new SolrQuery("foo:bar")} will search the "catalog" index, or http://localhost:8983/solr/catalogs. Alternatively, a call to
* {@link DelegatingHttpSolrClient#query("catalogs_reindex", new SolrQuery("foo:bar"))} will search the "catalogs_reindex" index, or http://localhost:8983/solr/catalogs_reindex.
* to {@link DelegatingHttpJettySolrClient#query(new SolrQuery("foo:bar")} will search the "catalog" index, or http://localhost:8983/solr/catalogs. Alternatively, a call to
* {@link DelegatingHttpJettySolrClient#query("catalogs_reindex", new SolrQuery("foo:bar"))} will search the "catalogs_reindex" index, or http://localhost:8983/solr/catalogs_reindex.
* <p>
* The same thing goes for writes. This class simply delegates to the delegate passed into the constructor.
*
* @author Kelly Tisdell
*/
public class DelegatingHttpSolrClient extends SolrClient {
public class DelegatingHttpJettySolrClient extends SolrClient {

@Serial
private static final long serialVersionUID = 1L;

protected final HttpSolrClient delegate;
protected final HttpJettySolrClient delegate;
protected final String defaultCollection;
protected final String defaultCollectionPath;

public DelegatingHttpSolrClient(HttpSolrClient delegate) {
public DelegatingHttpJettySolrClient(HttpJettySolrClient delegate) {
Assert.notNull(delegate, "SolrClient cannot be null.");
this.delegate = delegate;
this.defaultCollection = null;
defaultCollectionPath = null;
}

public DelegatingHttpSolrClient(HttpSolrClient delegate, String defaultCollection) {
public DelegatingHttpJettySolrClient(HttpJettySolrClient delegate, String defaultCollection) {
Assert.notNull(delegate, "SolrClient cannot be null.");
this.delegate = delegate;
if (StringUtils.isNotBlank(defaultCollection)) {
Expand Down Expand Up @@ -643,17 +643,16 @@ public SolrDocumentList getById(Collection<String> ids, SolrParams params) throw
}
}

@Override
public DocumentObjectBinder getBinder() {
return delegate.getBinder();
return DocumentObjectBinder.INSTANCE;
}

@Override
public void close() throws IOException {
delegate.close();
}

public HttpSolrClient getDelegate() {
public HttpJettySolrClient getDelegate() {
return delegate;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
import org.apache.solr.client.solrj.SolrClient;
import org.apache.solr.client.solrj.SolrServerException;
import org.apache.solr.client.solrj.impl.CloudSolrClient;
import org.apache.solr.client.solrj.impl.HttpSolrClient;
import org.apache.solr.client.solrj.jetty.HttpJettySolrClient;
import org.apache.solr.client.solrj.request.CollectionAdminRequest;
import org.broadleafcommerce.common.exception.ExceptionHelper;
import org.broadleafcommerce.common.site.domain.Site;
Expand Down Expand Up @@ -82,7 +82,7 @@ public class SolrConfiguration implements InitializingBean {

/**
* Sets up Solr using multiple clients, one primary, one for reindexing, and one admin to reduce down time during
* indexing. This constructor should be used when setting up HttpSolrClient since no collection names are
* indexing. This constructor should be used when setting up HttpJettySolrClient since no collection names are
* being provided.
* <p>
* The adminServer is just a reference to a SolrClient component for connecting to Solr. In newer
Expand All @@ -102,16 +102,16 @@ public class SolrConfiguration implements InitializingBean {
public SolrConfiguration(SolrClient solrServer, SolrClient reindexServer, SolrClient adminServer) throws IllegalStateException {
//get primary and reindex names from http urls

if (HttpSolrClient.class.isAssignableFrom(solrServer.getClass())) {
this.setPrimaryName(determineCoreName((HttpSolrClient) solrServer));
} else if (DelegatingHttpSolrClient.class.isAssignableFrom(solrServer.getClass())) {
this.setPrimaryName(((DelegatingHttpSolrClient) solrServer).getDefaultCollection());
if (HttpJettySolrClient.class.isAssignableFrom(solrServer.getClass())) {
this.setPrimaryName(determineCoreName((HttpJettySolrClient) solrServer));
} else if (DelegatingHttpJettySolrClient.class.isAssignableFrom(solrServer.getClass())) {
this.setPrimaryName(((DelegatingHttpJettySolrClient) solrServer).getDefaultCollection());
}

if (HttpSolrClient.class.isAssignableFrom(reindexServer.getClass())) {
this.setReindexName(determineCoreName((HttpSolrClient) reindexServer));
} else if (DelegatingHttpSolrClient.class.isAssignableFrom(reindexServer.getClass())) {
this.setReindexName(((DelegatingHttpSolrClient) reindexServer).getDefaultCollection());
if (HttpJettySolrClient.class.isAssignableFrom(reindexServer.getClass())) {
this.setReindexName(determineCoreName((HttpJettySolrClient) reindexServer));
} else if (DelegatingHttpJettySolrClient.class.isAssignableFrom(reindexServer.getClass())) {
this.setReindexName(((DelegatingHttpJettySolrClient) reindexServer).getDefaultCollection());
}

this.setServer(solrServer);
Expand All @@ -121,7 +121,7 @@ public SolrConfiguration(SolrClient solrServer, SolrClient reindexServer, SolrCl

/**
* Sets up Solr using multiple clients, one primary, one for reindexing, and one admin to reduce down time during
* indexing. This constructor should be used when setting up HttpSolrClient since no collection names are
* indexing. This constructor should be used when setting up HttpJettySolrClient since no collection names are
* being provided. Namespace can be specified if managing multiple document sets within the same cores.
* <p>
* The adminServer is just a reference to a SolrClient component for connecting to Solr. In newer
Expand All @@ -146,23 +146,23 @@ public SolrConfiguration(
String namespace
) throws IllegalStateException {
this.setNamespace(namespace);
if (HttpSolrClient.class.isAssignableFrom(solrServer.getClass())) {
this.setPrimaryName(determineCoreName((HttpSolrClient) solrServer));
} else if (DelegatingHttpSolrClient.class.isAssignableFrom(solrServer.getClass())) {
if (((DelegatingHttpSolrClient) solrServer).getDefaultCollection() == null) {
this.setReindexName(determineCoreName(((DelegatingHttpSolrClient) solrServer).getDelegate()));
if (HttpJettySolrClient.class.isAssignableFrom(solrServer.getClass())) {
this.setPrimaryName(determineCoreName((HttpJettySolrClient) solrServer));
} else if (DelegatingHttpJettySolrClient.class.isAssignableFrom(solrServer.getClass())) {
if (((DelegatingHttpJettySolrClient) solrServer).getDefaultCollection() == null) {
this.setReindexName(determineCoreName(((DelegatingHttpJettySolrClient) solrServer).getDelegate()));
} else {
this.setReindexName(((DelegatingHttpSolrClient) solrServer).getDefaultCollection());
this.setReindexName(((DelegatingHttpJettySolrClient) solrServer).getDefaultCollection());
}
}

if (HttpSolrClient.class.isAssignableFrom(reindexServer.getClass())) {
this.setReindexName(determineCoreName((HttpSolrClient) reindexServer));
} else if (DelegatingHttpSolrClient.class.isAssignableFrom(solrServer.getClass())) {
if (((DelegatingHttpSolrClient) reindexServer).getDefaultCollection() == null) {
this.setReindexName(determineCoreName(((DelegatingHttpSolrClient) reindexServer).getDelegate()));
if (HttpJettySolrClient.class.isAssignableFrom(reindexServer.getClass())) {
this.setReindexName(determineCoreName((HttpJettySolrClient) reindexServer));
} else if (DelegatingHttpJettySolrClient.class.isAssignableFrom(solrServer.getClass())) {
if (((DelegatingHttpJettySolrClient) reindexServer).getDefaultCollection() == null) {
this.setReindexName(determineCoreName(((DelegatingHttpJettySolrClient) reindexServer).getDelegate()));
} else {
this.setReindexName(((DelegatingHttpSolrClient) reindexServer).getDefaultCollection());
this.setReindexName(((DelegatingHttpJettySolrClient) reindexServer).getDefaultCollection());
}
}

Expand All @@ -173,7 +173,7 @@ public SolrConfiguration(

/**
* Sets up Solr using multiple clients, one primary, one for reindexing, and one admin to reduce down time during
* indexing. This constructor should be used when setting up LBHttpSolrClients because primaryCoreName and
* indexing. This constructor should be used when setting up LBHttpJettySolrClients because primaryCoreName and
* reindexCoreName need to be provided to SolrConfiguration.
* <p>
* The adminServer is just a reference to a SolrClient component for connecting to Solr. In newer
Expand Down Expand Up @@ -208,7 +208,7 @@ public SolrConfiguration(

/**
* Sets up Solr using multiple clients, one primary, one for reindexing, and one admin to reduce down time during
* indexing. This constructor should be used when setting up LBHttpSolrClients because primaryCoreName and
* indexing. This constructor should be used when setting up LBHttpJettySolrClients because primaryCoreName and
* reindexCoreName need to be provided to SolrConfiguration. Namespace can be specified if managing multiple
* document sets within the same cores.
* <p>
Expand Down Expand Up @@ -431,8 +431,8 @@ public SolrClient getServer() {
/**
* Sets the primary SolrClient instance to communicate with Solr. This is typically one of the following:
* <code>org.apache.solr.client.solrj.embedded.EmbeddedSolrClient</code>,
* <code>org.apache.solr.client.solrj.impl.HttpSolrClient</code>,
* <code>org.apache.solr.client.solrj.impl.LBHttpSolrClient</code>,
* <code>org.apache.solr.client.solrj.impl.HttpJettySolrClient</code>,
* <code>org.apache.solr.client.solrj.impl.LBHttpJettySolrClient</code>,
* or <code>org.apache.solr.client.solrj.impl.CloudSolrClient</code>
*
* @param server SolrClient
Expand All @@ -441,9 +441,8 @@ public SolrClient getServer() {
public void setServer(SolrClient server) throws IllegalStateException {
if (server != null && CloudSolrClient.class.isAssignableFrom(server.getClass())) {
CloudSolrClient cs = (CloudSolrClient) server;
if (StringUtils.isBlank(cs.getDefaultCollection())) {
cs.setDefaultCollection(getPrimaryName());
}
// Note: In Solr 10+, CloudSolrClient is immutable and defaultCollection must be set via builder
// We can only validate here, not set

if (reindexServer != null) {
//If we already have a reindex server set, make sure it's not the same instance as the primary
Expand Down Expand Up @@ -491,9 +490,8 @@ public SolrClient getReindexServer() {
public void setReindexServer(SolrClient server) throws IllegalStateException {
if (server != null && CloudSolrClient.class.isAssignableFrom(server.getClass())) {
CloudSolrClient cs = (CloudSolrClient) server;
if (StringUtils.isBlank(cs.getDefaultCollection())) {
cs.setDefaultCollection(getReindexName());
}
// Note: In Solr 10+, CloudSolrClient is immutable and defaultCollection must be set via builder
// We can only validate here, not set

if (primaryServer != null) {
//If we already have a reindex server set, make sure it's not the same instance as the primary
Expand Down Expand Up @@ -792,7 +790,7 @@ public String getReindexCollectionName() {
return null;
}

protected String determineCoreName(HttpSolrClient httpSolrClient) {
protected String determineCoreName(HttpJettySolrClient httpSolrClient) {
String url = httpSolrClient.getBaseURL();
return url.substring(url.lastIndexOf('/') + 1);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
package org.broadleafcommerce.core.search.service.solr;

import org.apache.solr.client.solrj.SolrClient;
import org.apache.solr.client.solrj.SolrQuery;
import org.apache.solr.client.solrj.request.SolrQuery;
import org.apache.solr.client.solrj.response.QueryResponse;
import org.apache.solr.common.SolrDocument;
import org.apache.solr.common.SolrInputDocument;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@
import org.apache.commons.logging.LogFactory;
import org.apache.commons.text.StringEscapeUtils;
import org.apache.solr.client.solrj.SolrClient;
import org.apache.solr.client.solrj.SolrQuery;
import org.apache.solr.client.solrj.SolrQuery.ORDER;
import org.apache.solr.client.solrj.SolrQuery.SortClause;
import org.apache.solr.client.solrj.request.SolrQuery;
import org.apache.solr.client.solrj.request.SolrQuery.ORDER;
import org.apache.solr.client.solrj.request.SolrQuery.SortClause;
import org.apache.solr.client.solrj.SolrServerException;
import org.apache.solr.client.solrj.impl.CloudSolrClient;
import org.apache.solr.client.solrj.request.CollectionAdminRequest;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
*/
package org.broadleafcommerce.core.search.service.solr;

import org.apache.solr.client.solrj.SolrQuery;
import org.apache.solr.client.solrj.request.SolrQuery;
import org.apache.solr.client.solrj.response.QueryResponse;
import org.apache.solr.common.SolrDocument;
import org.broadleafcommerce.common.extension.ExtensionHandler;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.solr.client.solrj.SolrQuery;
import org.apache.solr.client.solrj.request.SolrQuery;
import org.apache.solr.client.solrj.SolrRequest.METHOD;
import org.apache.solr.client.solrj.SolrServerException;
import org.apache.solr.client.solrj.response.QueryResponse;
Expand Down
Loading
Loading