SEARCH-300: Moving the content store out of solrhome.

This commit is contained in:
Gethin James
2017-01-31 16:24:03 +01:00
parent 88f350388a
commit d0274e35a0
2 changed files with 14 additions and 2 deletions
@@ -60,7 +60,7 @@ import org.slf4j.LoggerFactory;
public class SolrContentStore implements ContentStore
{
protected final static Logger log = LoggerFactory.getLogger(SolrContentStore.class);
private static final String CONTENT_STORE = "ContentStore";
private static final String CONTENT_STORE = "contentstore";
/**
* Constructor.
* @param solrHome
@@ -72,7 +72,13 @@ public class SolrContentStore implements ContentStore
throw new RuntimeException("Path to SOLR_HOME is required");
}
String path = SolrResourceLoader.normalizeDir(solrHome) + CONTENT_STORE;
File solrHomeFile = new File(SolrResourceLoader.normalizeDir(solrHome));
if (!solrHomeFile.exists()) {
//Its very unlikely that solrHome would not exist so we will log an error
//but continue because solr.content.dir may be specified, so it keeps working
log.error(solrHomeFile.getAbsolutePath()+ " does not exist.");
}
String path = solrHomeFile.getParent()+"/"+CONTENT_STORE;
File rootFile = new File(ConfigUtil.locateProperty("solr.content.dir", path));
try
@@ -241,4 +241,10 @@ public class SolrContentStoreTest
document = solrContentStore.retrieveDocFromSolrContentStore(DEFAULT_TENANT, 0);
Assert.assertNull(document);
}
@Test
public void nonExistentSolrHome() throws IOException {
SolrContentStore solrContentStore = new SolrContentStore("bob");
Assert.assertNotNull(solrContentStore);
}
}