简体   繁体   English

如何将新字段添加到Solr模式

[英]how to add new Fields into solr schema

I am doing data import from Mongo to Solr. 我正在将数据从Mongo导入到Solr。 For this I need to add new fields into the Solr schema. 为此,我需要向Solr模式中添加新字段。 I am using solr server 5.1.0. 我正在使用solr服务器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. Schema.xml在solrhome / server / solr / core / config目录中不可用,因此我将其中一个从solr-5.1.0 \\ server \\ solr \\ configsets \\ basic_configs \\ conf复制到core \\ config并在其中添加字段。
  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. 现在,当我们启动Solr服务器时,我收到警告消息,我应该删除schema.xml文件,因为它现在是托管模式。 These fields should be moved to managed-schema file, but this didn't happen. 这些字段应移至托管模式文件,但这没有发生。
  3. How Solr will move the database table to indexing. Solr如何将数据库表移动到索引。 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? 如何重新索引先前导入的数据?

对于数据导入,您需要db-data-config.xml文件,您将在其中放置sql查询并使用SOLR对其进行配置。有关如何实现配置的信息,请转到此链接

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. 1.将schema.xml文件添加到您的solr / core1 / conf目录中。 2. copy all content of managed-schema into schema.xml 2.将托管模式的所有内容复制到schema.xml中
3. add the new fields into schema.xml. 3.将新字段添加到schema.xml中。
4. delete the managed-schema.xml 4.删除managed-schema.xml
5. restart the solr it will create a managed-schema.xml and will move schema.xml to scheam.bkp 5.重新启动solr,它将创建一个managed-schema.xml,并将schema.xml移至scheam.bkp

References- 参考资料

  1. solrconfig.xml - Read the doc for schemaFactory tag. solrconfig.xml-阅读schemaFactory标记的文档。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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