MCPcopy Create free account
hub / github.com/apache/solr / findDataDir

Method findDataDir

solr/core/src/java/org/apache/solr/core/SolrCore.java:1472–1493  ·  view source on GitHub ↗

Locate the data directory for a given config and core descriptor. @param directoryFactory The directory factory to use if necessary to calculate an absolute path. Should be the same as what will be used to open the data directory later. @param dataDir An optional hint to the data directory loca

(
      DirectoryFactory directoryFactory,
      String dataDir,
      SolrConfig config,
      CoreDescriptor coreDescriptor)

Source from the content-addressed store, hash-verified

1470 * @param directoryFactory The directory factory to use if necessary to calculate an absolute
1471 * path. Should be the same as what will be used to open the data directory later.
1472 * @param dataDir An optional hint to the data directory location. Will be normalized and used if
1473 * not null.
1474 * @param config A solr config to retrieve the default data directory location, if used.
1475 * @param coreDescriptor descriptor to load the actual data dir from, if not using the default.
1476 * @return a normalized data directory name
1477 * @throws SolrException if the data directory cannot be loaded from the core descriptor
1478 */
1479 static String findDataDir(
1480 DirectoryFactory directoryFactory,
1481 String dataDir,
1482 SolrConfig config,
1483 CoreDescriptor coreDescriptor) {
1484 if (dataDir == null) {
1485 if (coreDescriptor.usingDefaultDataDir()) {
1486 dataDir = config.getDataDir();
1487 }
1488 if (dataDir == null) {
1489 try {
1490 dataDir = coreDescriptor.getDataDir();
1491 if (!directoryFactory.isAbsolute(dataDir)) {
1492 dataDir = directoryFactory.getDataHome(coreDescriptor);
1493 }
1494 } catch (IOException e) {
1495 throw new SolrException(ErrorCode.SERVER_ERROR, e);
1496 }

Callers 2

resetIndexDirectoryMethod · 0.95
initDataDirMethod · 0.95

Calls 5

normalizeDirMethod · 0.95
usingDefaultDataDirMethod · 0.80
getDataHomeMethod · 0.80
getDataDirMethod · 0.45
isAbsoluteMethod · 0.45

Tested by

no test coverage detected