使用通配符时,MappingSolrConverter不会转换dynamicField类型

时间:2015-02-23 15:01:31

标签: java solr configuration

schema.xml

<dynamicField name="*_str" type="string" indexed="true" stored="true"     
       required="false" multiValued="true"/>

文件对象:

@SolrDocument
  public class Entity{
  @Field("*_str")
  private Map<String, String> identifiers;

SolrConfiguration as Java Class:

@Configuration
  public Class SolrConfiguration{
  @Bean
    public CustomSolrTemplate solrTemplate() throws Exception {
        SolrServer solrServer = solrServerFactoryBean().getObject();
        CustomSolrTemplate customSolrTemplate = new 
    CustomSolrTemplate(solrServer);
        customSolrTemplate.setSolrConverter(mappingSolrConverter());
        return customSolrTemplate;
    }

  @Bean
    public HttpSolrServerFactoryBean solrServerFactoryBean() {
        HttpSolrServerFactoryBean factory = new HttpSolrServerFactoryBean();
        factory.setUrl(solrServerUrl);
        return factory;
    }

  @Bean
   public SolrConverter mappingSolrConverter(){
        return new MappingSolrConverter(new SimpleSolrMappingContext());
    }
  ...
}

在阅读 solr.xml 时,仍未实例化@Field标识符。

我在这里做错了什么?

0 个答案:

没有答案