def init_app(self, app):
        """Flask application initialization.

        :param app: The Flask application.
        """
        self.init_config(app)
        app.extensions['invenio-indexer'] = self

        hooks = app.config.get('INDEXER_BEFORE_INDEX_HOOKS', [])
        for hook in hooks:
            if isinstance(hook, six.string_types):
                hook = import_string(hook)
            before_record_index.connect_via(app)(hook)