Cheshire3 Object Model - Database¶
- class cheshire3.baseObjects.Database(session, config, parent=None)¶
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.
- accumulate_metadata(session, obj)¶
Accumulate metadata (e.g. size) from and object.
- add_record(session, rec)¶
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.
Prepare to index Records.
Perform tasks before Records are to be indexed.
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
Ensure persistence of database metadata.
- index_record(session, rec)¶
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).
Reindex all Records registered with the database.
- remove_record(session, rec)¶
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='>=')¶
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)¶
Search the database, return a ResultSet.
Given a CQL query, execute the query and return a ResultSet object.
- sort(session, resultSets, sortKeys)¶
Merge, sort and return one or more ResultSets.
Take one or more resultSets, merge them and sort based on sortKeys.
- unindex_record(session, rec)¶
Unindex a Record, return the Record.
Sends the Record to all Indexes registered with the Database to be removed/unindexed.
- class cheshire3.database.SimpleDatabase(session, config, parent)¶
Default database implementation
- class cheshire3.database.OptimisingDatabase(session, config, parent)¶
Experimental query optimising database
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.