Composite index for the Catalog
Project description
Introduction
CompositeIndex is a plugin index for the ZCatalog. Indexes containing more than one attribute to index an object are called “composite index”. Such indexes should be created if you expect to run queries that will have multiple attributes in the search phrase and all attributes combined will give significantly less hits than the any of the attributes alone. The key of a composite index is called “composite key” and is composed of two or more attributes of an object.
Catalog queries containing attributes managed by CompositeIndex are transparently catched and transformed into a CompositeIndex query (monkey patch). In particular, large sites with a combination of additional indexes (FieldIndex, KeywordIndex) and lots of content (>100k) will profit. The expected performance enhancement for catalog queries is about a factor of 2-3.
Usage
From the ZCatalog indexes tab, add a index of type CompositeIndex.
- Id
pick any valid id you like
- Composite key
names of attributes to concatenate
Example for Plone’s portal_catalog
Many catalog queries in plone are based on the combination of indexed attributes as follows: is_default_page, review_state, portal_type and allowedRolesAndUsers. Normally, the ZCatalog sequentially executes each corresponding index and calculates intersection between each result. This strategy, in particular for large sites, decreases the performance of the catalog and simultaneously increases the volatility of ZODB’s object cache, because each index individually has a high number of hits whereas the the intersection between each index result has a low number of hits.
CompositeIndex overcomes this difficulty because it already contains a pre-calculateted intersection by means of its composite keys. The loading of large sets and the following expensive computation of the intersection is therefore obsolete.
Here we show a configuration example for plone. From the portal_catalog indexes tab, add a index of type CompositeIndex.
Id: comp01
Composite key: is_default_page,review_state,portal_type,allowedRolesAndUsers
Reindex the CompositeIndex “comp01”.
Now each query which contains two ore more components of the composite key is automatically transformed into a query on the CompositeIndex “comp01”.
Changelog
0.1 - Devel
Initial release
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for unimr.compositeindex-0.1dev-r84057.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | b0b8f66365ae7b722db7939f03598d239a15ade7854f4896079c2e1e997737f9 |
|
MD5 | a7e313c3d79a8775317ad89925e219a9 |
|
BLAKE2b-256 | 1b5839a5a64ca534687bc82abd2afdd5e8e77e3ece5e08de30c9bea307b8c5b6 |
Hashes for unimr.compositeindex-0.1dev_r84057-py2.4.egg
Algorithm | Hash digest | |
---|---|---|
SHA256 | 57c5965f03253ef31c81c75778be4e3d62e74384bd16efa5f4f36c9e415e891c |
|
MD5 | f8ef52b1857416e8dbe5ed0b8676b690 |
|
BLAKE2b-256 | 8c01826c243cc291cad26eee02a994f89174b2a8257526cad59e296df0bda3a9 |