Skip to content

Commit

Permalink
Merge pull request DSpace#9082 from TexasDigitalLibrary/DS-7936-7_x
Browse files Browse the repository at this point in the history
[Port dspace-7_x] DS-7936: remove optimize option (-o) from oai import
  • Loading branch information
alanorth authored Sep 20, 2023
2 parents 88f4cda + 2667b8d commit 57fa641
Showing 1 changed file with 2 additions and 12 deletions.
14 changes: 2 additions & 12 deletions dspace-oai/src/main/java/org/dspace/xoai/app/XOAI.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -122,9 +121,8 @@ private List<String> getFileFormats(Item item) {
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;

Expand Down Expand Up @@ -173,12 +171,6 @@ public int index() throws DSpaceSolrIndexerException {
}
solrServerResolver.getServer().commit();

if (optimize) {
println("Optimizing Index");
solrServerResolver.getServer().optimize();
println("Index optimized");
}

// Set last compilation date
xoaiLastCompilationCacheService.put(new Date());
return result;
Expand Down Expand Up @@ -586,7 +578,6 @@ public static void main(String[] argv) throws IOException, ConfigurationExceptio
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");
Expand Down Expand Up @@ -620,7 +611,7 @@ public static void main(String[] argv) throws IOException, ConfigurationExceptio

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);

Expand Down Expand Up @@ -706,7 +697,6 @@ private static void usage() {
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");
Expand Down

0 comments on commit 57fa641

Please sign in to comment.