0

我用type="cndate"都会出现Unknown fieldType 'cndate' specified on field birth.

当我注释这行代码后,程序可以运行。不但是"cndate",连"int"和"text_ik"都会报相同的错。

相关代码

schema.xml文件的代码

<field name="userName" type="string" indexed="true" stored="true" omitNorms="true"/>
<field name="sex" type="boolean" indexed="true" stored="true" omitNorms="true"/>
<field name="birth" type="cndate" indexed="true" stored="true" omitNorms="true"/>
<field name="salary" type="int" indexed="true" stored="true" omitNorms="true"/>
<field name="text" type="text_ik" indexed="true" stored="true" omitNorms="true" multiValued="false"/>
<field name="author" type="string" indexed="true" stored="true"/>
<field name="title" type="string" indexed="true" stored="true"/>
<field name="fileName" type="string" indexed="true" stored="true"/>
<field name="filePath" type="string" indexed="true" stored="true" required="true" multiValued="false"/>
<field name="size" type="long" indexed="true" stored="true" />
<field name="lastModified" type="cndate" indexed="true" stored="true"/>

<field name="id" type="string" indexed="true" stored="true" required="false" multiValued="false" />

你期待的结果是什么?实际看到的错误信息又是什么?

错误问题日志:new2_core: org.apache.solr.common.SolrException:org.apache.solr.common.SolrException: Could not load conf for core new2_core: Can't load schema C:solr-7.5.0solr-7.5.0serversolrnew2_coreconfmanaged-schema: Unknown fieldType 'cndate' specified on field birth
图片描述

在solr中怎样指定这几种类型?

solr是7.5版本

2018-10-08 提问
1 个回答
0

可能在solr7.5版本中没有“cndata”,“int”和“text_ik”的类型,查看源码发现

<dynamicField name="*_i"  type="pint"    indexed="true"  stored="true"/>
<dynamicField name="*_is" type="pints"    indexed="true"  stored="true"/>
<dynamicField name="*_s"  type="string"  indexed="true"  stored="true" />
<dynamicField name="*_ss" type="strings"  indexed="true"  stored="true"/>
<dynamicField name="*_l"  type="plong"   indexed="true"  stored="true"/>
<dynamicField name="*_ls" type="plongs"   indexed="true"  stored="true"/>
<dynamicField name="*_t" type="text_general" indexed="true" stored="true" multiValued="false"/>
<dynamicField name="*_txt" type="text_general" indexed="true" stored="true"/>
<dynamicField name="*_b"  type="boolean" indexed="true" stored="true"/>
<dynamicField name="*_bs" type="booleans" indexed="true" stored="true"/>
<dynamicField name="*_f"  type="pfloat"  indexed="true"  stored="true"/>
<dynamicField name="*_fs" type="pfloats"  indexed="true"  stored="true"/>
<dynamicField name="*_d"  type="pdouble" indexed="true"  stored="true"/>
<dynamicField name="*_ds" type="pdoubles" indexed="true"  stored="true"/>
<dynamicField name="random_*" type="random"/>
<!-- Type used for data-driven schema, to add a string copy for each text field -->
<dynamicField name="*_str" type="strings" stored="false" docValues="true" indexed="false" useDocValuesAsStored="false"/>
<dynamicField name="*_dt"  type="pdate"    indexed="true"  stored="true"/>
<dynamicField name="*_dts" type="pdate"    indexed="true"  stored="true" multiValued="true"/>
<dynamicField name="*_p"  type="location" indexed="true" stored="true"/>
<dynamicField name="*_srpt"  type="location_rpt" indexed="true" stored="true"/>
<!-- payloaded dynamic fields -->
<dynamicField name="*_dpf" type="delimited_payloads_float" indexed="true"  stored="true"/>
<dynamicField name="*_dpi" type="delimited_payloads_int" indexed="true"  stored="true"/>
<dynamicField name="*_dps" type="delimited_payloads_string" indexed="true"  stored="true"/>
<dynamicField name="attr_*" type="text_general" indexed="true" stored="true" multiValued="true"/>

代表不同类型的代码,将“cndata”改为“pdata”、“int”改为“pint”、“text_ik”改为“text_general”就可以运行
图片描述

撰写答案

推广链接