ffmddb.core.models.query module

class ffmddb.core.models.query.Filter(filter_obj)

Stores a single filter for comparing a field to a value

OPERATORS = {'le': <function <lambda> at 0x7f06cb5abc80>, 'lt': <function <lambda> at 0x7f06cb5ab230>, 'gt': <function <lambda> at 0x7f06cb5ab7d0>, 'in': <function <lambda> at 0x7f06cb5abcf8>, 'ge': <function <lambda> at 0x7f06cb5abc08>, 'contains': <function <lambda> at 0x7f06cb5abd70>, 'eq': <function <lambda> at 0x7f06cb5ab848>, 'ne': <function <lambda> at 0x7f06cb5ab398>}
classmethod is_filter(obj)

duck-types a dict to see if it looks like a filter object

run(document)

runs the test against the document, comparing the metadata field specified by the filter’s field against the provided value using the provided operation

class ffmddb.core.models.query.FilterGroup(conjunction, filter_list)

Stores a list of filter objects joined by a conjunction

CONJUNCTIONS = {'and': <function <lambda> at 0x7f06cb5abf50>, 'not': <function <lambda> at 0x7f06cb56e0c8>, 'or': <function <lambda> at 0x7f06cb56e050>}
classmethod is_filter_group(obj)

duck-types a dict to see if it looks like a filter-group

run(document)

runs each specified filter in the group and reduces the results to a single value with the provided conjunction

class ffmddb.core.models.query.Query(query_obj)

Stores an arbitrarily complex query

exception MalformedQuery

Bases: exceptions.Exception

Query.run(document)

runs the core filter group which contains all filters and groups in the query