solr配置文件之solrconfig.xml

简介:

1.如果配置文件配置错误,是否提示。true要报错,false不报错。

 <abortOnConfigurationError>${solr.abortOnConfigurationError:true}</abortOnConfigurationError>

2.solr版本。

<luceneMatchVersion>LUCENE_31</luceneMatchVersion>


3. 索引文件目录,建索引的目录和查询的目录都是它。

<dataDir>${solr.data.dir:./solr/db/data}</dataDir>

4.一些基础配置

    4.1多少个document进行合并  

  <mergeFactor>10</mergeFactor>

    <!-- Sets the amount of RAM that may be used by Lucene indexing
         for buffering added documents and deletions before they are

         flushed to the Directory.  -->

   4.2 缓存大小

    <ramBufferSizeMB>32</ramBufferSizeMB>

多少个文档自动合并

 <mergeFactor>10</mergeFactor>


4.3.   

设置域的最大长度

<maxFieldLength>10000</maxFieldLength>

设置写锁的延迟时间
    <writeLockTimeout>1000</writeLockTimeout>

设置提交锁的延迟
    <commitLockTimeout>10000</commitLockTimeout>

4.4

 直接更新的方法:即调用solr默认的url访问。

 <updateHandler class="solr.DirectUpdateHandler2">

自动提交的最大文档数,最大时间

 <autoCommit> 
         <maxDocs>10000</maxDocs>
         <maxTime>1000</maxTime> 
       </autoCommit>


4.5包含所有查询的参数设置  <query>

设置lru缓存

    <filterCache class="solr.FastLRUCache"
                size="16384"
                          initialSize="4096"
                          autowarmCount="4096"/>

设置查询结果缓存

    <queryResultCache class="solr.LRUCache"
                      size="16384"
                                      initialSize="4096"
                                      autowarmCount="1024"/>

设置文档缓存
     <documentCache class="solr.LRUCache"
                   size="16384"
                               initialSize="16384"/>

是否延迟加载索引域

 <enableLazyFieldLoading>true</enableLazyFieldLoading>

设置查询的最大doc数

<queryResultMaxDocsCached>500</queryResultMaxDocsCached>

这个参数暂时未用

    <maxWarmingSearchers>2</maxWarmingSearchers>


假如用dataimport这solr自带的导入数据命令时,的参数,即与数据库对应的文件的位置

 <requestHandler name="/dataimport" class="org.apache.solr.handler.dataimport.DataImportHandler">  
    <lst name="defaults">  
      <str name="config">C:\solr-tomcat\solr\db\conf\db-data-config.xml</str>  
    </lst>  
  </requestHandler>  


这个标签是用来控制主索引服务器,与从索引服务器分发索引快照的所有属性的

     <requestHandler name="/replication" class="solr.ReplicationHandler" >
       <lst name="master">
         <str name="replicateAfter">commit</str>
         <str name="replicateAfter">startup</str>
         <str name="confFiles">schema.xml,stopwords.txt,elevate.xml</str>
         <str name="commitReserveDuration">00:00:60</str>
         <str name="httpBasicAuthUser">345</str>
         <str name="httpBasicAuthPassword">345</str>
       </lst>
     </requestHandler>



这个标签和他的名字是一样的,表示用于集群的组件所有参数

  <searchComponent name="clustering" 
                   enable="${solr.clustering.enabled:false}"
                   class="solr.clustering.ClusteringComponent" >
    <!-- Declare an engine -->
    <lst name="engine">
      <!-- The name, only one can be named "default" -->
      <str name="name">default</str>
      <!-- Class name of Carrot2 clustering algorithm. 
           
           Currently available algorithms are:
           
           * org.carrot2.clustering.lingo.LingoClusteringAlgorithm
           * org.carrot2.clustering.stc.STCClusteringAlgorithm
           
           See http://project.carrot2.org/algorithms.html for the
           algorithm's characteristics.
        -->
      <str name="carrot.algorithm">org.carrot2.clustering.lingo.LingoClusteringAlgorithm</str>
      <!-- Overriding values for Carrot2 default algorithm attributes.

           For a description of all available attributes, see:
           http://download.carrot2.org/stable/manual/#chapter.components.
           Use attribute key as name attribute of str elements
           below. These can be further overridden for individual
           requests by specifying attribute key as request parameter
           name and attribute value as parameter value.
        -->
      <str name="LingoClusteringAlgorithm.desiredClusterCountBase">20</str>
      
      <!-- The language to assume for the documents.
           
           For a list of allowed values, see:
           http://download.carrot2.org/stable/manual/#section.attribute.lingo.MultilingualClustering.defaultLanguage
       -->
      <str name="MultilingualClustering.defaultLanguage">ENGLISH</str>
    </lst>
    <lst name="engine">
      <str name="name">stc</str>
      <str name="carrot.algorithm">org.carrot2.clustering.stc.STCClusteringAlgorithm</str>
    </lst>
  </searchComponent>


当发生集群命令时,对应的相应参数。表示是否开启集群等。

 <requestHandler name="/clustering"
                  startup="lazy"
                  enable="${solr.clustering.enabled:false}"
                  class="solr.SearchHandler">
    <lst name="defaults">
      <bool name="clustering">true</bool>
      <str name="clustering.engine">default</str>
      <bool name="clustering.results">true</bool>
      <!-- The title field -->
      <str name="carrot.title">name</str>
      <str name="carrot.url">id</str>
      <!-- The field to cluster on -->
       <str name="carrot.snippet">features</str>
       <!-- produce summaries -->
       <bool name="carrot.produceSummary">true</bool>
       <!-- the maximum number of labels per cluster -->
       <!--<int name="carrot.numDescriptions">5</int>-->
       <!-- produce sub clusters -->
       <bool name="carrot.outputSubClusters">false</bool>
       
       <str name="defType">edismax</str>
       <str name="qf">
          text^0.5 features^1.0 name^1.2 sku^1.5 id^10.0 manu^1.1 cat^1.4
       </str>
       <str name="q.alt">*:*</str>
       <str name="rows">10</str>
       <str name="fl">*,score</str>
    </lst>     
    <arr name="last-components">
      <str>clustering</str>
    </arr>
  </requestHandler>


默认查询条件

  <admin>
    <defaultQuery>*:*</defaultQuery>

    <!-- configure a healthcheck file for servers behind a
         loadbalancer 
      -->
    <!--
       <healthcheck type="file">server-enabled</healthcheck>
      -->
  </admin>




      本文转自yjflinchong 51CTO博客,原文链接:http://blog.51cto.com/yjflinchong/1164964,如需转载请自行联系原作者




相关文章
|
9月前
|
安全 Java Linux
一文了解 Maven 的 settings.xml 配置文件
一文了解 Maven 的 settings.xml 配置文件
1704 0
|
4月前
|
XML Java 数据格式
Spring从入门到入土(xml配置文件的基础使用方式)
本文详细介绍了Spring框架中XML配置文件的使用方法,包括读取配置文件、创建带参数的构造对象、使用工厂方法和静态方法创建对象、对象生命周期管理以及单例和多例模式的测试。
176 7
Spring从入门到入土(xml配置文件的基础使用方式)
|
2月前
|
XML Java 数据格式
使用idea中的Live Templates自定义自动生成Spring所需的XML配置文件格式
本文介绍了在使用Spring框架时,如何通过创建`applicationContext.xml`配置文件来管理对象。首先,在resources目录下新建XML配置文件,并通过IDEA自动生成部分配置。为完善配置,特别是添加AOP支持,可以通过IDEA的Live Templates功能自定义XML模板。具体步骤包括:连续按两次Shift搜索Live Templates,配置模板内容,输入特定前缀(如spring)并按Tab键即可快速生成完整的Spring配置文件。这样可以大大提高开发效率,减少重复工作。
使用idea中的Live Templates自定义自动生成Spring所需的XML配置文件格式
|
8月前
|
XML Java 数据库连接
MyBatis入门——MyBatis XML配置文件(3)
MyBatis入门——MyBatis XML配置文件(3)
179 6
|
4月前
|
XML Java 应用服务中间件
tomcat学习一:tomcat 目录及配置文件学习 server.xml 等
这篇文章是关于Apache Tomcat服务器的目录结构、配置文件(特别是server.xml)的详细介绍和学习指南。
165 0
tomcat学习一:tomcat 目录及配置文件学习 server.xml 等
|
4月前
|
XML 存储 JSON
framework 的配置文件在.netcore里面不能用怎么处理?在.netcore中创建.xml配置文件
framework 的配置文件在.netcore里面不能用怎么处理?在.netcore中创建.xml配置文件
44 0
|
4月前
|
安全 内存技术
【文件上传-配置文件】crossdomain.xml跨域策略配置文件上传
【文件上传-配置文件】crossdomain.xml跨域策略配置文件上传
|
7月前
|
存储 缓存 分布式计算
Hadoop配置文件core-site.xml
【7月更文挑战第17天】
401 2
Hadoop配置文件core-site.xml
|
7月前
|
XML 分布式计算 资源调度
Hadoop配置文件mapred-site.xml
【7月更文挑战第18天】
501 7
|
7月前
|
存储 机器学习/深度学习 分布式计算
Hadoop配置文件hdfs-site.xml
【7月更文挑战第17天】
440 5