Пример #1
0
    def handle_noargs(self, **options):
        """Generates a Solr schema that reflects the indexes."""
        # Cause the default site to load.
        from django.conf import settings
        from haystack import backend, site

        default_operator = getattr(settings, 'HAYSTACK_DEFAULT_OPERATOR',
                                   DEFAULT_OPERATOR)
        content_field_name, fields = backend.SearchBackend().build_schema(
            site.all_searchfields())

        t = loader.get_template('search/configuration/solr.xml')
        c = Context({
            'content_field_name': content_field_name,
            'fields': fields,
            'default_operator': default_operator,
        })
        schema_xml = t.render(c)
        schema_path = os.path.join(SOLR_ROOT, 'solr/conf/schema.xml')
        file = open(schema_path, 'w')
        file.write(schema_xml)
        file.close()
        sys.stderr.write("\n")
        sys.stderr.write("Saved to %s\n" % schema_path)
        sys.stderr.write("You may need to reindex your data\n")
        sys.stderr.write(
            "--------------------------------------------------------------------------------------------\n"
        )
        sys.stderr.write("\n")
Пример #2
0
 def build_context(self):
     # Cause the default site to load.
     from haystack import backend, site
     content_field_name, fields = backend.SearchBackend().build_schema(site.all_searchfields())
     return Context({
         'content_field_name': content_field_name,
         'fields': fields,
         'default_operator': DEFAULT_OPERATOR,
         'ID': ID,
         'DJANGO_CT': DJANGO_CT,
         'DJANGO_ID': DJANGO_ID,
     })
 def build_context(self):
     # Cause the default site to load.
     from haystack import backend, site
     content_field_name, fields = backend.SearchBackend().build_schema(
         site.all_searchfields())
     return Context({
         'content_field_name': content_field_name,
         'fields': fields,
         'default_operator': DEFAULT_OPERATOR,
         'ID': ID,
         'DJANGO_CT': DJANGO_CT,
         'DJANGO_ID': DJANGO_ID,
     })
Пример #4
0
    def build_context(self):
        # Cause the default site to load.
        from haystack import backend, site

        content_field_name, fields = backend.SearchBackend().build_schema(site.all_searchfields())
        return Context(
            {
                "content_field_name": content_field_name,
                "fields": fields,
                "default_operator": DEFAULT_OPERATOR,
                "ID": ID,
                "DJANGO_CT": DJANGO_CT,
                "DJANGO_ID": DJANGO_ID,
            }
        )
 def handle_noargs(self, **options):
     """Generates a Solr schema that reflects the indexes."""
     # Cause the default site to load.
     from django.conf import settings
     from haystack import backend, site
     
     content_field_name, fields = backend.SearchBackend().build_schema(site.all_searchfields())
     
     t = loader.get_template('search_configuration/solr.xml')
     c = Context({
         'content_field_name': content_field_name,
         'fields': fields,
         'default_operator': DEFAULT_OPERATOR,
     })
     schema_xml = t.render(c)
     sys.stderr.write("\n")
     sys.stderr.write("\n")
     sys.stderr.write("\n")
     sys.stderr.write("Save the following output to 'schema.xml' and place it in your Solr configuration directory.\n")
     sys.stderr.write("--------------------------------------------------------------------------------------------\n")
     sys.stderr.write("\n")
     print schema_xml
Пример #6
0
    def handle_noargs(self, **options):
        """Generates a Solr schema that reflects the indexes."""
        # Cause the default site to load.
        from django.conf import settings
        from haystack import backend, site

        default_operator = getattr(settings, "HAYSTACK_DEFAULT_OPERATOR", DEFAULT_OPERATOR)
        content_field_name, fields = backend.SearchBackend().build_schema(site.all_searchfields())

        t = loader.get_template("search/configuration/solr.xml")
        c = Context({"content_field_name": content_field_name, "fields": fields, "default_operator": default_operator})
        schema_xml = t.render(c)
        schema_path = os.path.join(SOLR_ROOT, "solr/conf/schema.xml")
        file = open(schema_path, "w")
        file.write(schema_xml)
        file.close()
        sys.stderr.write("\n")
        sys.stderr.write("Saved to %s\n" % schema_path)
        sys.stderr.write("You may need to reindex your data\n")
        sys.stderr.write(
            "--------------------------------------------------------------------------------------------\n"
        )
        sys.stderr.write("\n")