6

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...

user2173353
  • 4,316
  • 4
  • 47
  • 79

2 Answers2

10

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).
Oyeme
  • 11,088
  • 4
  • 42
  • 65
  • 1
    I will try that. But : 1) Is there any way to find the correct path for your collection's schema file? Because the only folder containing my collection's name is `\example\cloud\node2\solr\collection1_shard1_replica1` and there aren't any configs in there. :( 2) What's the difference between managed and classic schema? Is it so significant that I must switch to classic? Or I can keep the managed and use `true` (or something similar) to make it work similarly to the classic one? Is managed updated automatically by Solr ? – user2173353 Jun 23 '16 at 12:27
  • @user2173353 ${solr.install.dir:.} - installation directory, solr.solr.home - all collections are here.Just open UI interface of Solr to see the settings. You should switch to classic otherwise you will gonna loose your changes after a core reload.As it will be complied.Solr starts with your schema.xml file and creates a new file called, by default, managed-schema to store all the inferred schema information. This file is automatically overwritten by Solr as it detects changes to the schema. Y – Oyeme Jun 23 '16 at 13:51
  • I saw that `solr.install.dir` pointed to a location where there was a folder with my collection/core name and one called `zoo_data`. I have placed a `schema.xml` file inside my core's folder (there was no schema file in there at all) and now (alter a Solr stop and re-start) the AdminUI is broken (it displays two red containers with no error message). Removing the added XML doesn't fix the problem. This thing gets broken very easily. I will reinstall the files, but I am still not 100% sure what breaks my Solr. :( – user2173353 Jun 23 '16 at 14:15
  • The XML was a `managed-schema` copy and only contained a change for adding the `` (there was no other schemaFactory defined) and my field definitions. If I clear the whole XML and ONLY add the field definitions and the `schemaFactory`, will it work or I will destroy Solr once again? :( – user2173353 Jun 23 '16 at 14:25
  • That's the paths: `-Dsolr.install.dir=F:\Users\me\Downloads\solr-6.1.0 -Dsolr.solr.home=F:\Users\me\Downloads\solr-6.1.0\example\cloud\node1\solr`. And I put the XML inside `${Dsolr.solr.home}\collection1\ ` named as `schema.xml`. – user2173353 Jun 23 '16 at 14:40
  • Nope. Using a lighter XML destroys Solr too. I am so lost... Donno if I do something wrong when creating the collection: I first remove the default collection called `gettingstarted` and then I add a new core (there are no other cores at that point). That creates a collection as well. Everything seems fine, up until I put the XML inside `${Dsolr.solr.home}/collection1/`. Then Solr's adminUI totally stops working. – user2173353 Jun 23 '16 at 14:52
  • @user2173353 solr.install.dir.Dsolr.solr.home=F:\Users\me\Downloads\solr-6.1.0\example\cloud\node1\solr this is the right path for collections.Just go inside /your_core_name/conf/ and find file managed-schema, then rename it to schema.xml.Then restart a core. – Oyeme Jun 23 '16 at 14:59
  • @user2173353 try to create a new core from scratch and play with it. – Oyeme Jun 23 '16 at 14:59
  • The `conf` folder was missing. There was only a `data` folder and a `core.properties` file. Adding the folder `conf` and the XML inside it, once again, destroyed Solr (I cannot believe my own eyes. Solr gets destoyed wherever I put this file :o). Also, the cores that are created by default (`gettingstarted_shard1_replica1` and `gettingstarted_shard2_replica1`) lack a `conf` folder as well, so it's not only my own core that is weird. Maybe some new trend in this Solr version? I will try again... – user2173353 Jun 23 '16 at 15:25
  • @user2173353 Example of core structure: http://2.bp.blogspot.com/-zWmWPHKrmYA/URBOUoCYOLI/AAAAAAAAA8M/px33YlR5gCg/s1600/croppedLargeFontSolrDirectoryStructure.jpg – Oyeme Jun 23 '16 at 15:32
  • When I setup this structure as in the image, it seems that Solr becomes corrupted. No useful info on the log files. I have also tried creating the collection like that: `solr create -c collection1 -n collection1 -d "F:\Users\me\Downloads\solr-6.1.0\example\files\conf"` pointing to an existing folder with the desired `schema.xml` and still it uses `managed-schema` without my specified fields and my core's folder has no `conf` folder. If I try to put a `conf` folder on that collection is seems to ignore it. And it also ignores the original `conf` folder that I gave to it so... Nothing works. :( – user2173353 Jun 24 '16 at 10:30
  • https://mail-archives.apache.org/mod_mbox/lucene-solr-user/201509.mbox/ – user2173353 Jun 24 '16 at 13:24
  • 1
    What was wrong in my case was that I was running Solr in cloud mode, where one should upload the configuration to Zookeeper. :) When not in cloud mode, the configuration is on the file system. – user2173353 Jul 20 '16 at 12:01
1

In ubuntu: For version Solr 6.6.0 collections are stored in "/var/solr/data/collection_name"

vijay
  • 731
  • 5
  • 15