简体   繁体   中英

managed-schema and other fancy stuff. What is it?

I created a new core in Standalone mode (please, correct me, if I'm saying something wrong). I did it like this (following Apache Solr Reference Guide 5.2 ):

$ bin/solr create -c test

I hoped to see, that everything (in fact almost nothing) I did goes hand in hand with the Reference Guide . On pages 13 and 14 the Guide clearly describes how the solr home directory should look like:

solr.xml
core_name1/
    core.properties
    conf/
        solrconfig.xml
        schema.xml
    data/
...

However, when I go to ./server/solr/test/conf I see there 8 files and one directory:

currency.xml
lang/
params.json
solrconfig.xml
synonyms.txt
elevate.xml
managed-schema
protwords.txt
stopwords.txt

Phew... Terrible looking stuff which is not touched at all in the first chapter of the Reference Guide. I do not understad what I did wrong and what made the home directory of a new core look so ugly. I did not have in mind to create any currency.xml and other fancy files. But what looks worst of all is that I can not find any schema file, which judging by the Reference Guide should be the most important. I guess that now I should use managed-schema instead, but when I open it I see a really dreadful message:

<!-- Solr managed schema - automatically generated - DO NOT EDIT -->

Bump! A newbie like me creates a first core in his life, hopes to see a lovely schema file, but finds something that he can not even edit. So, my questions are

  1. how actually to create a core and make hands dirty editing schema.xml file
  2. is it possible to edit somehow managed schema or not
  3. is there any reference guide that can be followed line by line and produce expected results?

The schema.xml is present in solr\\configsets\\basic_configs\\conf location. You can copy it and place it in /conf directory and modify it, to add your fields. This would not affect any other cores. Also, the other files are needed for how Solr manages the stop works while searching for strings, and currency details etc. In the documentation of previous versions, these details were mentioned and thats how I figured it out the hard way. If you delete those stopwords and other files, you will eventually find error message that they are missing. Hope this information helps. Happy learning

To add onto this, in your SolrConfig.xml you can find the schemaFactory tag and change the class attribute from "ManagedIndexSchemaFactory" to "ClassicIndexSchemaFactory". This will make Solr use schema.xml in the cores conf directory instead of generating the managed-schema file.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM