mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-07 01:54:22 +00:00
Merge remote-tracking branch 'upstream/main' into pr-8923-b
This commit is contained in:
@@ -189,7 +189,10 @@ public class GenerateSitemaps {
|
||||
*/
|
||||
public static void generateSitemaps(boolean makeHTMLMap, boolean makeSitemapOrg) throws SQLException, IOException {
|
||||
String uiURLStem = configurationService.getProperty("dspace.ui.url");
|
||||
String sitemapStem = uiURLStem + "/sitemap";
|
||||
if (!uiURLStem.endsWith("/")) {
|
||||
uiURLStem = uiURLStem + '/';
|
||||
}
|
||||
String sitemapStem = uiURLStem + "sitemap";
|
||||
|
||||
File outputDir = new File(configurationService.getProperty("sitemap.dir"));
|
||||
if (!outputDir.exists() && !outputDir.mkdir()) {
|
||||
@@ -212,7 +215,7 @@ public class GenerateSitemaps {
|
||||
List<Community> comms = communityService.findAll(c);
|
||||
|
||||
for (Community comm : comms) {
|
||||
String url = uiURLStem + "/communities/" + comm.getID();
|
||||
String url = uiURLStem + "communities/" + comm.getID();
|
||||
|
||||
if (makeHTMLMap) {
|
||||
html.addURL(url, null);
|
||||
@@ -227,7 +230,7 @@ public class GenerateSitemaps {
|
||||
List<Collection> colls = collectionService.findAll(c);
|
||||
|
||||
for (Collection coll : colls) {
|
||||
String url = uiURLStem + "/collections/" + coll.getID();
|
||||
String url = uiURLStem + "collections/" + coll.getID();
|
||||
|
||||
if (makeHTMLMap) {
|
||||
html.addURL(url, null);
|
||||
@@ -259,11 +262,11 @@ public class GenerateSitemaps {
|
||||
&& StringUtils.isNotBlank(discoverResult.getSearchDocument(
|
||||
discoverResult.getIndexableObjects().get(0)).get(0).getSearchFieldValues("entityType").get(0))
|
||||
) {
|
||||
url = uiURLStem + "/entities/" + StringUtils.lowerCase(discoverResult.getSearchDocument(
|
||||
url = uiURLStem + "entities/" + StringUtils.lowerCase(discoverResult.getSearchDocument(
|
||||
discoverResult.getIndexableObjects().get(0))
|
||||
.get(0).getSearchFieldValues("entityType").get(0)) + "/" + i.getID();
|
||||
} else {
|
||||
url = uiURLStem + "/items/" + i.getID();
|
||||
url = uiURLStem + "items/" + i.getID();
|
||||
}
|
||||
Date lastMod = i.getLastModified();
|
||||
|
||||
|
@@ -90,13 +90,11 @@ public class HandleDAOImpl extends AbstractHibernateDAO<Handle> implements Handl
|
||||
|
||||
@Override
|
||||
public long countHandlesByPrefix(Context context, String prefix) throws SQLException {
|
||||
|
||||
|
||||
CriteriaBuilder criteriaBuilder = getCriteriaBuilder(context);
|
||||
CriteriaQuery<Long> criteriaQuery = criteriaBuilder.createQuery(Long.class);
|
||||
CriteriaQuery criteriaQuery = getCriteriaQuery(criteriaBuilder, Handle.class);
|
||||
|
||||
Root<Handle> handleRoot = criteriaQuery.from(Handle.class);
|
||||
criteriaQuery.select(criteriaBuilder.count(criteriaQuery.from(Handle.class)));
|
||||
criteriaQuery.select(handleRoot);
|
||||
criteriaQuery.where(criteriaBuilder.like(handleRoot.get(Handle_.handle), prefix + "%"));
|
||||
return countLong(context, criteriaQuery, criteriaBuilder, handleRoot);
|
||||
}
|
||||
|
@@ -85,7 +85,6 @@ public class XOAI {
|
||||
|
||||
// needed because the solr query only returns 10 rows by default
|
||||
private final Context context;
|
||||
private boolean optimize;
|
||||
private final boolean verbose;
|
||||
private boolean clean;
|
||||
|
||||
@@ -122,9 +121,8 @@ public class XOAI {
|
||||
return formats;
|
||||
}
|
||||
|
||||
public XOAI(Context context, boolean optimize, boolean clean, boolean verbose) {
|
||||
public XOAI(Context context, boolean clean, boolean verbose) {
|
||||
this.context = context;
|
||||
this.optimize = optimize;
|
||||
this.clean = clean;
|
||||
this.verbose = verbose;
|
||||
|
||||
@@ -173,12 +171,6 @@ public class XOAI {
|
||||
}
|
||||
solrServerResolver.getServer().commit();
|
||||
|
||||
if (optimize) {
|
||||
println("Optimizing Index");
|
||||
solrServerResolver.getServer().optimize();
|
||||
println("Index optimized");
|
||||
}
|
||||
|
||||
// Set last compilation date
|
||||
xoaiLastCompilationCacheService.put(new Date());
|
||||
return result;
|
||||
@@ -586,7 +578,6 @@ public class XOAI {
|
||||
CommandLineParser parser = new DefaultParser();
|
||||
Options options = new Options();
|
||||
options.addOption("c", "clear", false, "Clear index before indexing");
|
||||
options.addOption("o", "optimize", false, "Optimize index at the end");
|
||||
options.addOption("v", "verbose", false, "Verbose output");
|
||||
options.addOption("h", "help", false, "Shows some help");
|
||||
options.addOption("n", "number", true, "FOR DEVELOPMENT MUST DELETE");
|
||||
@@ -620,7 +611,7 @@ public class XOAI {
|
||||
|
||||
if (COMMAND_IMPORT.equals(command)) {
|
||||
ctx = new Context(Context.Mode.READ_ONLY);
|
||||
XOAI indexer = new XOAI(ctx, line.hasOption('o'), line.hasOption('c'), line.hasOption('v'));
|
||||
XOAI indexer = new XOAI(ctx, line.hasOption('c'), line.hasOption('v'));
|
||||
|
||||
applicationContext.getAutowireCapableBeanFactory().autowireBean(indexer);
|
||||
|
||||
@@ -706,7 +697,6 @@ public class XOAI {
|
||||
System.out.println(" " + COMMAND_IMPORT + " - To import DSpace items into OAI index and cache system");
|
||||
System.out.println(" " + COMMAND_CLEAN_CACHE + " - Cleans the OAI cached responses");
|
||||
System.out.println("> Parameters:");
|
||||
System.out.println(" -o Optimize index after indexing (" + COMMAND_IMPORT + " only)");
|
||||
System.out.println(" -c Clear index (" + COMMAND_IMPORT + " only)");
|
||||
System.out.println(" -v Verbose output");
|
||||
System.out.println(" -h Shows this text");
|
||||
|
Reference in New Issue
Block a user