solrconfig.xml配置文件主要定义SOLR理规则,包含索引数据的存放位置,更新,删除,查询的一些规则配置。

能够在tomcat的安装路径下找到这个文件C:\Program Files\Apache Software Foundation\Tomcat 8.0\solr\collection1\conf

1.datadir节点

1.<dataDir>${solr.data.dir:d:/Server/Solr/data}</dataDir>定义了索引数据和日志文件的存放位置

   2.luceneMatchVersion

<luceneMatchVersion>4.8</luceneMatchVersion>

表示solr底层使用的是lucene4.8

3. lib

<lib dir="../../../contrib/extraction/lib"regex=".*\.jar"/>

表示solr引用包的位置,当dir相应的文件夹不存在时候。会忽略此属性

4.directoryFactory

索引存储方案,共同拥有下面存储方案

1、solr.StandardDirectoryFactory,这是一个基于文件系统存储文件夹的工厂,它会试图选择最好的实现基于你当前的操作系统和Java虚拟机版本号。

           2、solr.SimpleFSDirectoryFactory,适用于小型应用程序,不支持大数据和多线程。

           3、solr.NIOFSDirectoryFactory,适用于多线程环境。可是不适用在windows平台(非常慢),是由于JVM还存在bug。

4、solr.MMapDirectoryFactory,这个是solr3.1到4.0版本号在linux64位系统下默认的实现。

它是通过使用虚拟内存和内核特性调用

mmap去訪问存储在磁盘中的索引文件。它同意lucene或solr直接訪问I/O缓存。假设不须要近实时搜索功能。使用此工厂是个不错的方案。

           5、solr.NRTCachingDirectoryFactory,此工厂设计目的是存储部分索引在内存中,从而加快了近实时搜索的速度。

           6、solr.RAMDirectoryFactory,这是一个内存存储方案,不能持久化存储,在系统重新启动或servercrash时数据会丢失。

且不支持索引复制

<directoryFactory class="${solr.directoryFactory:solr.NRTCachingDirectoryFactory}" name="DirectoryFactory">
<str name="solr.hdfs.home">${solr.hdfs.home:}</str>
<str name="solr.hdfs.confdir">${solr.hdfs.confdir:}</str>
<str name="solr.hdfs.blockcache.enabled">${solr.hdfs.blockcache.enabled:true}</str>
<str name="solr.hdfs.blockcache.global">${solr.hdfs.blockcache.global:true}</str>
</directoryFactory>

5. codecFactory

                   编解码工厂同意使用自己定义的编解码器。比如:假设想启动per-field DocValues格式, 能够在solrconfig.xml里面设置SchemaCodecFactory:

                    docValuesFormat="Lucene42": 这是默认设置,全部数据会被载入到堆内存中。

          docValuesFormat="Disk": 这是另外一个实现,将部分数据存储在磁盘上。

          docValuesFormat="SimpleText": 文本格式,很慢,用于学习。

<codecFactory class="solr.SchemaCodecFactory"/>

                  <schemaFactory class="ClassicIndexSchemaFactory"/>

    6.indexconfig节点

用于设置索引的低级别的属性

1、<filter class="solr.LimitTokenCountFilterFactory" maxTokenCount="10000"/>//限制token最大长度

      2、<writeLockTimeout>1000</writeLockTimeout>//IndexWriter等待解锁的最长时间(毫秒)。

3、<maxIndexingThreads>8</maxIndexingThreads>//

      4、<useCompoundFile>false</useCompoundFile>//solr默觉得false。

假设为true,索引文件降低,检索性能降低,追求平衡。

      5、<ramBufferSizeMB>100</ramBufferSizeMB>//缓存

      6、<maxBufferedDocs>1000</maxBufferedDocs>//同上。两个同一时候定义时命中较低的那个。

7、<mergePolicy class="org.apache.lucene.index.TieredMergePolicy">

         <int name="maxMergeAtOnce">10</int>

          <int name="segmentsPerTier">10</int>

         </mergePolicy>

          //合并策略。

8、<mergeFactor>10</mergeFactor>//合并因子,每次合并多少个segments。

      9、<mergeScheduler class="org.apache.lucene.index.ConcurrentMergeScheduler"/>//合并调度器。

     10、<lockType>${solr.lock.type:native}</lockType>//锁工厂。

     11、<unlockOnStartup>false</unlockOnStartup>//是否启动时先解锁。

12、<termIndexInterval>128</termIndexInterval>//Lucene loads terms into memory 间隔

     13、<reopenReaders>true</reopenReaders>//又一次打开,替代先关闭-再打开。

     14、<deletionPolicy class="solr.SolrDeletionPolicy">//提交删除策略,必须实现org.apache.lucene.index.IndexDeletionPolicy

     15、<str name="maxCommitsToKeep">1</str>

     16、<str name="maxOptimizedCommitsToKeep">0</str>

     17、<str name="maxCommitAge">30MINUTES</str> OR <str name="maxCommitAge">1DAY</str><br>   

  18、   <infoStream   file="INFOSTREAM.txt">false</infoStream>//相当于把创建索引时的日志输出。

<lockType>${solr.lock.type:native}</lockType>

       设置索引库的锁方式,主要有三种:

        1.single:适用于仅仅读的索引库,即索引库是定死的,不会再更改

        2.native:使用本地操作系统的文件锁方式,不能用于多个solr服务共用同一个索引库。Solr3.6 及后期版本号使用的默认锁机制。

        3.simple:使用简单的文件锁机制

  7. updateHandler节点

定义更新处理器,

<updateLog>
<str name="dir">${solr.ulog.dir:}</str>
</updateLog>

设置索引库更新日志。默认路径为solr home以下的data/tlog。随着索引库的频繁更新,tlog文件会越来越大,

所以建议提交索引时採用硬提交方式<autoCommit>,即批量提交。

<autoCommit>
<maxTime>15000</maxTime>
<maxDocs>10000</maxDocs>
<openSearcher>false</openSearcher>
</autoCommit>

自己主动硬提交方式:maxTime:设置多长时间提交一次maxDocs:设置达到多少文档提交一次openSearcher:文档提交后是否开启新的searcher,

假设false。文档仅仅是提交到index索引库,搜索结果中搜不到此次提交的文档。假设true,既提交到index索引库,也能在搜索结果中搜到此次提交的内容。

<updateHandler class="solr.DirectUpdateHandler2">
<!-- 同意事务日志 -->
<updateLog>
<str name="dir">${solr.ulog.dir:}</str>
</updateLog> <!--
在满足一定条件时自己主动提交。maxDocs/maxTime/openSearcher
-->
<autoCommit>
<maxTime>15000</maxTime>
<openSearcher>false</openSearcher>
</autoCommit> <!-- 软提交VS硬提交 -->
<!--
<autoSoftCommit>
<maxTime>1000</maxTime>
</autoSoftCommit>
--> <!--
更新相关事件监听器
postCommit - fired after every commit or optimize command
postOptimize - fired after every optimize command
-->
<!-- The RunExecutableListener executes an external command from a
hook such as postCommit or postOptimize.
exe - the name of the executable to run
dir - dir to use as the current working directory. (default=".")
wait - the calling thread waits until the executable returns.
(default="true")
args - the arguments to pass to the program. (default is none)
env - environment variables to set. (default is none)
-->
<!--
<listener event="postCommit" class="solr.RunExecutableListener">
<str name="exe">solr/bin/snapshooter</str>
<str name="dir">.</str>
<bool name="wait">true</bool>
<arr name="args"> <str>arg1</str> <str>arg2</str> </arr>
<arr name="env"> <str>MYVAR=val1</str> </arr>
</listener>
--> </updateHandler>

   8.Query查询节点

<maxBooleanClauses>1024</maxBooleanClauses>

             设置boolean 查询中,最大条件数。在范围搜索或者前缀搜索时,会产生大量的 boolean 条件。

             假设条件数达到这个数值时。将抛出异常,限制这个条件数。能够防止条件过多查询等待时间过长。

缓存方法http://www.cnblogs.com/phinecos/archive/2012/05/24/2517018.html

<filterCache class="solr.FastLRUCache" size="512" initialSize="512" autowarmCount="0"/>

<queryResultCache class="solr.LRUCache" size="512" initialSize="512" autowarmCount="0"/>

<documentCache class="solr.LRUCache" size="512" initialSize="512" autowarmCount="0"/>

<queryResultMaxDocsCached>200</queryResultMaxDocsCached>

<maxWarmingSearchers>2</maxWarmingSearchers>

    9.Request Dispatcher

请求转发器

<!-- Request Dispatcher
主要是介绍当有请求訪问SolrCore时SolrDispatchFilter怎样处理。 handleSelect是一个曾经版本号中遗留下来的属性,会影响请求的相应行为(比方/select? qt=XXX)。
当handleSelect="true"时导致SolrDispatchFilter将请求转发给qt指定的处理器(前提是/select已经注冊)。
当handleSelect="false"时会直接訪问/select,若/select未注冊则为404。
-->
<requestDispatcher handleSelect="false" > <!-- Request Parsing:请求解析
这些设置说明Solr Requests怎样被解析,以及对ContentStreams有什么限制。 enableRemoteStreaming - 是否同意使用stream.file和stream.url參数来指定远程streams。 multipartUploadLimitInKB - 指定多文件上传时Solr同意的最大的size。 formdataUploadLimitInKB - 表单通过POST请求发送的最大size
-->
<requestParsers enableRemoteStreaming="true"
multipartUploadLimitInKB="2048000"
formdataUploadLimitInKB="2048"/> <!-- HTTP Caching
设置HTTP缓存的相关參数。 -->
<httpCaching never304="true" /> <!--
<httpCaching never304="true" >
<cacheControl>max-age=30, public</cacheControl>
</httpCaching>
--> <!--
<httpCaching lastModifiedFrom="openTime"
etagSeed="Solr">
<cacheControl>max-age=30, public</cacheControl>
</httpCaching>
-->
</requestDispatcher>

10.requestHandler

请求处理器

<!-- Request Handlers
输入的请求会通过请求中的路径被转发到特定的处理器。
-->
<!-- SearchHandler
主要的请求处理器是SearchHandler,它提供一系列SearchComponents。 通过multiple shards支持分布式。
-->
<requestHandler name="/select" class="solr.SearchHandler">
<!-- 能够指定默认值。-->
<lst name="defaults">
<str name="echoParams">explicit</str>
<int name="rows">10</int>
<str name="df">text</str>
</lst>
<!-- 加入属性 -->
<!--
<lst name="appends">
<str name="fq">inStock:true</str>
</lst>
--> <!-- 使用方法同上,尽量不要使用。-->
<!--
<lst name="invariants">
<str name="facet.field">cat</str>
<str name="facet.field">manu_exact</str>
<str name="facet.query">price:[* TO 500]</str>
<str name="facet.query">price:[500 TO *]</str>
</lst>
-->
<!-- 以下的配置能够重置SearchComponents-->
<!--
<arr name="components">
<str>nameOfCustomComponent1</str>
<str>nameOfCustomComponent2</str>
</arr>
-->
</requestHandler>

假设想更深入了解,能够參考下这几篇文章,

http://wiki.apache.org/solr/SolrConfigXml/

http://www.yunvn.com/thread-15932-1-1.html

http://www.luoshengsha.com/197.html

版权声明:本文博主原创文章,博客,未经同意不得转载。

电商指尖---(6)solrconfig.xml配置具体解释的更多相关文章

  1. solrconfig.xml配置详解

    solrconfig.xml配置文件主要定义了SOLR的一些处理规则,包括索引数据的存放位置,更新,删除,查询的一些规则配置. 可以在tomcat的安装路径下找到这个文件C:\Program File ...

  2. Spring Boot微服务电商项目开发实战 --- 基础配置及搭建

    根据SpringBoot实现分布式微服务项目近两年的开发经验,今天决定开始做SpringBoot实现分布式微服务项目的系列文章,帮助其他正在使用或计划使用SringBoot开发的小伙伴们.本次系列文章 ...

  3. 校园电商项目4——SSM各项配置

    步骤一:数据库连接文件 jdbc.driver=com.mysql.jdbc.Driver jdbc.url=jdbc:mysql://localhost:3306/school_o2o?useUni ...

  4. 指尖上的电商---(5)schema.xml配置具体解释

    这一节我们看下schema.xml文件中各个节点的配置极其作用.schema.xml文件中面主要定义了索引数据类型,索引字段等信息. 主要包含了下面节点 1.fieldtype节点 fieldtype ...

  5. 校园电商项目3(基于SSM)——配置Maven

    步骤一:添加必要文件夹 先在src/main/resources下添加两个文件夹 接着在webapp文件夹下添加一个resources文件夹存放我们的静态网页内容 WEB-INF里的文件是不会被客户端 ...

  6. 电商指尖---(9).net发展Solr中间Facet特征

    上一节中我们演示了在SolrAdmin中使用Facet功能来进行分组统计.这一节我们看看如何使用.NET开发Solr中的Facet功能.在讲Facet功能的同一时候, 我们看下.Net中如何使用Sol ...

  7. spring mvc 中web.xml配置信息解释

    在项目中总会遇到一些关于加载的优先级问题,近期也同样遇到过类似的,所以自己查找资料总结了下,下面有些是转载其他人的,毕竟人家写的不错,自己也就不重复造轮子了,只是略加点了自己的修饰. 首先可以肯定的是 ...

  8. solr的schema.xml配置属性解释

    schema.xml做什么? SOLR加载数据,创建索引和数据时,核心数据结构的配置文件是schema.xml,该配置文件主要用于配置数据源,字段类型定义,搜索类型定义等.schema.xml的配置直 ...

  9. Web.xml配置具体解释之context-param

    转自:http://blog.csdn.net/liaoxiaohua1981/article/details/6759206 格式定义: [html] view plaincopy <cont ...

随机推荐

  1. _00021 尼娜抹微笑伊拉克_谁的的最离奇的异常第二阶段 Jedis pool.returnResource(jedis)

    笔者博文:妳那伊抹微笑 博客地址:http://blog.csdn.net/u012185296 博文标题:_00021 妳那伊抹微笑_谁的异常最诡异第二期之 Jedis pool.returnRes ...

  2. extern int *a与extern int a[]

    extern int *a与int a[] Table of Contents 1. 问题: 2. 解答: 1 问题: 以下的声明取自某个源文件: int a[10]; int *b=a; 但在还有一 ...

  3. ajax相关体会

    参考原文: 例子:http://blog.csdn.net/beijiguangyong/article/details/7725596 原理讲解:http://www.cnblogs.com/min ...

  4. 《JavaScript设计模式与开发实践》读书笔记之模板方法模式

    1. 模板方法模式 1.1 面向对象方式实现模板方法模式 以泡茶和泡咖啡为例,可以整理为下面四步 把水煮沸 用沸水冲泡饮料 把饮料倒进杯子 加调料 首先创建一个抽象父类来表示泡一杯饮料 var Bev ...

  5. Windows Phone开发(42):缓动动画

    原文:Windows Phone开发(42):缓动动画 前面在讨论关键帧动画的时候,我有意把几个带缓动动画的关键帧动画忽略掉,如EasingColorKeyFrame.EasingDoubleKeyF ...

  6. Solaris 10下使用Python3

    通常在Solaris 10上仅仅能使用Python2.x. 假设使用Python3的话,一种就是http://www.sunfreeware.com获取可用的二进制版本号.只是眼下这个站点已经不提供免 ...

  7. Android Google Map v2具体解释:开发环境配置

    Android Google Map v2具体解释:开发环境配置                                       --转载请注明出处:coder-pig 说在前面: 说到地 ...

  8. Oracle数据库的锁类型

    Oracle数据库的锁类型 博客分类: oracle   Oracle数据库的锁类型 根据保护的对象不同,Oracle数据库锁可以分为以下几大类:DML锁(data   locks,数据锁),用于保护 ...

  9. 傻瓜式破解linux--rootpassword

    破password的方法: 方法1.单用户模式改动 (表示进入到单用户模式) .按回车键.按b键启动.进入单用户模式,进行password改动.重新启动 init 5 口诀:e2e 空格1 回车b 开 ...

  10. VBoxGuestAdditions.iso下载

    http://download.virtualbox.org/virtualbox/4.1.2/VBoxGuestAdditions_4.1.2.iso 其他版本可能反过来确定..