Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compatibility to managed-schema #260

Open
NicolasGoeddel opened this issue Apr 9, 2020 · 5 comments
Open

Compatibility to managed-schema #260

NicolasGoeddel opened this issue Apr 9, 2020 · 5 comments

Comments

@NicolasGoeddel
Copy link

Hi,

I want to suggest a small change for this line:

schema_url = "%s/admin/file/?file=schema.xml"

If you replace it with the following line collective.solr will automatically work with a managed-schema which seems to be the default since Solr 8.5.

schema_url = "%s/schema?wt=schema.xml"

See also https://lucene.apache.org/solr/guide/8_5/schema-api.html#retrieve-schema-examples and scroll down a bit.

@tisto
Copy link
Member

tisto commented Apr 9, 2020

@NicolasGoeddel I thought about this as well. Though, this means that we would have to drop support for older versions of Solr, right?

@NicolasGoeddel
Copy link
Author

I don't think so. That API was already available in Solr 6.6.: https://lucene.apache.org/solr/guide/6_6/schema-api.html#SchemaAPI-RetrievetheEntireSchema

At least that was the oldest documentation I could find on that page. There are also PDF version available for Solr prior to version 6.6 but I did not take at look at these: http://archive.apache.org/dist/lucene/solr/ref-guide/

@NicolasGoeddel
Copy link
Author

It seems there are some new issues now. Some attributes can not be found:

if field is None or not field.indexed:

AttributeError: indexed

AttributeError: stored

This happens because the retrieved schema does not add the indexed and stored attribute to the <field> nodes. At the moment I don't know how to make it work. Maybe I should use the normal schema instead. When I remember right there was something with kitconcept.recipe.solr or so. I have to take a look at this. Never used it.

@NicolasGoeddel
Copy link
Author

Or for the moment this solution seems to work but is more like an hack:

class SolrField(AttrDict):

Change it to:

class SolrField(AttrDict):
    """ a schema field representation """

    def __init__(self, *args, **kw):
        self["required"] = False
        self["multiValued"] = False
        self["indexed"] = True # added
        self["stored"] = True  # added
        super(SolrField, self).__init__(*args, **kw)

@tisto
Copy link
Member

tisto commented Apr 14, 2020

@NicolasGoeddel you do not have to use kitconcept.recipe.solr (we don't use it in production at all). You could use that as a starting point or copy over the schema configuration though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants