how to add new Fields into solr schema

2019-09-18 15:55发布

问题:

I am doing data import from Mongo to Solr. For this I need to add new fields into the Solr schema. I am using solr server 5.1.0.

  1. Schema.xml is not available in solrhome/server/solr/core/config directory so I copied one from solr-5.1.0\server\solr\configsets\basic_configs\conf to core\config and added fields into this.
  2. Now when we start Solr server I get WARN message that I should remove the schema.xml file as this is now managed-schema. These fields should be moved to managed-schema file, but this didn't happen.
  3. How Solr will move the database table to indexing. Does it convert each row into a document? Or I have to specify document structure somewhere?
  4. How I can re index the data previously imported?

回答1:

For Data import you need db-data-config.xml file where you will put your sql queries and configure it with SOLR For information about how to achieve the configuration go to this link



回答2:

I have find a way to add the fields into schema. Please provide your input if there is any other proper way of doing it.
1. add schema.xml file into your solr/core1/conf directory. 2. copy all content of managed-schema into schema.xml
3. add the new fields into schema.xml.
4. delete the managed-schema.xml
5. restart the solr it will create a managed-schema.xml and will move schema.xml to scheam.bkp

References-

  1. solrconfig.xml - Read the doc for schemaFactory tag.