前段时间在网上搜索些solrconfig的配置文件资料,发现大都比较零散。因此花了段时间整理相关内容。
推荐部分相关资料:http://www.luoshengsha.com/197.html
http://guohf.iteye.com/blog/1440838 这个也对solrconfig总结的比较详细。
<?xml version="1.0" encoding="UTF-8" ?>
<config>
<abortOnConfigurationError>${solr.abortOnConfigurationError:true}
</abortOnConfigurationError>
<luceneMatchVersion>LUCENE_32</luceneMatchVersion>
<!-- 索引文件所在目录的根目录 -->
<dataDir>${solr.data.dir:D:\\03workspaces\\solrQuery\\solrhome\\data}
</dataDir>
<!-- 以什么样的形式创建索引库有内存的方式也有文件的方式 -->
<directoryFactory name="DirectoryFactory"
class="${solr.directoryFactory:solr.StandardDirectoryFactory}" />
<!-- 索引文档使用的索引形式参数 -->
<!-- <indexDefaults> -->
<!-- <mergeFactor>10</mergeFactor> -->
<!--
设置在缓存中可以存在的文档数量并且这些文档超过这个数字的时候可以在没有删除
和刷出的时候将这些文档写到目录中
-->
<!--
<ramBufferSizeMB>32</ramBufferSizeMB>
<maxBufferedDocs>1000</maxBufferedDocs>
<maxFieldLength>10000</maxFieldLength>
<writeLockTimeout>1000</writeLockTimeout>
<commitLockTimeout>10000</commitLockTimeout>
-->
<!--
<mergePolicy class="org.apache.lucene.index.LogByteSizeMergePolicy"/>
-->
<!--
<mergeScheduler
class="org.apache.lucene.index.ConcurrentMergeScheduler"/>
-->
<!--
选择性的指定使用哪个lockFactory的实现
single = SingleInstanceLockFactory -
suggested for a read-only index or when there is no possibility of
another process trying to modify the index.
native = NativeFSLockFactory -
uses OS native file locking. Do not use when
multiple solr webapps in the same JVM are attempting to share a single
index.
simple = SimpleFSLockFactory -
uses a plain file for locking
-->
<!-- <lockType>native</lockType>-->
<!-- <termIndexInterval>256</termIndexInterval> -->
<!-- </indexDefaults> -->
<!--
这里的赋值覆盖在<indexDefautls>部分设置的值主要为了配置磁盘索引
-->
<mainIndex>
<useCompoundFile>false</useCompoundFile>
<ramBufferSizeMB>32</ramBufferSizeMB>
<mergeFactor>10</mergeFactor>
<!--
如果为true,在启动的时候不锁定任何持有写或者提交的锁。 这打败了允许多个程序安全访问lucene索引并且应该小心使用的理论依据。
如果锁的类型是none或者single这是不许要指定的
-->
<unlockOnStartup>false</unlockOnStartup>
<!--
如果为true,索引读取器将重新打开(通常更有效率) 代替关闭索引之后再重新打开索引读取器
-->
<reopenReaders>true</reopenReaders>
<deletionPolicy class="solr.SolrDeletionPolicy">
<!--
最多持有提交点的数量
-->
<str name="maxCommitsToKeep">1</str>
<!--
最多持有优化提交点的数量
-->
<str name="maxOptimizedCommitsToKeep">0</str>
<!--
一旦达到指定的时间删除所有的提交点
-->
<!--
<str name="maxCommitAge">30MINUTES</str> <str
name="maxCommitAge">1DAY</str>
-->
</deletionPolicy>
<!-- 将indexWriter执行的调试信息输出到指定文本中 -->
<!-- <infoStream file="INFOSTREAM.txt">false</infoStream> -->
</mainIndex>
<!-- 默认高性能的修改处理器 -->
<updateHandler class="solr.DirectUpdateHandler2">
<!--
AutoCommit(自动提交) 在确定条件下自动执行一个提交操作。 考虑使用在添加文档之间的时候进行提交,代替自动提交。
http://wiki.apache.org/solr/UpdateXmlMessages maxDocs
-自从上一次提交之后添加的文档达到最大数量将会触发一个新的提交 maxTime -在文档添加之前自动触发提交这允许通过最大时间量进行计算
-->
<!--
<autoCommit> <maxDocs>10000</maxDocs> <maxTime>1000</maxTime>
</autoCommit>
-->
<!--
关联修改事件的监听器 各种索引写入器能够关联事件触发监听器来采取操作 postCommit - fired after every
commit or optimize command 在每一个提交或者优化命令之后导致触发这个事件 postOptimize -
fired after every optimize command
-->
<!--
RunExecutableListener从就像postCommit或者postOptimize 这样的钩子执行外部的命令 exe
-具有运行能力的名字 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 - 设置java环境变量默认没有 (default is none)
-->
<!--
This example shows how RunExecutableListener could be used with the
script based replication...
http://wiki.apache.org/solr/CollectionDistribution
-->
<!--
<listener event="postCommit" class="solr.RunExecutableListener">
这里可以执行一个linux shell脚本 或者执行一个windows dos命令 <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>
<query>
<!--
booleanQuery能够最多关联的查询单元 如果是多solrcore配置的话只认为最后一个被 加载的core配置的参数有效
-->
<maxBooleanClauses>1024</maxBooleanClauses>
<!-- 过滤器缓存 -->
<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" />
<!-- 是否延时加载字段 -->
<enableLazyFieldLoading>true</enableLazyFieldLoading>
<queryResultWindowSize>20</queryResultWindowSize>
<queryResultMaxDocsCached>200</queryResultMaxDocsCached>
<!-- 查询相关事件的监听器 -->
<listener event="newSearcher" class="solr.QuerySenderListener">
<arr name="queries">
<!--
<lst><str name="q">solr</str><str name="sort">price asc</str></lst>
<lst><str name="q">rocks</str><str name="sort">weight
asc</str></lst>
-->
</arr>
</listener>
<listener event="firstSearcher" class="solr.QuerySenderListener">
<arr name="queries">
<lst>
<str name="q">static firstSearcher warming in solrconfig.xml
</str>
</lst>
</arr>
</listener>
<useColdSearcher>false</useColdSearcher>
<maxWarmingSearchers>2</maxWarmingSearchers>
</query>
<requestDispatcher handleSelect="true">
<requestParsers enableRemoteStreaming="true"
multipartUploadLimitInKB="2048000" />
<httpCaching never304="true" />
</requestDispatcher>
<!-- http://host/app/[core/]select?qt=name -->
<requestHandler name="search" class="solr.SearchHandler"
default="true">
<!--
默认的查询参数能够在这里指定,
这些参数将会覆盖在http请求中指定的同样的参数值
-->
<lst name="defaults">
<str name="echoParams">explicit</str>
<int name="rows">10</int>
<str name="wt">json</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>
-->
</requestHandler>
</config>
原文:http://blog.csdn.net/hu948162999/article/details/42488997