# Path: seeker/mapping.py
# class Indexable (dsl.DocType):
#     """
#     An ``elasticsearch_dsl.DocType`` subclass with methods for getting a list (and count) of documents that should be
#     indexed.
#     """
# 
#     class Meta:
#         index = getattr(settings, 'SEEKER_INDEX', 'seeker')
# 
#     @classmethod
#     def documents(cls, **kwargs):
#         """
#         Returns (or yields) a list of documents, which are dictionaries of field data. The documents may include
#         Elasticsearch metadata, such as ``_id`` or ``_parent``.
#         """
#         return []
# 
#     @classmethod
#     def count(cls):
#         """
#         Returns the number of elements returned by ``Indexable.documents``. May be overridden for performance reasons.
#         """
#         try:
#             return len(cls.documents())
#         except:
#             return None
# 
#     @classmethod
#     def clear(cls, index=None, using=None):
#         """
#         Deletes the Elasticsearch mapping associated with this document type.
#         """
#         using = using or cls._doc_type.using or 'default'
#         index = index or cls._doc_type.index or getattr(settings, 'SEEKER_INDEX', 'seeker')
#         es = connections.get_connection(using)
#         if es.indices.exists_type(index=index, doc_type=cls._doc_type.name):
#             def get_actions():
#                 for hit in scan(es, index=index, doc_type=cls._doc_type.name, query={'query': {'match_all': {}}}):
#                     yield {
#                         '_op_type': 'delete',
#                         '_index': index,
#                         '_type': cls._doc_type.name,
#                         '_id': hit['_id'],
#                     }
#             bulk(es, get_actions())
#             es.indices.refresh(index=index)
# 
# Path: seeker/registry.py
# def register(doc_class, app_label=None):
#     assert issubclass(doc_class, Indexable)
#     if doc_class in documents:
#         logger.warning('Document class %s.%s was previously registered - skipping.', doc_class.__module__, doc_class.__name__)
#         return
#     documents.append(doc_class)
#     if issubclass(doc_class, ModelIndex):
#         model_class = doc_class.queryset().model
#         # It's possible to register more than one document type for a model, so keep a list.
#         model_documents.setdefault(model_class, []).append(doc_class)
#         # For doing queries across multiple document types, we'll need a mapping from doc_type back to model_class.
#         model_doc_types[doc_class._doc_type.name] = model_class
#     if app_label:
#         app_documents.setdefault(app_label, []).append(doc_class)
# 
# Path: seeker/utils.py
# def import_class(fq_name):
#     module_name, class_name = fq_name.rsplit('.', 1)
#     mod = importlib.import_module(module_name)
#     return getattr(mod, class_name)


from django.apps import AppConfig, apps
from django.conf import settings
from .mapping import Indexable
from .registry import register
from .utils import import_class
import importlib
import inspect
import logging
            app_lkup = {app.name: app.label for app in apps.get_app_configs()}
            for mapping in mappings:
                mapping_cls = import_class(mapping)
                # Figure out which app_label to use based on the longest matching module prefix.
                app_label = None
                for prefix in sorted(app_lkup):
                    if mapping.startswith(prefix):
                        app_label = app_lkup[prefix]
                register(mapping_cls, app_label=app_label)
        else:
            if not mapping_module:
                return
            for app in apps.get_app_configs():
                try:
                    module = '%s.%s' % (app.name, mapping_module)
                    imported_module = importlib.import_module(module)
                    clsmembers = inspect.getmembers(imported_module, lambda member: inspect.isclass(member) and issubclass(member, Indexable))
                    for name, cls in clsmembers:
                        if module_only and cls.__module__ != module:
                            logger.debug('Skipping registration of %s.%s (defined outside %s)', cls.__module__, name, module)
                            continue
                        register(cls, app_label=app.label)
                except ImportError:
                    pass

        self.indexer = None
        indexer_module = getattr(settings, 'SEEKER_INDEXER', 'seeker.indexer.ModelIndexer')
        if indexer_module is not None:
            indexer_cls = None
            try:

# Path: seeker/mapping.py
# class Indexable (dsl.DocType):
#     """
#     An ``elasticsearch_dsl.DocType`` subclass with methods for getting a list (and count) of documents that should be
#     indexed.
#     """
# 
#     class Meta:
#         index = getattr(settings, 'SEEKER_INDEX', 'seeker')
# 
#     @classmethod
#     def documents(cls, **kwargs):
#         """
#         Returns (or yields) a list of documents, which are dictionaries of field data. The documents may include
#         Elasticsearch metadata, such as ``_id`` or ``_parent``.
#         """
#         return []
# 
#     @classmethod
#     def count(cls):
#         """
#         Returns the number of elements returned by ``Indexable.documents``. May be overridden for performance reasons.
#         """
#         try:
#             return len(cls.documents())
#         except:
#             return None
# 
#     @classmethod
#     def clear(cls, index=None, using=None):
#         """
#         Deletes the Elasticsearch mapping associated with this document type.
#         """
#         using = using or cls._doc_type.using or 'default'
#         index = index or cls._doc_type.index or getattr(settings, 'SEEKER_INDEX', 'seeker')
#         es = connections.get_connection(using)
#         if es.indices.exists_type(index=index, doc_type=cls._doc_type.name):
#             def get_actions():
#                 for hit in scan(es, index=index, doc_type=cls._doc_type.name, query={'query': {'match_all': {}}}):
#                     yield {
#                         '_op_type': 'delete',
#                         '_index': index,
#                         '_type': cls._doc_type.name,
#                         '_id': hit['_id'],
#                     }
#             bulk(es, get_actions())
#             es.indices.refresh(index=index)
# 
# Path: seeker/registry.py
# def register(doc_class, app_label=None):
#     assert issubclass(doc_class, Indexable)
#     if doc_class in documents:
#         logger.warning('Document class %s.%s was previously registered - skipping.', doc_class.__module__, doc_class.__name__)
#         return
#     documents.append(doc_class)
#     if issubclass(doc_class, ModelIndex):
#         model_class = doc_class.queryset().model
#         # It's possible to register more than one document type for a model, so keep a list.
#         model_documents.setdefault(model_class, []).append(doc_class)
#         # For doing queries across multiple document types, we'll need a mapping from doc_type back to model_class.
#         model_doc_types[doc_class._doc_type.name] = model_class
#     if app_label:
#         app_documents.setdefault(app_label, []).append(doc_class)
# 
# Path: seeker/utils.py
# def import_class(fq_name):
#     module_name, class_name = fq_name.rsplit('.', 1)
#     mod = importlib.import_module(module_name)
#     return getattr(mod, class_name)


# Path: seeker/apps.py
from django.apps import AppConfig, apps
from django.conf import settings
from .mapping import Indexable
from .registry import register
from .utils import import_class
import importlib
import inspect
import logging

            app_lkup = {app.name: app.label for app in apps.get_app_configs()}
            for mapping in mappings:
                mapping_cls = import_class(mapping)
                # Figure out which app_label to use based on the longest matching module prefix.
                app_label = None
                for prefix in sorted(app_lkup):
                    if mapping.startswith(prefix):
                        app_label = app_lkup[prefix]
                register(mapping_cls, app_label=app_label)
        else:
            if not mapping_module:
                return
            for app in apps.get_app_configs():
                try:
                    module = '%s.%s' % (app.name, mapping_module)
                    imported_module = importlib.import_module(module)
                    clsmembers = inspect.getmembers(imported_module, lambda member: inspect.isclass(member) and issubclass(member, Indexable))
                    for name, cls in clsmembers:
                        if module_only and cls.__module__ != module:
                            logger.debug('Skipping registration of %s.%s (defined outside %s)', cls.__module__, name, module)
                            continue
                        register(cls, app_label=app.label)
                except ImportError:
                    pass

        self.indexer = None
        indexer_module = getattr(settings, 'SEEKER_INDEXER', 'seeker.indexer.ModelIndexer')
        if indexer_module is not None:
            indexer_cls = None
            try:

                indexer_cls = import_class(indexer_module)