简体   繁体   English

Spring Data Solr上的嵌入式solr的Solr.xml和schema.xml

[英]Solr.xml and schema.xml of embedded solr on Spring Data Solr

I'm confused about uses of EmbeddedSolrServerFactory used with Spring Data Solr. 我对将SpringData Solr与EmbeddedSolrServerFactory使用感到困惑。 I have a configuration for embed a Solr server: 我有一个用于嵌入Solr服务器的配置:

    @Bean(name = "solrServer")
    @ConditionalOnExpression("'${solr.embedded}'=='true'")
    public SolrServer embeddedSolrServer() throws Exception {
         EmbeddedSolrServerFactory factory = new EmbeddedSolrServerFactory(env.getRequiredProperty("solr.home"));
         return factory.getSolrServer();
    }

    @Bean
    public SolrTemplate solrTemplate(SolrServer solrServer) throws Exception {
        return new SolrTemplate(solrServer);
    }

I want use embedded Solr if solr.embedded property is true. 如果solr.embedded属性为true,我想使用嵌入式Solr。 It works as expected, but when it tries to create SolrServer bean I get the following exception: 它按预期工作,但是当尝试创建SolrServer bean时,出现以下异常:

Caused by: java.io.FileNotFoundException: /Users/ignasi/solr_home/solr.xml (No such file or directory)

So I guess it means that solr.xml file is needed. 所以我想这意味着需要solr.xml文件。 Which should be the content of this file? 该文件的内容应该是哪个? And I will need schema.xml file too? 我也需要schema.xml文件吗?

These are base Solr configuration files. 这些是基本的Solr配置文件。

solr.xml - https://wiki.apache.org/solr/Solr.xml%20%28supported%20through%204.x%29 solr.xml- https: //wiki.apache.org/solr/Solr.xml%20%28supported%20through%204.x%29

schema.xml - http://wiki.apache.org/solr/SchemaXml schema.xml- http: //wiki.apache.org/solr/SchemaXml

You also have solrconfig.xml - http://wiki.apache.org/solr/SolrConfigXml 您还拥有solrconfig.xml- http: //wiki.apache.org/solr/SolrConfigXml

You may download the latest distribution of Solr from http://lucene.apache.org/solr/ and try one of their example configurations to start with. 您可以从http://lucene.apache.org/solr/下载最新版本的Solr,并尝试从其示例配置之一开始。 Located under /example directory. 位于/ example目录下。 It may be easier to start with /example/solr. 从/ example / solr开始可能会更容易。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM