Open NicolasGoeddel opened 4 years ago
@NicolasGoeddel I thought about this as well. Though, this means that we would have to drop support for older versions of Solr, right?
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/
It seems there are some new issues now. Some attributes can not be found:
https://github.com/collective/collective.solr/blob/52cb3eadcd9320f17d89e578740d8e85c69e2551/src/collective/solr/search.py#L156
AttributeError: indexed
https://github.com/collective/collective.solr/blob/52cb3eadcd9320f17d89e578740d8e85c69e2551/src/collective/solr/parser.py#L228
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.
Or for the moment this solution seems to work but is more like an hack: https://github.com/collective/collective.solr/blob/52cb3eadcd9320f17d89e578740d8e85c69e2551/src/collective/solr/parser.py#L158 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)
@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.
Hi,
I want to suggest a small change for this line: https://github.com/collective/collective.solr/blob/52cb3eadcd9320f17d89e578740d8e85c69e2551/src/collective/solr/solr.py#L332
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.See also https://lucene.apache.org/solr/guide/8_5/schema-api.html#retrieve-schema-examples and scroll down a bit.