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

Method getNewIndexDir

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

Returns the indexdir as given in index.properties. If index.properties exists in dataDir and there is a property index available, and it points to a valid directory in dataDir that is returned. Else dataDir/index is returned. Only called for creating new indexSearchers and indexwriters. Use t

()

Source from the content-addressed store, hash-verified

396 /**
397 * Returns the indexdir as given in index.properties. If index.properties exists in dataDir and
398 * there is a property <i>index</i> available, and it points to a valid directory in dataDir that
399 * is returned. Else dataDir/index is returned. Only called for creating new indexSearchers and
400 * indexwriters. Use the getIndexDir() method to know the active index directory
401 *
402 * @return the indexdir as given in index.properties
403 * @throws SolrException if for any reason an index directory cannot be determined.
404 */
405 public String getNewIndexDir() {
406 Directory dir = null;
407 try {
408 dir =
409 getDirectoryFactory()
410 .get(getDataDir(), DirContext.META_DATA, getSolrConfig().indexConfig.lockType);
411 String result = getIndexPropertyFromPropFile(dir);
412 if (!result.equals(lastNewIndexDir)) {
413 log.debug("New index directory detected: old={} new={}", lastNewIndexDir, result);
414 }
415 lastNewIndexDir = result;
416 return result;
417 } catch (IOException e) {
418 String errorMessage = "Error in getNewIndexDir, exception: ";
419 log.error(errorMessage, e);
420 // See SOLR-11687. It is inadvisable to assume we can do the right thing for any but a small
421 // number of exceptions that were caught and swallowed in getIndexProperty.
422 throw new SolrException(ErrorCode.SERVER_ERROR, errorMessage, e);
423 } finally {
424 if (dir != null) {
425 try {
426 getDirectoryFactory().release(dir);
427 } catch (IOException e) {
428 log.error("Exception releasing {}", dir, e);

Callers 10

testSearcherEventsMethod · 0.95
getIndexDirMethod · 0.95
reloadMethod · 0.95
initIndexMethod · 0.95
openNewSearcherMethod · 0.95
replicateMethod · 0.80
createMainIndexWriterMethod · 0.80
getDirectoryMethod · 0.80

Calls 9

getDirectoryFactoryMethod · 0.95
getDataDirMethod · 0.95
getSolrConfigMethod · 0.95
debugMethod · 0.80
getMethod · 0.65
releaseMethod · 0.65
equalsMethod · 0.45
errorMethod · 0.45

Tested by 2

testSearcherEventsMethod · 0.76