Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/solr/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Spring Data solr正在将fieldtype创建为text_general,尽管我们提到的是string_Spring_Solr_Spring Data Solr - Fatal编程技术网

Spring Data solr正在将fieldtype创建为text_general,尽管我们提到的是string

Spring Data solr正在将fieldtype创建为text_general,尽管我们提到的是string,spring,solr,spring-data-solr,Spring,Solr,Spring Data Solr,我正在尝试将SpringDataSolr集成到我的Spring应用程序中,我已经解决了以下问题 即使我在@Indexed属性中添加了type=string,它仍然将字段类型创建为“text\u general” 有什么意见吗 @SolrDocument(collection = "product") public class Product { @Id private String id; @Indexed(name="name",type = "string") private Strin

我正在尝试将SpringDataSolr集成到我的Spring应用程序中,我已经解决了以下问题

即使我在@Indexed属性中添加了type=string,它仍然将字段类型创建为“text\u general”

有什么意见吗

@SolrDocument(collection = "product")
 public class Product {
@Id
private String id;

@Indexed(name="name",type = "string")
private String name;
}
在Solrschema文件中,它显示为:

<field name="name" type="text_general"/>

有什么想法吗


谢谢。

您是否通过删除并重新创建核心/集合来完全重置核心/集合?否则该字段(通常)将与第一次定义的字段相同。是的,我已删除集合并执行索引。集合已创建,并且存在相同问题。您如何创建架构?您是否已为您的
@EnableSolrRepositories
启用了
schemaCreationSupport
@MatsLindh我试过了,但仍然是同一个问题。您必须首先了解模式是如何创建的-如果无模式模式处于活动状态,那么字段将被创建为
text\u general
,如果在数据到达之前字段不在Solr中,并且数据看起来像文本。如果希望字段成为
字符串
字段,则需要以这种方式显式创建它,可以从Spring数据(据我所知,这是上面链接的答案应该做的),也可以在索引之前手动创建或上传模式。您可以在测试时禁用无模式模式,因为如果提交了未定义的字段,它将出错。