Does Solr have an API to read schema.xml?

Since Solr 4.2 the Schema REST API allows you to get the schema with :

http://localhost:8983/solr/schema

or with a core name :

http://localhost:8983/solr/mycorename/schema

Since Solr 4.4 you may also modify your schema.

more details on the Solr Wiki page


You can get the schema with http://localhost:8983/solr/admin/file/?contentType=text/xml;charset=utf-8&file=schema.xml

It's the raw xml, so have to parse it to get the information you need.

However, if your program generates an invalid facet, maybe you should just fix the program instead of trying to work around this.


One alternative is to use LukeRequestHandler. It is modeled after Luke tool which is used to diagnose the content of Lucene Index. The query /admin/luke?show=schema, will show you the schema. However, you will need to define it in solrconfig.xml like so :

<requestHandler name="/admin/luke" class="org.apache.solr.handler.admin.LukeRequestHandler" />

Documentation of LukeRequestHandler link

Tags:

Schema

Solr

Facet