httk.store.mongo.optimade¶
Serve OPTIMADE filters over stored dataclasses through MongoDB.
The property and filter translation layers are backend-neutral. This module only supplies Mongo-specific field handlers for stored properties and for relationship ids, plus the semi-join that resolves dotted relationship filters through a nested Mongo searcher.
Functions¶
|
Build a Mongo searcher over |
Module Contents¶
- httk.store.mongo.optimade.optimade_filter_searcher(store, cls, filter_string, *, prefix='_httk_', definition=None, extra_handlers=None, related_classes=None)[source]¶
Build a Mongo searcher over
clsfrom an OPTIMADE filter.- Parameters:
store (httk.store.mongo.store.MongoStore) – The Mongo store containing the rows to query.
cls (type) – The storable class whose rows are searched.
filter_string (str | httk.core.optimade.FilterAst) – An OPTIMADE filter string or parsed filter tree.
prefix (str) – The registered prefix used for served property names.
definition (httk.core.EntryTypeDefinition | None) – An optional definition supplying additional property types.
extra_handlers (collections.abc.Mapping[str, collections.abc.Mapping[str, collections.abc.Callable[Ellipsis, Any]]] | None) – Optional handlers for ids, types, or extra properties.
related_classes (collections.abc.Mapping[str, type] | None) – Related entry types and their storable classes.
- Returns:
A Mongo searcher yielding matching stored instances.
- Raises:
FilterTranslationError – If the filter cannot be translated.
ValueError – If a related class does not match exactly one relationship field.
- Return type: