[英]Using schema.xml instead of managed schema with Solr 5.1.X
I am trying to use schema.xml with the latest version of Solr (5.1.0). 我正在尝试将schema.xml与最新版本的Solr(5.1.0)一起使用。 It seems that by default Solr 5.1.0 uses managed schema, but I would like to use schema.xml for a specific collection.
似乎默认情况下Solr 5.1.0使用托管模式,但我想将schema.xml用于特定集合。
So I create a new collection (using solr create -c my_collection on windows and copy schema.xml from 所以我创建了一个新的集合(在windows上使用solr create -c my_collection并从中复制schema.xml)
server\solr\configsets\basic_configs\conf\schema.xml
to 至
server\solr\my_collection\conf\schema.xml
After that I change settings in 之后我改变了设置
server\solr\my_collection\conf\solrconfig.xml
to use 使用
<schemaFactory class="ClassicIndexSchemaFactory"/>
After doing this I get an exception when starting the server: 执行此操作后,我在启动服务器时遇到异常:
org.apache.solr.common.SolrException:org.apache.solr.common.SolrException: fieldType 'booleans' not found in the schema
Am I doing something terribly wrong here? 我在这里做了什么非常错的事吗? Should not this kind of logic work?
这种逻辑不应该起作用吗?
UPDATE: Stractrace looks like this: 更新:Stractrace看起来像这样:
org.apache.solr.common.SolrException: fieldType 'booleans' not found in the schema
at org.apache.solr.core.SolrCore.<init>(SolrCore.java:885)
at org.apache.solr.core.SolrCore.<init>(SolrCore.java:652)
at org.apache.solr.core.CoreContainer.create(CoreContainer.java:518)
at org.apache.solr.core.CoreContainer$1.call(CoreContainer.java:283)
at org.apache.solr.core.CoreContainer$1.call(CoreContainer.java:277)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: org.apache.solr.common.SolrException: fieldType 'booleans' not found in the schema
at org.apache.solr.update.processor.AddSchemaFieldsUpdateProcessorFactory$TypeMapping.populateValueClasses(AddSchemaFieldsUpdateProcessorFactory.java:244)
at org.apache.solr.update.processor.AddSchemaFieldsUpdateProcessorFactory.inform(AddSchemaFieldsUpdateProcessorFactory.java:170)
at org.apache.solr.core.SolrResourceLoader.inform(SolrResourceLoader.java:620)
at org.apache.solr.core.SolrCore.<init>(SolrCore.java:868)
The problem is that you are referencing a field type booleans
that is not defined in your schema.xml
file. 问题是您正在引用未在
schema.xml
文件中定义的字段类型booleans
。 When you create a core a file managed-schema
is created in server\\solr\\my_collection\\conf\\
. 创建核心时,将在
server\\solr\\my_collection\\conf\\
创建文件managed-schema
。 Rename this file to schema.xml
and restart solr with ClassicIndexSchemaFactory
and it will work fine. 将此文件重命名为
schema.xml
并使用ClassicIndexSchemaFactory
重新启动solr,它将正常工作。
The problem that I had here was had nothing to do with actually using the booleans
field type. 我在这里遇到的问题与实际使用
booleans
字段类型无关。 The problem was that the newly upgraded solrconfig.xml
file has a processor for unknown fields enabled by default, which needs the booleans
field type, and probably some others. 问题是新升级的
solrconfig.xml
文件默认启用了未知字段的处理器,需要booleans
字段类型,可能还有其他一些。
These are all defined by default in the new example schema.xml
, but quite possibly not in your old schema.xml
. 这些都是默认情况下在新示例
schema.xml
定义的,但很可能不在旧的schema.xml
。
The solution for me was to comment out the <updateRequestProcessorChain name="add-unknown-fields-to-the-schema">
section in solrconfig.xml
. 我的解决方案是在
solrconfig.xml
注释掉<updateRequestProcessorChain name="add-unknown-fields-to-the-schema">
部分。
Alternatively, you can probably just replace solrconfig.xml
. 或者,您可以只替换
solrconfig.xml
。
Field type {booleans} is not defined in schema.xml
. schema.xml
未定义字段类型{booleans}。
Steps to fix it, 修复它的步骤,
managed-schema
file to schema.xml
managed-schema
文件重命名为schema.xml
solrconfig.xml
to replace the schemaFactory class. solrconfig.xml
以替换schemaFactory类。 ManagedIndexSchemaFactory
definition if it exists. ManagedIndexSchemaFactory
定义(如果存在)。 ClassicIndexSchemaFactory
definition as shown below, ClassicIndexSchemaFactory
定义,如下所示, <schemaFactory class="ClassicIndexSchemaFactory"/>
autoCreateFields
to false in solrconfig.xml
or you will get solrconfig.xml
中将autoCreateFields
更新为false,否则你会得到 This IndexSchema is not mutable
error. This IndexSchema is not mutable
错误。
${update.autoCreateFields:false}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.