mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-07 01:54:22 +00:00
Minor refactors based on feedback
This commit is contained in:
@@ -86,6 +86,7 @@ public abstract class IndexFactoryImpl<T extends IndexableObject, S> implements
|
||||
throws IOException, SolrServerException {
|
||||
final SolrClient solr = solrSearchCore.getSolr();
|
||||
if (solr != null) {
|
||||
// If full text stream(s) were passed in, we'll index them as part of the SolrInputDocument
|
||||
if (streams != null && !streams.isEmpty()) {
|
||||
// limit full text indexing to first 100,000 characters unless configured otherwise
|
||||
final int charLimit = DSpaceServicesFactory.getInstance().getConfigurationService()
|
||||
@@ -110,7 +111,7 @@ public abstract class IndexFactoryImpl<T extends IndexableObject, S> implements
|
||||
if (saxe.getMessage().contains("limit has been reached")) {
|
||||
// log that we only indexed up to that configured limit
|
||||
log.info("Full text is larger than the configured limit (discovery.solr.fulltext.charLimit)."
|
||||
+ " Only the first " + charLimit + " characters were indexed.");
|
||||
+ " Only the first {} characters were indexed.", charLimit);
|
||||
} else {
|
||||
throw new IOException("Tika parsing error. Could not index full text.", saxe);
|
||||
}
|
||||
@@ -128,13 +129,10 @@ public abstract class IndexFactoryImpl<T extends IndexableObject, S> implements
|
||||
|
||||
// Save (parsed) full text to "fulltext" field
|
||||
doc.addField("fulltext", tikaHandler.toString());
|
||||
|
||||
// Add document & commit immediately
|
||||
solr.add(doc);
|
||||
solr.commit(true, true);
|
||||
} else {
|
||||
solr.add(doc);
|
||||
}
|
||||
|
||||
// Add document to index
|
||||
solr.add(doc);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -7,7 +7,6 @@
|
||||
*/
|
||||
package org.dspace.solr;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
@@ -115,7 +114,7 @@ public class MockSolrServer {
|
||||
}
|
||||
|
||||
loadedCores.put(coreName, server);
|
||||
log.info("SOLR Server for core " + coreName + " initialized");
|
||||
log.info("SOLR Server for core {} initialized", coreName);
|
||||
}
|
||||
return server;
|
||||
}
|
||||
@@ -145,7 +144,7 @@ public class MockSolrServer {
|
||||
solrServer.close();
|
||||
usersPerCore.remove(coreName);
|
||||
loadedCores.remove(coreName);
|
||||
log.info("SOLR Server for core " + coreName + " destroyed");
|
||||
log.info("SOLR Server for core {} destroyed", coreName);
|
||||
}
|
||||
|
||||
if (usersPerCore.isEmpty()) {
|
||||
@@ -160,8 +159,8 @@ public class MockSolrServer {
|
||||
*/
|
||||
private static synchronized void initSolrContainer() {
|
||||
if (container == null) {
|
||||
Path solrDir = Paths.get(AbstractDSpaceIntegrationTest.getDspaceDir() + File.separator + "solr");
|
||||
log.info("Initializing SOLR CoreContainer with directory " + solrDir.toAbsolutePath().toString());
|
||||
Path solrDir = Paths.get(AbstractDSpaceIntegrationTest.getDspaceDir(), "solr");
|
||||
log.info("Initializing SOLR CoreContainer with directory {}", solrDir.toAbsolutePath().toString());
|
||||
container = new CoreContainer(solrDir, new Properties());
|
||||
container.load();
|
||||
log.info("SOLR CoreContainer initialized");
|
||||
|
Reference in New Issue
Block a user