search.utils
Attributes
Classes
Detects languages with the help of lingua-language-detector. |
Functions
|
|
Searches through the given SQLAlchemy base and returns the classes |
|
|
Filter out models that are polymorphic subclasses of other |
Given a query and the corresponding model add a filter |
|
|
Module Contents
- search.utils.searchable_sqlalchemy_models[T](base: type[T]) collections.abc.Iterator[type[onegov.search.Searchable]][source]
Searches through the given SQLAlchemy base and returns the classes of all SQLAlchemy models found which inherit from the
onegov.search.mixins.Searchableinterface.
- search.utils.get_polymorphic_base(model: type[sqlalchemy.orm.DeclarativeBase | onegov.search.mixins.Searchable]) type[sqlalchemy.orm.DeclarativeBase | onegov.search.mixins.Searchable][source]
Filter out models that are polymorphic subclasses of other models in order to save on queries.
- search.utils.apply_searchable_polymorphic_filter[T](query: sqlalchemy.orm.Query[T], model: Any, order_by_polymorphic_identity: bool = False) sqlalchemy.orm.Query[T][source]
Given a query and the corresponding model add a filter that excludes any polymorphic variants, that are not searchable.