|  | ## Cheshire3 Object Model: Class Index

Module baseObjects :: Class Index

## Class Index
source code

Object Tree:

               object --+
                        |
    configParser.C3Object --+
                            |
                           Index

Known Subclasses:
  index.SimpleIndex, index.RecordIdentifierIndex

An Index is an object which defines an access point into records and is responsable for extracting that information from them. It can then store the information extracted in an IndexStore. The entry point can be defined using one or more XPath expressions, and the extraction process can be defined using a workflow chain of standard objects. These chains must start with an Extractor, but from there might then include PreParsers, Parsers, Transformers, Normalizers and even other Indexes. The index can also be the last object in a regular Workflow, so long as an XPath object is used to find the data in the record immediately before an Extractor.
Instance Methods

begin_indexing(self, session) Perform tasks before indexing any records
commit_indexing(self, session) Perform tasks after records have been indexed
construct_item(self, session, term, rsitype="") Take a single item, as stored in this Index, and produce a ResultSetItem representation.
construct_resultSet(self, session, terms, queryHash={}) Take a list of terms and produce an appropriate ResultSet object.
delete_record(self, session, record) Delete all the terms of the given record from the indexes.
deserialise_terms(self, session, data) Callback from IndexStore to take serialised data and produce list of terms and document references.
index_record(self, session, record) Accept a record to index.
merge_terms(self, session, structTerms, newTerms, op="replace", recs=0, occs=0) Callback from IndexStore to take two sets of terms and merge them together.
scan(self, session, clause) Produce an ordered term list with document frequencies and total occurences
search(self, session, clause) Search this particular index given a CQL clause, return a resultSet object
serialise_terms(self, session, termId, terms, recs=0, occs=0) Callback from IndexStore to serialise list of terms and document references to be stored
sort(self, session, resultSet) Sort a result set based on the values extracted according to this index.
Inherited from `configParser.C3Object`: `__init__`, `auth_function`, `get_config`, `get_default`, `get_object`, `get_path`, `get_setting`, `log_function`, `unauth_function`, `unlog_function` Inherited from `configParser.C3Object` (private): `_getDomFromFile`, `_handleConfigNode`, `_parseIncludes`, `_recurseSubConfigs`, `_verifyDefault`, `_verifyOption`, `_verifySetting` Inherited from `object`: `__delattr__`, `__getattribute__`, `__hash__`, `__new__`, `__reduce__`, `__reduce_ex__`, `__repr__`, `__setattr__`, `__str__`

Class Variables

indexStore |
Inherited from `configParser.C3Object`: `configStore`, `defaults`, `functionLogger`, `id`, `name`, `objectType`, `objects`, `parent`, `paths`, `permissionHandlers`, `settings`, `subConfigs`, `unresolvedObjects` Inherited from `configParser.C3Object` (private): `_includeConfigStores`, `_objectRefs` Inherited from `object`: `__class__`

Method Details

### begin_indexing(self, session) | source code
Perform tasks before indexing any records

### commit_indexing(self, session) | source code
Perform tasks after records have been indexed

### construct_item(self, session, term, rsitype="") | source code
Take a single item, as stored in this Index, and produce a ResultSetItem representation.

### construct_resultSet(self, session, terms, queryHash={}) | source code
Take a list of terms and produce an appropriate ResultSet object.

### delete_record(self, session, record) | source code
Delete all the terms of the given record from the indexes. Does this by extracting the terms from the record, finding and removing them. Hence the record must be the same as the one that was indexed.

### deserialise_terms(self, session, data) | source code
Callback from IndexStore to take serialised data and produce list of terms and document references.

### index_record(self, session, record) | source code
Accept a record to index. If begin indexing has been called, the index might not commit any data until commit_indexing is called. If it is not in batch mode, then index_record will also commit the terms to the indexStore.

### merge_terms(self, session, structTerms, newTerms, op="replace", recs=0, occs=0) | source code
Callback from IndexStore to take two sets of terms and merge them together.

### scan(self, session, clause) | source code
Produce an ordered term list with document frequencies and total occurences

### search(self, session, clause) | source code
Search this particular index given a CQL clause, return a resultSet object

### serialise_terms(self, session, termId, terms, recs=0, occs=0) | source code
Callback from IndexStore to serialise list of terms and document references to be stored

### sort(self, session, resultSet) | source code
Sort a result set based on the values extracted according to this index.

Class Variable Details

    ### indexStore Value:
        None