Cheshire3 Object Model - Database¶
API¶
- class cheshire3.baseObjects.Database(session, config, parent=None)[source]¶
A Database is a collection of Records and Indexes.
It is responsible for maintaining and allowing access to its components, as well as metadata associated with the collections. It must be able to interpret a request, splitting it amongst its known resources and then recombine the values into a single response.
- add_record(session, rec)[source]¶
Ensure that a Record is registered with the database.
This method does not ensure persistence of the Record, nor index it, just perform registration, and accumulate its metadata.
- begin_indexing(session)[source]¶
Prepare to index Records.
Perform tasks before Records are to be indexed.
- commit_indexing(session)[source]¶
Finalize indexing, commit data to persistent storage.
Perform tasks after Records have been sent to all Indexes. For example, commit any temporary data to IndexStores
- index_record(session, rec)[source]¶
Index a Record, return the Record.
Send the Record to all Indexes registered with the Database to be indexed and then return the Record (for the sake of Workflows).
- remove_record(session, rec)[source]¶
Unregister the Record.
This method does not delete the Record, nor unindex it, just de-registers the Record and subtracts its metadata from the whole.
- scan(session, clause, nTerms, direction='>=')[source]¶
Scan (browse) through an Index to return a list of terms.
Given a single clause CQL query, resolve to the appropriate Index and return an ordered term list with document frequencies and total occurrences with a maximum of nTerms items. Direction specifies whether to move backwards or forwards from the term given in clause.
- search(session, query)[source]¶
Search the database, return a ResultSet.
Given a CQL query, execute the query and return a ResultSet object.
Implementations¶
Configurations¶
There are no pre-configured databases as this is totally application specific. Configuring a database it your primary task when beginning to use Cheshire3 for your data. There are some example databases including configuration available in the Cheshire3 Download Site.
You can also obtain a default Database configuration using cheshire3-init (see Cheshire3 Commands Reference for details.)