我正在與solr5.5.1和spring-data-solr 1.4.2.RELEASE。我已經配置了我的工作項目的spring data solr,並且工作正常。但是當我使用模型類插入數據到solr時,它會使用model類的relavent字段自動更新託管模式文件。在此模型中,我沒有使用多值類型,但spring-data-solr將託管模式文件更新爲多值屬性。爲什麼發生?模型類的 樣品字段聲明彈簧數據solr總是創建多值字段
@SolrDocument(solrCoreName = "car")
public class CarModel{
@Id
@Indexed(type = "string")
private String id;
@Indexed(type = "string")
private String condition;
@Indexed(type = "string")
private String name;
//getters n setters
}
當我保存這個類的對象通過SolrCrudRepository
。然後託管架構將像這樣更新,
<field name="condition" type="strings"/>
<field name="id" type="string" multiValued="false" indexed="true" required="true" stored="true"/>
<field name="name" type="strings"/>
這裏的字段是多值的。這裏發生了什麼,我該如何解決這個問題?
我同意你的先生,但是用spring-data-solr它會爲模式創建領域。我們可以使用@Indexed註釋來指定solr字段的數據類型。但它不起作用。這就是問題。仍然我手動編輯架構文件。 –