我正在使用Apache Solr 7.4。我正在尝试使用curl / postman定义架构的某些部分。
我能够成功定义字段类型和字段,当我尝试定义副本字段时出现错误:
"copyField dest :'text' is not an explicit field and doesn't match a dynamicField
这是我的字段类型定义:
"add-field-type": {
"name": "text",
"class": "solr.TextField",
"positionIncrementGap": "100",
"indexAnalyzer": {
"charFilters": [{
"class": "solr.MappingCharFilterFactory",
"mapping": "mapping-ISOLatin1Accent.txt"
}],
"tokenizer": {
"class": "solr.KeywordTokenizerFactory"
},
"filters": [{
"class": "solr.LowerCaseFilterFactory"
},
{
"class": "solr.StopFilterFactory",
"ignoreCase": "true",
"words": "stopwords.txt"
},
{
"class": "solr.RemoveDuplicatesTokenFilterFactory"
}
]
},
"queryAnalyzer": {
"charFilters": [{
"class": "solr.MappingCharFilterFactory",
"mapping": "mapping-ISOLatin1Accent.txt"
}],
"tokenizer": {
"class": "solr.KeywordTokenizerFactory"
},
"filters": [{
"class": "solr.LowerCaseFilterFactory"
},
{
"class": "solr.StopFilterFactory",
"ignoreCase": "true",
"words": "stopwords.txt"
},
{
"class": "solr.LowerCaseFilterFactory"
},
{
"class": "solr.RemoveDuplicatesTokenFilterFactory"
}
]
}
}
我还添加了一个动态字段:
"add-dynamic-field":{
"name":"*_txt1",
"type":"text",
"stored":true,
"indexed":true
}
这是我的领域:
"add-field": [{
"name": "path",
"type": "string",
"indexed": "true",
"stored": "false"
}
到目前为止成功。现在,我尝试添加一个复制字段,如下所示:
"add-copy-field":
{
"source":"path",
"dest": "text"
}
这是失败的地方。坚持这一点,任何帮助表示赞赏。谢谢!
答案 0 :(得分:3)
您要复制的字段错误。
“目标”:“文本”
您没有任何具有“文本”名称的字段,只有具有“文本”名称的字段类型。
答案 1 :(得分:1)
在制作复制字段之前,请确保具有所有源字段和目标字段。 例如,如果您要将两个源字段复制到目标字段。确保所有这些字段都首先存在。
<field name="destination" type="text" indexed="true" stored="true" required="false"/>
<field name="source1" type="text" indexed="false" stored="true" required="false" />
<field name="source2" type="text" indexed="false" stored="true" required="false" />
那么只有您可以创建副本字段。
<copyField source="source1" dest="destination"/>
<copyField source="source2" dest="destination"/>