def push_indices():
    magic_indices = []
    for language_code, language_name in settings.LANGUAGES:
        proxy_model = getattr(proxy_models, proxy_models.proxy_name(language_code))
        magic_indices.append( page_index_factory(language_code, proxy_model))
        
    unified_index = connections['default'].get_unified_index()
    prev_indices = [index for key, index in unified_index.indexes.iteritems()]
    all_indices = [ind() for ind in magic_indices] + prev_indices
    unified_index.build(indexes=all_indices)
Exemplo n.º 2
0
def push_indices():
    magic_indices = []
    for language_code, language_name in settings.LANGUAGES:
        proxy_model = getattr(proxy_models,
                              proxy_models.proxy_name(language_code))
        magic_indices.append(page_index_factory(language_code, proxy_model))

    unified_index = connections['default'].get_unified_index()
    prev_indices = [index for key, index in unified_index.indexes.iteritems()]
    all_indices = [ind() for ind in magic_indices] + prev_indices
    unified_index.build(indexes=all_indices)
Exemplo n.º 3
0
            try:
                activate(self.language)
                self.prepared_data = super(_PageIndex, self).prepare(obj)
                plugins = CMSPlugin.objects.filter(language=language_code, placeholder__in=obj.placeholders.all())
                text = ''
                for plugin in plugins:
                    instance, _ = plugin.get_plugin_instance()
                    if hasattr(instance, 'search_fields'):
                        text += u''.join(force_unicode(_strip_tags(getattr(instance, field, ''))) for field in instance.search_fields)
                    if getattr(instance, 'search_fulltext', False):
                        text += _strip_tags(instance.render_plugin())
                self.prepared_data['text'] = text
                return self.prepared_data
            finally:
                activate(current_languge)

        def index_queryset(self):
            qs = proxy_model.objects.published().filter(title_set__language=language_code).distinct()
            if 'publisher' in settings.INSTALLED_APPS:
                qs = qs.filter(publisher_is_draft=True)
            return qs

    return _PageIndex

for language_code, language_name in settings.LANGUAGES:
    proxy_model = getattr(proxy_models, proxy_models.proxy_name(language_code))
    index = page_index_factory(language_code, proxy_model)
    if proxy_model:
        site.register(proxy_model, index)
    else:
        print "no page proxy model found for language %s" % language_code
Exemplo n.º 4
0
            for site_obj in Site.objects.all():
                qs = base_qs.published(site=site_obj.id).filter(
                    Q(title_set__language=language_code)
                    & (Q(title_set__redirect__exact='')
                       | Q(title_set__redirect__isnull=True)))
                if 'publisher' in settings.INSTALLED_APPS:
                    qs = qs.filter(publisher_is_draft=True)
                qs = qs.distinct()
                result_qs |= qs
            return result_qs

    return _PageIndex


for language_code, language_name in settings.LANGUAGES:
    proxy_model = getattr(proxy_models, proxy_models.proxy_name(language_code))
    index = page_index_factory(language_code)
    if proxy_model:
        site.register(proxy_model, index)
    else:
        print "no page proxy model found for language %s" % language_code

########NEW FILE########
__FILENAME__ = settings
from django.conf import settings

INDEX_BASE_CLASS = getattr(settings, 'CMS_SEARCH_INDEX_BASE_CLASS',
                           'haystack.indexes.SearchIndex')
########NEW FILE########
__FILENAME__ = conf
# -*- coding: utf-8 -*-