Contains the main functions/classes for creating, maintaining, and using an index.
Convenience function to create an index in a directory. Takes care of creating a FileStorage object for you.
Parameters: |
|
---|---|
Returns: |
Convenience function for opening an index in a directory. Takes care of creating a FileStorage object for you. dirname is the filename of the directory in containing the index. indexname is the name of the index to create; you only need to specify this if you have multiple indexes within the same storage object.
Parameters: |
|
---|---|
Returns: |
Returns True if dirname contains a Whoosh index.
Parameters: |
|
---|
Returns True if the given Storage object contains a Whoosh index.
Parameters: |
|
---|
Returns a tuple of (release_version, format_version), where release_version is the release version number of the Whoosh code that created the index – e.g. (0, 1, 24) – and format_version is the version number of the on-disk format used for the index – e.g. -102.
The second number (format version) may be useful for figuring out if you need to recreate an index because the format has changed. However, you can just try to open the index and see if you get an IndexVersionError exception.
Note that the release and format version are available as attributes on the Index object in Index.release and Index.version.
Parameters: |
|
---|---|
Returns: | ((major_ver, minor_ver, build_ver), format_ver) |
Returns a tuple of (release_version, format_version), where release_version is the release version number of the Whoosh code that created the index – e.g. (0, 1, 24) – and format_version is the version number of the on-disk format used for the index – e.g. -102.
The second number (format version) may be useful for figuring out if you need to recreate an index because the format has changed. However, you can just try to open the index and see if you get an IndexVersionError exception.
Note that the release and format version are available as attributes on the Index object in Index.release and Index.version.
Parameters: |
|
---|---|
Returns: | ((major_ver, minor_ver, build_ver), format_ver) |
Represents an indexed collection of documents.
Parameters: |
|
---|
Deletes any documents matching a query object.
Returns: | the number of documents deleted. |
---|
Deletes any documents containing “term” in the “fieldname” field. This is useful when you have an indexed field containing a unique ID (such as “pathname”) for each document.
Returns: | the number of documents deleted. |
---|
Returns True if this index is empty (that is, it has never had any documents successfully written to it.
Parameter: | rtype – bool |
---|
Returns an IndexReader object for this index.
Return type: | whoosh.reading.IndexReader |
---|
Returns a new Index object representing the latest generation of this index (if this object is the latest generation, or the backend doesn’t support versioning, returns self).
Returns: | Index |
---|
Returns a Searcher object for this index. Keyword arguments are passed to the Searcher object’s constructor.
Return type: | whoosh.searching.Searcher |
---|
Returns True if this object represents the latest generation of this index. Returns False if this object is not the latest generation (that is, someone else has updated the index since you opened this object).
Parameter: | rtype – bool |
---|
Returns an IndexWriter object for this index.
Return type: | whoosh.writing.IndexWriter |
---|