mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-18 15:33:09 +00:00
Added ability to perform Solr optimize on the search/discovery core. Can be run with ./dspace update-discovery-index -o
Issue #DS-615 - Ability to perform maintenance on SOLR with solr.optimize git-svn-id: http://scm.dspace.org/svn/repo/dspace/trunk@5751 9c30dcfa-912a-0410-8fc2-9e0234be79fd
This commit is contained in:
@@ -109,6 +109,9 @@ public class IndexClient {
|
|||||||
options.addOption(OptionBuilder.isRequired(false).withDescription(
|
options.addOption(OptionBuilder.isRequired(false).withDescription(
|
||||||
"print this help message").create("h"));
|
"print this help message").create("h"));
|
||||||
|
|
||||||
|
options.addOption(OptionBuilder.isRequired(false).withDescription(
|
||||||
|
"optimize search solr core").create("o"));
|
||||||
|
|
||||||
try {
|
try {
|
||||||
line = new PosixParser().parse(options, args);
|
line = new PosixParser().parse(options, args);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
@@ -141,6 +144,9 @@ public class IndexClient {
|
|||||||
} else if (line.hasOption("b")) {
|
} else if (line.hasOption("b")) {
|
||||||
log.info("(Re)building index from scratch.");
|
log.info("(Re)building index from scratch.");
|
||||||
indexer.createIndex(context);
|
indexer.createIndex(context);
|
||||||
|
} else if (line.hasOption("o")) {
|
||||||
|
log.info("Optimizing search core.");
|
||||||
|
indexer.optimize();
|
||||||
} else {
|
} else {
|
||||||
log.info("Updating and Cleaning Index");
|
log.info("Updating and Cleaning Index");
|
||||||
indexer.cleanIndex(line.hasOption("f"));
|
indexer.cleanIndex(line.hasOption("f"));
|
||||||
|
@@ -80,4 +80,6 @@ public interface IndexingService {
|
|||||||
|
|
||||||
void cleanIndex(boolean force) throws IOException,
|
void cleanIndex(boolean force) throws IOException,
|
||||||
SQLException, SearchServiceException;
|
SQLException, SearchServiceException;
|
||||||
|
|
||||||
|
void optimize();
|
||||||
}
|
}
|
||||||
|
@@ -423,6 +423,25 @@ public class SolrServiceImpl implements SearchService, IndexingService {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Maintenance to keep a SOLR index efficient.
|
||||||
|
* Note: This might take a long time.
|
||||||
|
*/
|
||||||
|
public void optimize() {
|
||||||
|
try {
|
||||||
|
long start = System.currentTimeMillis();
|
||||||
|
System.out.println("SOLR Search Optimize -- Process Started:"+start);
|
||||||
|
getSolr().optimize();
|
||||||
|
long finish = System.currentTimeMillis();
|
||||||
|
System.out.println("SOLR Search Optimize -- Process Finished:"+finish);
|
||||||
|
System.out.println("SOLR Search Optimize -- Total time taken:"+(finish-start) + " (ms).");
|
||||||
|
} catch (SolrServerException sse) {
|
||||||
|
System.err.println(sse.getMessage());
|
||||||
|
} catch (IOException ioe) {
|
||||||
|
System.err.println(ioe.getMessage());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// //////////////////////////////////
|
// //////////////////////////////////
|
||||||
|
@@ -57,6 +57,7 @@
|
|||||||
(Peter Dietz)
|
(Peter Dietz)
|
||||||
- [DS-192] Bitstreams should be returned ordered
|
- [DS-192] Bitstreams should be returned ordered
|
||||||
- [DS-549] Added <a name> anchors in XMLUI
|
- [DS-549] Added <a name> anchors in XMLUI
|
||||||
|
- [DS-615] Added ability to perform Solr optimize on the search/discovery core.
|
||||||
|
|
||||||
(Stuart Lewis, Christophe Dupriez)
|
(Stuart Lewis, Christophe Dupriez)
|
||||||
- [DS-686] Incorrect use of UTF8 in DSpaceCSV
|
- [DS-686] Incorrect use of UTF8 in DSpaceCSV
|
||||||
|
Reference in New Issue
Block a user