Skip to content

Apache Lucene open-source search software

Add missing documentation: In Lucene 5+, instantiating FSDirectory creates the directory in file system if it does not yet exist

Uwe Schindler7b6c0a0126cb
diff --git a/lucene/core/src/java/org/apache/lucene/store/FSDirectory.java b/lucene/core/src/java/org/apache/lucene/store/FSDirectory.java
index c96d682fc81..9b5b23a4607 100644
--- a/lucene/core/src/java/org/apache/lucene/store/FSDirectory.java
+++ b/lucene/core/src/java/org/apache/lucene/store/FSDirectory.java
@@ -114,6 +114,7 @@ public abstract class FSDirectory extends BaseDirectory {
protected final Path directory; // The underlying filesystem directory
/** Create a new FSDirectory for the named location (ctor for subclasses).
+ * The directory is created at the named location if it does not yet exist.
* @param path the path of the directory
* @param lockFactory the lock factory to use, or null for the default
* ({@link NativeFSLockFactory});
@@ -128,6 +129,7 @@ public abstract class FSDirectory extends BaseDirectory {
/** Creates an FSDirectory instance, trying to pick the
* best implementation given the current environment.
* The directory returned uses the {@link NativeFSLockFactory}.
+ * The directory is created at the named location if it does not yet exist.
*
* <p>Currently this returns {@link MMapDirectory} for most Solaris
* and Windows 64-bit JREs, {@link NIOFSDirectory} for other
diff --git a/lucene/core/src/java/org/apache/lucene/store/MMapDirectory.java b/lucene/core/src/java/org/apache/lucene/store/MMapDirectory.java
index bacb78a1f8b..30aa6b0300d 100644
--- a/lucene/core/src/java/org/apache/lucene/store/MMapDirectory.java
+++ b/lucene/core/src/java/org/apache/lucene/store/MMapDirectory.java
@@ -88,6 +88,7 @@ public class MMapDirectory extends FSDirectory {
final int chunkSizePower;
/** Create a new MMapDirectory for the named location.
+ * The directory is created at the named location if it does not yet exist.
*
* @param path the path of the directory
* @param lockFactory the lock factory to use
@@ -98,6 +99,7 @@ public class MMapDirectory extends FSDirectory {
}
/** Create a new MMapDirectory for the named location and {@link FSLockFactory#getDefault()}.
+ * The directory is created at the named location if it does not yet exist.
*
* @param path the path of the directory
* @throws IOException if there is a low-level I/O error
@@ -107,6 +109,7 @@ public class MMapDirectory extends FSDirectory {
}
/** Create a new MMapDirectory for the named location and {@link FSLockFactory#getDefault()}.
+ * The directory is created at the named location if it does not yet exist.
*
* @param path the path of the directory
* @param maxChunkSize maximum chunk size (default is 1 GiBytes for
@@ -120,6 +123,7 @@ public class MMapDirectory extends FSDirectory {
/**
* Create a new MMapDirectory for the named location, specifying the
* maximum chunk size used for memory mapping.
+ * The directory is created at the named location if it does not yet exist.
*
* @param path the path of the directory
* @param lockFactory the lock factory to use, or null for the default
diff --git a/lucene/core/src/java/org/apache/lucene/store/NIOFSDirectory.java b/lucene/core/src/java/org/apache/lucene/store/NIOFSDirectory.java
index 6355a00e715..d47f0efab82 100644
--- a/lucene/core/src/java/org/apache/lucene/store/NIOFSDirectory.java
+++ b/lucene/core/src/java/org/apache/lucene/store/NIOFSDirectory.java
@@ -54,6 +54,7 @@ import java.util.concurrent.Future; // javadoc
public class NIOFSDirectory extends FSDirectory {
/** Create a new NIOFSDirectory for the named location.
+ * The directory is created at the named location if it does not yet exist.
*
* @param path the path of the directory
* @param lockFactory the lock factory to use
@@ -64,6 +65,7 @@ public class NIOFSDirectory extends FSDirectory {
}
/** Create a new NIOFSDirectory for the named location and {@link FSLockFactory#getDefault()}.
+ * The directory is created at the named location if it does not yet exist.
*
* @param path the path of the directory
* @throws IOException if there is a low-level I/O error
diff --git a/lucene/core/src/java/org/apache/lucene/store/SimpleFSDirectory.java b/lucene/core/src/java/org/apache/lucene/store/SimpleFSDirectory.java
index 2168d04c01b..14e6d4c15f1 100644
--- a/lucene/core/src/java/org/apache/lucene/store/SimpleFSDirectory.java
+++ b/lucene/core/src/java/org/apache/lucene/store/SimpleFSDirectory.java
@@ -35,6 +35,7 @@ import java.nio.file.StandardOpenOption;
public class SimpleFSDirectory extends FSDirectory {
/** Create a new SimpleFSDirectory for the named location.
+ * The directory is created at the named location if it does not yet exist.
*
* @param path the path of the directory
* @param lockFactory the lock factory to use
@@ -45,6 +46,7 @@ public class SimpleFSDirectory extends FSDirectory {
}
/** Create a new SimpleFSDirectory for the named location and {@link FSLockFactory#getDefault()}.
+ * The directory is created at the named location if it does not yet exist.
*
* @param path the path of the directory
* @throws IOException if there is a low-level I/O error
diff --git a/lucene/misc/src/java/org/apache/lucene/store/RAFDirectory.java b/lucene/misc/src/java/org/apache/lucene/store/RAFDirectory.java
index 1b50c7ed57d..df8f2c30b6d 100644
--- a/lucene/misc/src/java/org/apache/lucene/store/RAFDirectory.java
+++ b/lucene/misc/src/java/org/apache/lucene/store/RAFDirectory.java
@@ -38,6 +38,7 @@ import java.nio.file.Path;
public class RAFDirectory extends FSDirectory {
/** Create a new RAFDirectory for the named location.
+ * The directory is created at the named location if it does not yet exist.
*
* @param path the path of the directory
* @param lockFactory the lock factory to use
@@ -49,6 +50,7 @@ public class RAFDirectory extends FSDirectory {
}
/** Create a new SimpleFSDirectory for the named location and {@link FSLockFactory#getDefault()}.
+ * The directory is created at the named location if it does not yet exist.
*
* @param path the path of the directory
* @throws IOException if there is a low-level I/O error