Solr 6.1 - Where is my collection's `managed-schema` file

user2173353 picture user2173353 · Jun 23, 2016 · Viewed 7.4k times · Source

I am using Solr 6.1 on Windows 7.

I see my collection's files from the admin UI and it has a managed-schema file in there.

When I try to search (using Notepad++) my Solr directory with a line from the managed-schema file, it finds nothing.

I have also tried to change most (if not all) of the managed-schema files in the Solr directory and my changes are still not applied after reloading the core (and also the file contents of managed-schema in the admin UI remain unchanged).

Can someone explain to me what is this file that I see inside admin UI? Is it a real file or a virtual one?

What I try to do -if that matters- is to make some fields not to be multiValued. It seems Solr likes making them all multiValued for some reason (the admin UI's managed-schema file contains some <field name="fieldname" type="strings"/> in it, so I think this is causing the problem - I will try using string there), so I am fighting to change its configuration. However, it seems that the file names, file paths, etc, etc are all changing from version to version. So, I can't even find the schema configuration path. Very confusing stuff. :(

Can anyone help?

EDIT :

Based on the fact that I cannot find a single schema.xml configuration file in my Solr folder, I guess this file is out of fashion now... I guess it makes no sense trying to use such a file in this version of Solr...

UPDATE :

After digging into places other than the (useless and misleading) documentation pages of Solr, I got these:

https://mail-archives.apache.org/mod_mbox/lucene-solr-user/201509.mbox/

https://mail-archives.apache.org/mod_mbox/lucene-solr-user/201509.mbox/

So, if that's the real documentation right there, I guess I should first find a way to get the port that my zookeeper is listening and upload my configuration files there. Dandy, except for the fact that I don't see the ZooKepeer port listed ANYWHERE in the adminUI. I also didn't setup any ZooKeeper. I hope one exists by default... :(

UPDATE 2 :

https://wiki.apache.org/solr/SolrCloud

By default, an embedded Zookeeper server runs at the Solr port plus 1000, so 9983.

And that info seems to solve my job problems...

Answer

Oyeme picture Oyeme · Jun 23, 2016

Just rename managed-schema to schema.xml. Then reload a core.

If you have an existing Solr collection that uses ClassicIndexSchemaFactory, and you wish to convert to use a managed schema, you can simplify modify the solrconfig.xml to specify the use of the ManagedIndexSchemaFactory. Once Solr is restarted and it detects that a schema.xml file exists, but the managedSchemaResourceName file (ie: "managed-schema") does not exist, the existing schema.xml file will be renamed to schema.xml.bak and the contents are re-written to the managed schema file. If you look at the resulting file, you'll see this at the top of the page:

Please read carefully.
Switching from schema.xml to Managed Schema

An alternative to using a managed schema is to explicitly configure a ClassicIndexSchemaFactory. ClassicIndexSchemaFactory requires the use of a schema.xml configuration file, and disallows any programatic changes to the Schema at run time. The schema.xml file must be edited manually and is only loaded only when the collection is loaded.

<schemaFactory class="ClassicIndexSchemaFactory"/>

https://cwiki.apache.org/confluence/display/solr/Schema+Factory+Definition+in+SolrConfig

Updated:

Changing to Manually Edited schema.xml

If you have started Solr with managed schema enabled and you would like to switch to manually editing a schema.xml file, you should take the following steps:

  1. Rename the managed-schema file to schema.xml. Modify solrconfig.xml to replace the schemaFactory class.
  2. Remove any ManagedIndexSchemaFactory definition if it exists
  3. Add a ClassicIndexSchemaFactory definition as shown above Reload the core(s).