# Create a storage objectst=FileStorage("indexdir")# Create the directory if it doesn't already existst.create()

The Storage.create() method makes it slightly easier to swap storage
implementations. The create() method handles set-up of the storage
object. For example, FileStorage.create() creates the directory. A
database implementation might create tables. This is designed to let you
avoid putting implementation-specific setup code in your application.

Closes any resources opened by this storage object. For some storage
implementations this will be a no-op, but for others it is necessary
to release locks and/or prevent leaks, so it’s a good idea to call it
when you’re done with a storage object.

indexname – the name of the index within the storage object. You
can use this option to store multiple indexes in the same storage.

indexclass – an optional custom Index sub-class to use to
create the index files. The default is
whoosh.index.FileIndex. This method will call the
create class method on the given class to create the index.

Return a named lock object (implementing .acquire() and
.release() methods). Different storage implementations may use
different lock types with different guarantees. For example, the
RamStorage object uses Python thread locks, while the FileStorage
object uses filesystem-based locks that are valid across different
processes.

Optimizes the storage object. The meaning and cost of “optimizing”
will vary by implementation. For example, a database implementation
might run a garbage collection procedure on the underlying database.

Prior to version 3, the initializer would raise an IOError if the directory
did not exist. As of version 3, the object does not check if the
directory exists at initialization. This change is to support using the
FileStorage.create() method.

Parameters:

path – a path to a directory.

supports_mmap – if True (the default), use the mmap module to
open memory mapped files. You can open the storage object with
supports_mmap=False to force Whoosh to open files normally
instead of with mmap.

readonly – If True, the object will raise an exception if you
attempt to create or rename a file.