位于:${solr.home}\example\techproducts\solr\techproducts\conf\solrconfig.xml

  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!--
  3. Licensed to the Apache Software Foundation (ASF) under one or more
  4. contributor license agreements. See the NOTICE file distributed with
  5. this work for additional information regarding copyright ownership.
  6. The ASF licenses this file to You under the Apache License, Version 2.0
  7. (the "License"); you may not use this file except in compliance with
  8. the License. You may obtain a copy of the License at
  9.  
  10. http://www.apache.org/licenses/LICENSE-2.0
  11.  
  12. Unless required by applicable law or agreed to in writing, software
  13. distributed under the License is distributed on an "AS IS" BASIS,
  14. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  15. See the License for the specific language governing permissions and
  16. limitations under the License.
  17. -->
  18.  
  19. <!--
  20. 更多的配置选项,请参见 http://wiki.apache.org/solr/SolrConfigXml.
  21. -->
  22. <config>
  23. <!-- 以下所有配置中的"solr."前辍代表的是一些相应的包名,如: org.apache.solr.(search|update|request|core|analysis)
  24.  
  25. 对于自定义的插件,你需要指定全名(包名+类名).
  26. -->
  27.  
  28. <!-- 控制Solr附属的Lucene各组件的版本. 最新版本解决了已知的bug,并进行了一些提升。通常情况下,你需要使用最新版本。
    如果修改了此值,强烈建议重新进行索引。
  29. -->
  30. <luceneMatchVersion>6.5.0</luceneMatchVersion>
  31.  
  32. <!-- <lib/> 指示Solr去加载哪些Jar包,并且resolve你在solrconfig.xml或schema.xml中指定的
    插件(如: Analyzers, Request Handlers, etc...).
  33.  
  34. 所有的目录均是相对目录,相对于 instanceDir.
  35.  
  36. 按照<lib/>在solrconfig.xml中出现的顺序去处理<lib/>, 如果某个plugin的jar依赖其它的jar包,则
    那些被依赖的jar包需要写在前面。
  37.  
  38. 如果"./lib"目录存在于instanceDir中, 如下配置可使所有此目录下的文件均被加载
  39.  
  40. <lib dir="./lib" />
  41. -->
  42.  
  43. <!-- 'dir' 用于把此目录下所有的jar包都加入到classpath。
  44.  
  45. 'regex' 符合此正则表达示的jar包才会被加载
  46.  
  47. 下面的例子加载了一些solr-contribs和其外部依赖
  48. -->
  49. <lib dir="${solr.install.dir:../../../..}/contrib/extraction/lib" regex=".*\.jar" />
  50. <lib dir="${solr.install.dir:../../../..}/dist/" regex="solr-cell-\d.*\.jar" />
  51.  
  52. <lib dir="${solr.install.dir:../../../..}/contrib/clustering/lib/" regex=".*\.jar" />
  53. <lib dir="${solr.install.dir:../../../..}/dist/" regex="solr-clustering-\d.*\.jar" />
  54.  
  55. <lib dir="${solr.install.dir:../../../..}/contrib/langid/lib/" regex=".*\.jar" />
  56. <lib dir="${solr.install.dir:../../../..}/dist/" regex="solr-langid-\d.*\.jar" />
  57.  
  58. <lib dir="${solr.install.dir:../../../..}/contrib/velocity/lib" regex=".*\.jar" />
  59. <lib dir="${solr.install.dir:../../../..}/dist/" regex="solr-velocity-\d.*\.jar" />
  60.  
  61. <!-- 'path' 用于指定单独的jar包。如果此jar包不能被加载,则会被记录为严重错误。 -->
  62. <!--
  63. <lib path="../a-jar-that-does-not-exist.jar" />
  64. -->
  65.  
  66. <!-- 指定索引数据文件的目录。默认值是Solr home 下的data目录。如果使用了副本,
    则需要和副本中的配置一致。 -->
  67. <dataDir>${solr.data.dir:}</dataDir>
  68.  
  69. <!-- 索引使用的 DirectoryFactory
  70.  
  71. solr.StandardDirectoryFactory 基于文件系统,并尽力为当前JVM和平台 选择较好的实现。
    solr.NRTCachingDirectoryFactory 默认的DirectoryFactory。包装了 solr.StandardDirectoryFactory,
    并缓存了一些小文件以提供较好的NRT(Near-Real-Time)性能
  72.  
  73. 特别的一些实现: solr.MMapDirectoryFactory, solr.NIOFSDirectoryFactory, or solr.SimpleFSDirectoryFactory.
  74.  
  75. solr.RAMDirectoryFactory 基于内存,不会持久化,不能和副本一起工作。个人认为只适用于开发测试。
  76. -->
  77. <directoryFactory name="DirectoryFactory"
  78. class="${solr.directoryFactory:solr.NRTCachingDirectoryFactory}"/>
  79.  
  80. <!-- CodecFactory 定义倒排索引的格式。默认实现是 SchemaCodecFactory。
    SchemaCodecFactory 是 Lucene 的官方索引格式,并另外提供了自定义的(postingsFormat/docValuesFormat)属性。
    注意,大部分的可选的实现都是实验性的。因此如果你自定义了索引格式,你最好在升级之前转化成官方的格式
    (通过 IndexWriter.addIndexes(IndexReader))以避免不必要的重新索引。
  81. "compressionMode" 属性可以加入到 <codecFactory> 中,其值可以为 "BEST_SPEED" (default) or "BEST_COMPRESSION".
  82. -->
  83. <codecFactory class="solr.SchemaCodecFactory"/>
  84.  
  85. <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  86. Index Config - 这些配置控制索引的底层行为。
  87. 这里多数的示例配置使用了默认值。为了更容易地看清楚哪些是自定义的,所以被注释掉了。
  88. 注意: 此配置代替了旧版本中的 <indexDefaults> and <mainIndex>
  89. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
  90. <indexConfig>
  91. <!-- 从4.0开始,maxFieldLength被移掉了。可以在fieldType定义中包含
  92. LimitTokenCountFilterFactory 以获得相似的功能。例如:
  93. <filter class="solr.LimitTokenCountFilterFactory" maxTokenCount="10000"/>
  94. -->
  95. <!-- IndexWriter等待写锁的最长等待时间(ms)。 默认值: 1000 -->
  96. <!-- <writeLockTimeout>1000</writeLockTimeout> -->
  97.  
  98. <!-- 启用组合文件将会使索引数据文件数量减少(以降低性能为代价)
  99. Lucene中默认值是"true". Solr是"false" (since 3.6) -->
  100. <!-- <useCompoundFile>false</useCompoundFile> -->
  101.  
  102. <!-- ramBufferSizeMB 设置Lucene索引时用于缓存增加document和删除操作的 RAM 大小。默认值 100MB
  103. maxBufferedDocs 设置最大缓存的document数量。
  104. 如果同时设置了这两个值,则只要有一个条件满足,就进行flush操作。 -->
  105. <!-- <ramBufferSizeMB>100</ramBufferSizeMB> -->
  106. <!-- <maxBufferedDocs>1000</maxBufferedDocs> -->
  107.  
  108. <!-- Merge Policy 控制如何合并片断(segments)
  109. 从Solr/Lucene 3.3开始,默认值是 TieredMergePolicy.
  110. Lucene 2.3及以前,默认值是 LogByteSizeMergePolicy
  111. -->
  112. <!--
  113. <mergePolicyFactory class="org.apache.solr.index.TieredMergePolicyFactory">
  114. <int name="maxMergeAtOnce">10</int>
  115. <int name="segmentsPerTier">10</int>
  116. <double name="noCFSRatio">0.1</double>
  117. </mergePolicyFactory>
  118. -->
  119.  
  120. <!-- Merge Scheduler 控制如何进行合并。
  121. ConcurrentMergeScheduler (Lucene 2.3 default)能够在后台以独立的线程进行合并
  122. The SerialMergeScheduler (Lucene 2.2 default) 则不行.
  123. -->
  124. <!--
  125. <mergeScheduler class="org.apache.lucene.index.ConcurrentMergeScheduler"/>
  126. -->
  127.  
  128. <!-- LockFactory
  129. 以下值代表不同的实现
  130.  
  131. single = SingleInstanceLockFactory - 用于只读的索引或没有其它程序修改索引的情形
  132. native = NativeFSLockFactory - 使用系统本身的文件锁。当同个JVM有多个Solr应用并且共享一个索引时不要用这个
  133. simple = SimpleFSLockFactory - 使用简单的文件锁
  134.  
  135. Solr3.6及以后,默认值是'native', 之前默认值是 'simple'
  136.  
  137. 更多信息详见 http://wiki.apache.org/lucene-java/AvailableLockFactories
  138. -->
  139. <lockType>${solr.lock.type:native}</lockType>
  140.  
  141. <!-- Commit Deletion Policy
  142. 这里可以指定自定义删除策略。自定义的类必须实现 org.apache.lucene.index.IndexDeletionPolicy.
  143. Solr 默认的IndexDeletionPolicy 实现支持基于提交次数,提交时间段和最优化状态时进行删除索引的提交操作
  144. 不管怎么样,必须保留最近的提交点
  145. -->
  146. <!--
  147. <deletionPolicy class="solr.SolrDeletionPolicy">
  148. -->
  149. <!-- The number of commit points to be kept -->
  150. <!-- <str name="maxCommitsToKeep">1</str> -->
  151. <!-- The number of optimized commit points to be kept -->
  152. <!-- <str name="maxOptimizedCommitsToKeep">0</str> -->
  153. <!-- 达到下面的时间点时,所有的commit points将会被删除 -->
  154. <!--
  155. <str name="maxCommitAge">30MINUTES</str>
  156. <str name="maxCommitAge">1DAY</str>
  157. -->
  158. <!--
  159. </deletionPolicy>
  160. -->
  161.  
  162. <!-- Lucene Infostream
  163. 有助于高级调试,Lucene提供了索引时的详细信息
  164. 设置为true时,将把以 Lucene为基础的 IndexWriter的 info stream 写入到Solr的日志中
    默认设置为TRUE,可通过log4j.properties 配置.
  165. -->
  166. <infoStream>true</infoStream>
  167. </indexConfig>
  168.  
  169. <!-- JMX
  170.  
  171. This example enables JMX if and only if an existing MBeanServer
  172. is found, use this if you want to configure JMX through JVM
  173. parameters. Remove this to disable exposing Solr configuration
  174. and statistics to JMX.
  175.  
  176. For more details see http://wiki.apache.org/solr/SolrJmx
  177. -->
  178. <jmx />
  179. <!-- If you want to connect to a particular server, specify the
  180. agentId
  181. -->
  182. <!-- <jmx agentId="myAgent" /> -->
  183. <!-- If you want to start a new MBeanServer, specify the serviceUrl -->
  184. <!-- <jmx serviceUrl="service:jmx:rmi:///jndi/rmi://localhost:9999/solr"/>
  185. -->
  186.  
  187. <!-- 默认的高性能的 update handler -->
  188. <updateHandler class="solr.DirectUpdateHandler2">
  189.  
  190. <!-- 启用事务日志,用于实时获取,持久化和Solr云副本恢复。日志能够随着未提交的索引增大而增大,因此推荐
    使用一个确切的 autoCommit.
  191. "dir" - 事务日志的目录。默认使用Solr的data目录
  192. "numVersionBuckets" - sets the number of buckets used to keep
  193. track of max version values when checking for re-ordered
  194. updates; increase this value to reduce the cost of
  195. synchronizing access to version buckets during high-volume
  196. indexing, this requires 8 bytes (long) * numVersionBuckets
  197. of heap space per Solr core.
  198. -->
  199. <updateLog>
  200. <str name="dir">${solr.ulog.dir:}</str>
  201. <int name="numVersionBuckets">${solr.ulog.numVersionBuckets:65536}</int>
  202. </updateLog>
  203.  
  204. <!-- AutoCommit
  205. 满足某种条件时进行提交。增加document时,可使用 "commitWithin"来代替 autoCommit
  206. http://wiki.apache.org/solr/UpdateXmlMessages
  207. maxDocs - 触发新的提交前的最大document数量.
  208. maxTime - 触发新的提交前的最长时间(ms)
  209. openSearcher - 为false时, 提交会使最近索引的变化保存下来。但是这些变化对新的searcher不可见
  210. 如果启用 updateLog,则强烈建议使用某种autoCommit,以限制日志大小。
  211. -->
  212. <autoCommit>
  213. <maxTime>${solr.autoCommit.maxTime:15000}</maxTime>
  214. <openSearcher>false</openSearcher>
  215. </autoCommit>
  216.  
  217. <!-- softAutoCommit 与 autoCommit 类似,但是只保证改变可见,不保证改变同步到硬盘。
    比hard commit 更快,更接近实时搜索 -->
  218. <autoSoftCommit>
  219. <maxTime>${solr.autoSoftCommit.maxTime:-1}</maxTime>
  220. </autoSoftCommit>
  221.  
  222. <!-- 与更新相关的事件监听器
  223. postCommit - 在每次提交或优化命令后触发
  224. postOptimize - 在每次优化命令后触发
  225. -->
  226. <!-- RunExecutableListener 执行钩子(例如postCommit or postOptimize)中的外部命令
  227.  
  228. exe - 可执行文件名
  229. dir - 当前工作目录(default=".")
  230. wait - 调用命令的线程是否等待,直到被调用的命令结束 (default="true")
  231. args - the arguments to pass to the program. (default is none)
  232. env - environment variables to set. (default is none)
  233. -->
  234. <!-- RunExecutableListener 的用法详见:
  235. http://wiki.apache.org/solr/CollectionDistribution
  236. -->
  237. <!--
  238. <listener event="postCommit" class="solr.RunExecutableListener">
  239. <str name="exe">solr/bin/snapshooter</str>
  240. <str name="dir">.</str>
  241. <bool name="wait">true</bool>
  242. <arr name="args"> <str>arg1</str> <str>arg2</str> </arr>
  243. <arr name="env"> <str>MYVAR=val1</str> </arr>
  244. </listener>
  245. -->
  246.  
  247. </updateHandler>
  248.  
  249. <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  250. Query 部分的设置用于控制查询时的行为
  251. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
  252. <query>
  253. <!-- Max Boolean Clauses 最大 BooleanQuery 分支数
  254. ** WARNING **
  255. 此设置将影响全局的 Lucene 属性,所以会影响所有的 SolrCores. 如果多个 solrconfig.xml files
  256. 设置了不同的值,将会使用最后被初始化的SolrCore中的值.
  257. -->
  258. <maxBooleanClauses>1024</maxBooleanClauses>
  259.  
  260. <!-- Slow Query Threshold (in millis)
  261. 对于高频率查询请求,记录所有的请求将成为瓶颈。因此通常会关闭 INFO 日志。 我们可以设置一个latency threshold
    来判断哪些请求是被认为比较慢的请求,用WARN级别记录此类请求。从而我们可以较容易的判断那些比较慢的查询
  262. -->
  263. <slowQueryThresholdMillis>-1</slowQueryThresholdMillis>
  264.  
  265. <!-- Solr内部查询缓存
  266.  
  267. 有两种缓存实现:
  268. LRUCache - 基于同步的 LinkedHashMap
  269. FastLRUCache - 基于 ConcurrentHashMap.
  270.  
  271. 在单线程中,FastLRUCache 具有较快的 gets,较慢的 puts。因此当缓存命中率
    比较高时(>75%), 会比 LRUCache 更快;并且在多CPU环境下也可能更快一点
  272. -->
  273.  
  274. <!-- Filter Cache
    用于缓存未排序的 SolrIndexSearcher 的查询结果集,
  275. 当打开一个新的 searcher 时,可能会使用旧的 searcher 中缓存的值
  276.  
  277. Parameters:
  278. class - SolrCache实现类 (LRUCache or FastLRUCache)
  279. size - 缓存中的最大实体数
  280. initialSize - 初始容量 (实体数)
  281. autowarmCount - 从旧的缓存中导入的预加载的实体数
  282. -->
  283. <filterCache class="solr.FastLRUCache"
  284. size="512"
  285. initialSize="512"
  286. autowarmCount="0"/>
  287.  
  288. <!-- Query Result Cache 缓存排序后的查询结果
  289. maxRamMB - 最大缓存容量
  290. -->
  291. <queryResultCache class="solr.LRUCache"
  292. size="512"
  293. initialSize="512"
  294. autowarmCount="0"/>
  295.  
  296. <!-- Document Cache 缓存文档对象
  297.  
  298. Since Lucene internal document ids are transient,
  299. this cache will not be autowarmed.
  300. -->
  301. <documentCache class="solr.LRUCache"
  302. size="512"
  303. initialSize="512"
  304. autowarmCount="0"/>
  305.  
  306. <!-- custom cache currently used by block join -->
  307. <cache name="perSegFilter"
  308. class="solr.search.LRUCache"
  309. size="10"
  310. initialSize="0"
  311. autowarmCount="10"
  312. regenerator="solr.NoOpRegenerator" />
  313.  
  314. <!-- Field Value Cache 字段值缓存
  315. 如果此处不设置的话,依然会创建默认的fieldValueCache
  316. -->
  317. <!--
  318. <fieldValueCache class="solr.FastLRUCache"
  319. size="512"
  320. autowarmCount="128"
  321. showItems="32" />
  322. -->
  323.  
  324. <!-- Custom Cache 自定义缓存
  325.  
  326. Example of a generic cache. These caches may be accessed by
  327. name through SolrIndexSearcher.getCache(),cacheLookup(), and
  328. cacheInsert(). The purpose is to enable easy caching of
  329. user/application level data. The regenerator argument should
  330. be specified as an implementation of solr.CacheRegenerator
  331. if autowarming is desired.
  332. -->
  333. <!--
  334. <cache name="myUserCache"
  335. class="solr.LRUCache"
  336. size="4096"
  337. initialSize="1024"
  338. autowarmCount="1024"
  339. regenerator="com.mycompany.MyRegenerator"
  340. />
  341. -->
  342.  
  343. <!-- Lazy Field Loading 延时加载Field
  344.  
  345. 设置为 true, stored fields 只会在需要的时候才加载。如果通常不需要加载所有的
    stored fields, 将会极大地提升性能,尤其是包含大的压缩过的文本字段的情况
  346. -->
  347. <enableLazyFieldLoading>true</enableLazyFieldLoading>
  348.  
  349. <!-- Use Filter For Sorted Query
  350.  
  351. A possible optimization that attempts to use a filter to
  352. satisfy a search. If the requested sort does not include
  353. score, then the filterCache will be checked for a filter
  354. matching the query. If found, the filter will be used as the
  355. source of document ids, and then the sort will be applied to
  356. that.
  357.  
  358. 此设置只用于频繁地使用同一查询,只是排序选项有所不同并且不用"score"字段排序的情况。
    一般情况下,较少使用。
  359. -->
  360. <!--
  361. <useFilterForSortedQuery>true</useFilterForSortedQuery>
  362. -->
  363.  
  364. <!-- Result Window Size
  365.  
  366. 对queryResultCache的优化。比查询请求要求的更多的结果将会被保存。
    个人感觉是对分页查询的优化。比如每页需要10条记录,此值设置为30时,第一次查询时就
    会取出30条记录,则跑到第二页时,不需要再次查询,而是直接从上一次的查询结果集里取。
  367. -->
  368. <queryResultWindowSize>30</queryResultWindowSize>
  369.  
  370. <!-- queryResultCache 中缓存的最大Document数量
  371. -->
  372. <queryResultMaxDocsCached>200</queryResultMaxDocsCached>
  373.  
  374. <!-- Query Related Event Listeners 跟查询相关的事件监听器
  375.  
  376. newSearcher - 打开一个新的searcher时(当前有searcher处理请求)触发。 它被用来准备某些缓存以防止某种长时间的查询请求
  377.  
  378. firstSearcher - 打开一个新的searcher时(当前没有注册过的searcher处理请求或者无法获得预热数据)触发
  379.  
  380. 个人理解:firstSearcher 是在应用启动后,如果一次查询都没有做过,当进行第一次查询时,会被触发。newSearcher是从第二次查询
    开始触发。
  381. -->
  382. <!-- QuerySenderListener takes an array of NamedList and executes a
  383. local query request for each NamedList in sequence.
  384. -->
  385. <listener event="newSearcher" class="solr.QuerySenderListener">
  386. <arr name="queries">
  387. <!--
  388. <lst><str name="q">solr</str><str name="sort">price asc</str></lst>
  389. <lst><str name="q">rocks</str><str name="sort">weight asc</str></lst>
  390. -->
  391. </arr>
  392. </listener>
  393. <listener event="firstSearcher" class="solr.QuerySenderListener">
  394. <arr name="queries">
  395. <lst>
  396. <str name="q">static firstSearcher warming in solrconfig.xml</str>
  397. </lst>
  398. </arr>
  399. </listener>
  400.  
  401. <!-- Use Cold Searcher
  402. 如果有一个新的查询请求,但是当前没有注册过的searcher,则马上注册仍在预热的searcher,
    并使用它。如果设置成false,所有的请求将被阻塞直到第一个searcher预热完毕。
  403. -->
  404. <useColdSearcher>false</useColdSearcher>
  405.  
  406. <!-- Max Warming Searchers
  407.  
  408. 后台同时预热的最大searcher数。 超出此值将报错。
  409. 只读的slave建议设置1-2 , 为master可设置更高的值
  410. -->
  411. <maxWarmingSearchers>2</maxWarmingSearchers>
  412.  
  413. </query>
  414.  
  415. <!-- Request Dispatcher
  416.  
  417. 这部分介绍SolrDispatchFilter如何处理请求
  418. handleSelect 遗留的选项,将影响某些请求(例如 "/select?qt=XXX")的行为
  419. handleSelect="true" SolrDispatchFilter处理请求并转发到"qt"参数指定的handler, 假设"/select"没有被注册.
  420. handleSelect="false" SolrDispatchFilter 忽略"/select"请求, 返回404,除非明确有名为"/select"的handler
  421.  
  422. handleSelect="true" 对于新用户,不推荐使用此值, 但是此值向后兼容
  423. -->
  424. <requestDispatcher handleSelect="false" >
  425. <!-- Request Parsing 配置如何解析请求,哪些约束将应用于请求中的ContentStreams
  426.  
  427. enableRemoteStreaming - 启用用于标识远程stream的stream.file和 stream.url参数.
  428. multipartUploadLimitInKB - 指定上传多文件时所允许的最大字节数(in KiB)
  429. formdataUploadLimitInKB - 指定通过POST提交的数据(application/x-www-form-urlencoded)的最大字节数 (in KiB)
  430. addHttpRequestToContext - 设置成true时,SolrQueryRequest的上下文中将包含原始的HttpServletRequest,其key为"httpRequest".
    所有Solr的component中都不会用到它,但是自定义的组件也许会用到它。
  431.  
  432. *** WARNING ***
  433. 下面的配置允许Solr获取远程文件,你必须确保你的系统有权限访问这些文件
  434. -->
  435. <requestParsers enableRemoteStreaming="true"
  436. multipartUploadLimitInKB="2048000"
  437. formdataUploadLimitInKB="2048"
  438. addHttpRequestToContext="false"/>
  439.  
  440. <!-- HTTP Caching 设置HTTP缓存相关的参数 (for proxy caches and clients).
  441.  
  442. 下面的设置表示Solr 不会输出任何与HTTP缓存相关的header信息
  443. -->
  444. <httpCaching never304="true" />
  445. <!-- 如果包含 <cacheControl> 元素, 此元素用于生成 Cache-Control header (比如控制过期的header("max-age=XXX" )
    默认情况下不会生成Cache-Control header -->
  1. <!--
  2. <httpCaching never304="true" >
  3. <cacheControl>max-age=30, public</cacheControl>
  4. </httpCaching>
  5. -->
  6. <!-- 为了自动生成 HTTP Caching headers并正确地响应Cache Validation 请求,需要设置 never304="false"
  7.  
  8. 这将使用Solr产生基于Index属性的 Last-Modified and ETag headers
  9.  
  10. The following options can also be specified to affect the
  11. values of these headers...
  12.  
  13. lastModFrom - the default value is "openTime" which means the
  14. Last-Modified value (and validation against If-Modified-Since
  15. requests) will all be relative to when the current Searcher
  16. was opened. You can change it to lastModFrom="dirLastMod" if
  17. you want the value to exactly correspond to when the physical
  18. index was last modified.
  19.  
  20. etagSeed="..." is an option you can change to force the ETag
  21. header (and validation against If-None-Match requests) to be
  22. different even if the index has not changed (ie: when making
  23. significant changes to your config file)
  24.  
  25. (lastModifiedFrom and etagSeed are both ignored if you use
  26. the never304="true" option)
  27. -->
  28. <!--
  29. <httpCaching lastModifiedFrom="openTime"
  30. etagSeed="Solr">
  31. <cacheControl>max-age=30, public</cacheControl>
  32. </httpCaching>
  33. -->
  34. </requestDispatcher>
  35. <!-- Request Handlers
  36. http://wiki.apache.org/solr/SolrRequestHandler
  37. 查询请求将被转发到请求中指定的handler
  38. Legacy behavior: If the request path uses "/select" but no Request
  39. Handler has that name, and if handleSelect="true" has been specified in
  40. the requestDispatcher, then the Request Handler is dispatched based on
  41. the qt parameter. Handlers without a leading '/' are accessed this way
  42. like so: http://host/app/[core/]select?qt=name If no qt is
  43. given, then the requestHandler that declares default="true" will be
  44. used or the one named "standard".
  45. If a Request Handler is declared with startup="lazy", then it will
  46. not be initialized until the first request that uses it.
  47. -->
  48. <!-- SearchHandler http://wiki.apache.org/solr/SearchHandler
  49. For processing Search Queries, the primary Request Handler
  50. provided with Solr is "SearchHandler" It delegates to a sequent
  51. of SearchComponents (see below) and supports distributed
  52. queries across multiple shards
  53. -->
  54. <requestHandler name="/select" class="solr.SearchHandler">
  55. <!-- 默认的查询参数,可被请求中的参数覆盖 -->
  56. <lst name="defaults">
  57. <str name="echoParams">explicit</str>
  58. <int name="rows">10</int>
  59. <!-- 控制请求分配到自身还是其它的分片
  60. Consider making 'preferLocalShards' true when:
  61. 1) maxShardsPerNode > 1
  62. 2) Number of shards > 1
  63. 3) CloudSolrClient or LbHttpSolrServer is used by clients.
  64. Without this option, every core broadcasts the distributed query to
  65. a replica of each shard where the replicas are chosen randomly.
  66. This option directs the cores to prefer cores hosted locally, thus
  67. preventing network delays between machines.
  68. This behavior also immunizes a bad/slow machine from slowing down all
  69. the good machines (if those good machines were querying this bad one).
  70.  
  71. 客户端使用 HttpSolrServer 时,建议设为false
  72. -->
  73. <bool name="preferLocalShards">false</bool>
  74. </lst>
  75. <!-- "appends"参数用于指定每次请求都需另外增加的查询条件
  76. 注意:客户端无法阻止这个附加的查询条件。所以除非是确实需要每个查询都需要附加此条件,否则不要设置这个参数-->
  77. <!--
  78. <lst name="appends">
  79. <str name="fq">inStock:true</str>
  80. </lst>
  81. -->
  82. <!-- "invariants" 允许Solr维护人员锁定一些选项。
  83. 这里设置的参数将覆盖"defaults", "appends" 以及请求中相同的参数.
  84.  
  85. In this example, the facet.field and facet.query params would
  86. be fixed, limiting the facets clients can use. Faceting is
  87. not turned on by default - but if the client does specify
  88. facet=true in the request, these are the only facets they
  89. will be able to see counts for; regardless of what other
  90. facet.field or facet.query params they may specify.
  91.  
  92. -->
  93. <!--
  94. <lst name="invariants">
  95. <str name="facet.field">cat</str>
  96. <str name="facet.field">manu_exact</str>
  97. <str name="facet.query">price:[* TO 500]</str>
  98. <str name="facet.query">price:[500 TO *]</str>
  99. </lst>
  100. -->
  101. <!-- If the default list of SearchComponents is not desired, that
  102. list can either be overridden completely, or components can be
  103. prepended or appended to the default list. (see below)
  104. -->
  105. <!--
  106. <arr name="components">
  107. <str>nameOfCustomComponent1</str>
  108. <str>nameOfCustomComponent2</str>
  109. </arr>
  110. -->
  111. </requestHandler>
  112. <!-- 返回格式化过的(字符串有-->
  113. <requestHandler name="/query" class="solr.SearchHandler">
  114. <lst name="defaults">
  115. <str name="echoParams">explicit</str>
  116. <str name="wt">json</str>
  117. <str name="indent">true</str>
  118. <str name="df">text</str>
  119. </lst>
  120. </requestHandler>
  121.  
  122. <!-- A Robust Example
  123.  
  124. This example SearchHandler declaration shows off usage of the
  125. SearchHandler with many defaults declared
  126.  
  127. Note that multiple instances of the same Request Handler
  128. (SearchHandler) can be registered multiple times with different
  129. names (and different init parameters)
  130. -->
  131. <requestHandler name="/browse" class="solr.SearchHandler">
  132. <lst name="defaults">
  133. <str name="echoParams">explicit</str>
  134.  
  135. <!-- VelocityResponseWriter settings -->
  136. <str name="wt">velocity</str>
  137. <str name="v.template">browse</str>
  138. <str name="v.layout">layout</str>
  139. <str name="title">Solritas</str>
  140.  
  141. <!-- Query settings -->
  142. <str name="defType">edismax</str>
  143. <str name="qf">
  144. text^0.5 features^1.0 name^1.2 sku^1.5 id^10.0 manu^1.1 cat^1.4
  145. title^10.0 description^5.0 keywords^5.0 author^2.0 resourcename^1.0
  146. </str>
  147. <str name="mm">100%</str>
  148. <str name="q.alt">*:*</str>
  149. <str name="rows">10</str>
  150. <str name="fl">*,score</str>
  151.  
  152. <str name="mlt.qf">
  153. text^0.5 features^1.0 name^1.2 sku^1.5 id^10.0 manu^1.1 cat^1.4
  154. title^10.0 description^5.0 keywords^5.0 author^2.0 resourcename^1.0
  155. </str>
  156. <str name="mlt.fl">text,features,name,sku,id,manu,cat,title,description,keywords,author,resourcename</str>
  157. <int name="mlt.count">3</int>
  158.  
  159. <!-- Faceting defaults -->
  160. <str name="facet">on</str>
  161. <str name="facet.missing">true</str>
  162. <str name="facet.field">cat</str>
  163. <str name="facet.field">manu_exact</str>
  164. <str name="facet.field">content_type</str>
  165. <str name="facet.field">author_s</str>
  166. <str name="facet.query">ipod</str>
  167. <str name="facet.query">GB</str>
  168. <str name="facet.mincount">1</str>
  169. <str name="facet.pivot">cat,inStock</str>
  170. <str name="facet.range.other">after</str>
  171. <str name="facet.range">price</str>
  172. <int name="f.price.facet.range.start">0</int>
  173. <int name="f.price.facet.range.end">600</int>
  174. <int name="f.price.facet.range.gap">50</int>
  175. <str name="facet.range">popularity</str>
  176. <int name="f.popularity.facet.range.start">0</int>
  177. <int name="f.popularity.facet.range.end">10</int>
  178. <int name="f.popularity.facet.range.gap">3</int>
  179. <str name="facet.range">manufacturedate_dt</str>
  180. <str name="f.manufacturedate_dt.facet.range.start">NOW/YEAR-10YEARS</str>
  181. <str name="f.manufacturedate_dt.facet.range.end">NOW</str>
  182. <str name="f.manufacturedate_dt.facet.range.gap">+1YEAR</str>
  183. <str name="f.manufacturedate_dt.facet.range.other">before</str>
  184. <str name="f.manufacturedate_dt.facet.range.other">after</str>
  185.  
  186. <!-- Highlighting defaults -->
  187. <str name="hl">on</str>
  188. <str name="hl.fl">content features title name</str>
  189. <str name="hl.preserveMulti">true</str>
  190. <str name="hl.encoder">html</str>
  191. <str name="hl.simple.pre">&lt;b&gt;</str>
  192. <str name="hl.simple.post">&lt;/b&gt;</str>
  193. <str name="f.title.hl.fragsize">0</str>
  194. <str name="f.title.hl.alternateField">title</str>
  195. <str name="f.name.hl.fragsize">0</str>
  196. <str name="f.name.hl.alternateField">name</str>
  197. <str name="f.content.hl.snippets">3</str>
  198. <str name="f.content.hl.fragsize">200</str>
  199. <str name="f.content.hl.alternateField">content</str>
  200. <str name="f.content.hl.maxAlternateFieldLength">750</str>
  201.  
  202. <!-- Spell checking defaults -->
  203. <str name="spellcheck">on</str>
  204. <str name="spellcheck.extendedResults">false</str>
  205. <str name="spellcheck.count">5</str>
  206. <str name="spellcheck.alternativeTermCount">2</str>
  207. <str name="spellcheck.maxResultsForSuggest">5</str>
  208. <str name="spellcheck.collate">true</str>
  209. <str name="spellcheck.collateExtendedResults">true</str>
  210. <str name="spellcheck.maxCollationTries">5</str>
  211. <str name="spellcheck.maxCollations">3</str>
  212. </lst>
  213.  
  214. <!-- append spellchecking to our list of components -->
  215. <arr name="last-components">
  216. <str>spellcheck</str>
  217. </arr>
  218. </requestHandler>
  219.  
  220. <initParams path="/update/**,/query,/select,/tvrh,/elevate,/spell,/browse">
  221. <lst name="defaults">
  222. <str name="df">text</str>
  223. </lst>
  224. </initParams>
  225.  
  226. <initParams path="/update/json/docs">
  227. <lst name="defaults">
  228. <!--this ensures that the entire json doc will be stored verbatim into one field-->
  229. <str name="srcField">_src_</str>
  230. <!--This means a the uniqueKeyField will be extracted from the fields and
  231. all fields go into the 'df' field. In this config df is already configured to be 'text'
  232. -->
  233. <str name="mapUniqueKeyOnly">true</str>
  234. </lst>
  235.  
  236. </initParams>
  237.  
  238. <!-- The following are implicitly added
  239. <requestHandler name="/update/json" class="solr.UpdateRequestHandler">
  240. <lst name="defaults">
  241. <str name="stream.contentType">application/json</str>
  242. </lst>
  243. </requestHandler>
  244. <requestHandler name="/update/csv" class="solr.UpdateRequestHandler">
  245. <lst name="defaults">
  246. <str name="stream.contentType">application/csv</str>
  247. </lst>
  248. </requestHandler>
  249. -->
  250.  
  251. <!-- Solr Cell Update Request Handler
  252.  
  253. http://wiki.apache.org/solr/ExtractingRequestHandler
  254.  
  255. -->
  256. <requestHandler name="/update/extract"
  257. startup="lazy"
  258. class="solr.extraction.ExtractingRequestHandler" >
  259. <lst name="defaults">
  260. <str name="lowernames">true</str>
  261. <str name="uprefix">ignored_</str>
  262.  
  263. <!-- capture link hrefs but ignore div attributes -->
  264. <str name="captureAttr">true</str>
  265. <str name="fmap.a">links</str>
  266. <str name="fmap.div">ignored_</str>
  267. </lst>
  268. </requestHandler>
  269.  
  270. <!-- Field Analysis Request Handler
  271.  
  272. 主要用于测试分词结果是否和我们期望的一样
  273.  
  274. Request parameters are:
  275. analysis.fieldname - field name whose analyzers are to be used
  276.  
  277. analysis.fieldtype - field type whose analyzers are to be used
  278. analysis.fieldvalue - text for index-time analysis
  279. q (or analysis.q) - text for query time analysis
  280. analysis.showmatch (true|false) - When set to true and when
  281. query analysis is performed, the produced tokens of the
  282. field value analysis will be marked as "matched" for every
  283. token that is produces by the query analysis
  284. -->
  285. <requestHandler name="/analysis/field"
  286. startup="lazy"
  287. class="solr.FieldAnalysisRequestHandler" />
  288.  
  289. <!-- Document Analysis Handler
  290.  
  291. http://wiki.apache.org/solr/AnalysisRequestHandler
  292.  
  293. An analysis handler that provides a breakdown of the analysis
  294. process of provided documents. This handler expects a (single)
  295. content stream with the following format:
  296.  
  297. <docs>
  298. <doc>
  299. <field name="id">1</field>
  300. <field name="name">The Name</field>
  301. <field name="text">The Text Value</field>
  302. </doc>
  303. <doc>...</doc>
  304. <doc>...</doc>
  305. ...
  306. </docs>
  307.  
  308. Note: Each document must contain a field which serves as the
  309. unique key. This key is used in the returned response to associate
  310. an analysis breakdown to the analyzed document.
  311.  
  312. Like the FieldAnalysisRequestHandler, this handler also supports
  313. query analysis by sending either an "analysis.query" or "q"
  314. request parameter that holds the query text to be analyzed. It
  315. also supports the "analysis.showmatch" parameter which when set to
  316. true, all field tokens that match the query tokens will be marked
  317. as a "match".
  318. -->
  319. <requestHandler name="/analysis/document"
  320. class="solr.DocumentAnalysisRequestHandler"
  321. startup="lazy" />
  322.  
  323. <!-- Echo the request contents back to the client -->
  324. <requestHandler name="/debug/dump" class="solr.DumpRequestHandler" >
  325. <lst name="defaults">
  326. <str name="echoParams">explicit</str>
  327. <str name="echoHandler">true</str>
  328. </lst>
  329. </requestHandler>
  330.  
  331. <!-- Search Components
  332.  
  333. Search components 被注册到 SolrCore 并且被 SearchHandler 使用
  334. 默认情况下,下面的组件可以被使用
  335.  
  336. <searchComponent name="query" class="solr.QueryComponent" />
  337. <searchComponent name="facet" class="solr.FacetComponent" />
  338. <searchComponent name="mlt" class="solr.MoreLikeThisComponent" />
  339. <searchComponent name="highlight" class="solr.HighlightComponent" />
  340. <searchComponent name="stats" class="solr.StatsComponent" />
  341. <searchComponent name="debug" class="solr.DebugComponent" />
  342.  
  343. Default configuration in a requestHandler would look like:
  344.  
  345. <arr name="components">
  346. <str>query</str>
  347. <str>facet</str>
  348. <str>mlt</str>
  349. <str>highlight</str>
  350. <str>stats</str>
  351. <str>debug</str>
  352. </arr>
  353.  
  354. 如果注册了一个标准的 searchComponent,则默认的配置将会被覆盖。
  355.  
  356. 以下例子演示了如何在 'standard' components 之前/之后增加一个components:
  357.  
  358. <arr name="first-components">
  359. <str>myFirstComponentName</str>
  360. </arr>
  361.  
  362. <arr name="last-components">
  363. <str>myLastComponentName</str>
  364. </arr>
  365.  
  366. NOTE: The component registered with the name "debug" will
  367. always be executed after the "last-components"
  368.  
  369. -->
  370.  
  371. <!-- Spell Check
  372. 拼写检查组件,用于当输入一个不正确的单词时,返回可能的正确的拼写.
  373.  
  374. http://wiki.apache.org/solr/SpellCheckComponent
  375. -->
  376. <searchComponent name="spellcheck" class="solr.SpellCheckComponent">
  377.  
  378. <str name="queryAnalyzerFieldType">text_general</str>
  379.  
  380. <!-- 这个组件中可以申明多个 "Spell Checkers"
  381. -->
  382.  
  383. <!-- a spellchecker built from a field of the main index -->
  384. <lst name="spellchecker">
  385. <str name="name">default</str>
  386. <str name="field">text</str>
  387. <str name="classname">solr.DirectSolrSpellChecker</str>
  388. <!-- the spellcheck distance measure used, the default is the internal levenshtein -->
  389. <str name="distanceMeasure">internal</str>
  390. <!-- minimum accuracy needed to be considered a valid spellcheck suggestion -->
  391. <float name="accuracy">0.5</float>
  392. <!-- the maximum #edits we consider when enumerating terms: can be 1 or 2 -->
  393. <int name="maxEdits">2</int>
  394. <!-- the minimum shared prefix when enumerating terms -->
  395. <int name="minPrefix">1</int>
  396. <!-- maximum number of inspections per result. -->
  397. <int name="maxInspections">5</int>
  398. <!-- minimum length of a query term to be considered for correction -->
  399. <int name="minQueryLength">4</int>
  400. <!-- maximum threshold of documents a query term can appear to be considered for correction -->
  401. <float name="maxQueryFrequency">0.01</float>
  402. <!-- uncomment this to require suggestions to occur in 1% of the documents
  403. <float name="thresholdTokenFrequency">.01</float>
  404. -->
  405. </lst>
  406.  
  407. <!-- a spellchecker that can break or combine words. See "/spell" handler below for usage -->
  408. <lst name="spellchecker">
  409. <str name="name">wordbreak</str>
  410. <str name="classname">solr.WordBreakSolrSpellChecker</str>
  411. <str name="field">name</str>
  412. <str name="combineWords">true</str>
  413. <str name="breakWords">true</str>
  414. <int name="maxChanges">10</int>
  415. </lst>
  416.  
  417. <!-- a spellchecker that uses a different distance measure -->
  418. <!--
  419. <lst name="spellchecker">
  420. <str name="name">jarowinkler</str>
  421. <str name="field">spell</str>
  422. <str name="classname">solr.DirectSolrSpellChecker</str>
  423. <str name="distanceMeasure">
  424. org.apache.lucene.search.spell.JaroWinklerDistance
  425. </str>
  426. </lst>
  427. -->
  428.  
  429. <!-- a spellchecker that use an alternate comparator
  430.  
  431. comparatorClass be one of:
  432. 1. score (default)
  433. 2. freq (Frequency first, then score)
  434. 3. A fully qualified class name
  435. -->
  436. <!--
  437. <lst name="spellchecker">
  438. <str name="name">freq</str>
  439. <str name="field">lowerfilt</str>
  440. <str name="classname">solr.DirectSolrSpellChecker</str>
  441. <str name="comparatorClass">freq</str>
  442. -->
  443.  
  444. <!-- A spellchecker that reads the list of words from a file -->
  445. <!--
  446. <lst name="spellchecker">
  447. <str name="classname">solr.FileBasedSpellChecker</str>
  448. <str name="name">file</str>
  449. <str name="sourceLocation">spellings.txt</str>
  450. <str name="characterEncoding">UTF-8</str>
  451. <str name="spellcheckIndexDir">spellcheckerFile</str>
  452. </lst>
  453. -->
  454. </searchComponent>
  455.  
  456. <!-- spellcheck component 的使用示例.
  457.  
  458. NOTE: 这纯粹是一个例子. 此处把 SpellCheckComponent 嵌入到 request handler 中是为了
    不需要多加一次spellcheck的请求
  459.  
  460. See http://wiki.apache.org/solr/SpellCheckComponent for details
  461. on the request parameters.
  462. -->
  463. <requestHandler name="/spell" class="solr.SearchHandler" startup="lazy">
  464. <lst name="defaults">
  465. <!-- Solr will use suggestions from both the 'default' spellchecker
  466. and from the 'wordbreak' spellchecker and combine them.
  467. collations (re-written queries) can include a combination of
  468. corrections from both spellcheckers -->
  469. <str name="spellcheck.dictionary">default</str>
  470. <str name="spellcheck.dictionary">wordbreak</str>
  471. <str name="spellcheck">on</str>
  472. <str name="spellcheck.extendedResults">true</str>
  473. <str name="spellcheck.count">10</str>
  474. <str name="spellcheck.alternativeTermCount">5</str>
  475. <str name="spellcheck.maxResultsForSuggest">5</str>
  476. <str name="spellcheck.collate">true</str>
  477. <str name="spellcheck.collateExtendedResults">true</str>
  478. <str name="spellcheck.maxCollationTries">10</str>
  479. <str name="spellcheck.maxCollations">5</str>
  480. </lst>
  481. <arr name="last-components">
  482. <str>spellcheck</str>
  483. </arr>
  484. </requestHandler>
  485.  
  486. <!-- The SuggestComponent in Solr provides users with automatic suggestions for query terms.
  487. You can use this to implement a powerful auto-suggest feature in your search application.
  488. As with the rest of this solrconfig.xml file, the configuration of this component is purely
  489. an example that applies specifically to this configset and example documents.
  490.  
  491. More information about this component and other configuration options are described in the
  492. "Suggester" section of the reference guide available at
  493. http://archive.apache.org/dist/lucene/solr/ref-guide
  494. -->
  495. <searchComponent name="suggest" class="solr.SuggestComponent">
  496. <lst name="suggester">
  497. <str name="name">mySuggester</str>
  498. <str name="lookupImpl">FuzzyLookupFactory</str>
  499. <str name="dictionaryImpl">DocumentDictionaryFactory</str>
  500. <str name="field">cat</str>
  501. <str name="weightField">price</str>
  502. <str name="suggestAnalyzerFieldType">string</str>
  503. <str name="buildOnStartup">false</str>
  504. </lst>
  505. </searchComponent>
  506.  
  507. <requestHandler name="/suggest" class="solr.SearchHandler"
  508. startup="lazy" >
  509. <lst name="defaults">
  510. <str name="suggest">true</str>
  511. <str name="suggest.count">10</str>
  512. </lst>
  513. <arr name="components">
  514. <str>suggest</str>
  515. </arr>
  516. </requestHandler>
  517.  
  518. <!-- Term Vector Component
  519. http://wiki.apache.org/solr/TermVectorComponent
  520. -->
  521. <searchComponent name="tvComponent" class="solr.TermVectorComponent"/>
  522.  
  523. <!-- A request handler for demonstrating the term vector component
  524.  
  525. This is purely as an example.
  526.  
  527. In reality you will likely want to add the component to your
  528. already specified request handlers.
  529. -->
  530. <requestHandler name="/tvrh" class="solr.SearchHandler" startup="lazy">
  531. <lst name="defaults">
  532. <bool name="tv">true</bool>
  533. </lst>
  534. <arr name="last-components">
  535. <str>tvComponent</str>
  536. </arr>
  537. </requestHandler>
  538.  
  539. <!-- Clustering Component
  540.  
  541. You'll need to set the solr.clustering.enabled system property
  542. when running solr to run with clustering enabled:
  543. -Dsolr.clustering.enabled=true
  544.  
  545. https://cwiki.apache.org/confluence/display/solr/Result+Clustering
  546. -->
  547. <searchComponent name="clustering"
  548. enable="${solr.clustering.enabled:false}"
  549. class="solr.clustering.ClusteringComponent" >
  550. <!--
  551. Declaration of "engines" (clustering algorithms).
  552.  
  553. The open source algorithms from Carrot2.org project:
  554. * org.carrot2.clustering.lingo.LingoClusteringAlgorithm
  555. * org.carrot2.clustering.stc.STCClusteringAlgorithm
  556. * org.carrot2.clustering.kmeans.BisectingKMeansClusteringAlgorithm
  557. See http://project.carrot2.org/algorithms.html for more information.
  558.  
  559. Commercial algorithm Lingo3G (needs to be installed separately):
  560. * com.carrotsearch.lingo3g.Lingo3GClusteringAlgorithm
  561. -->
  562.  
  563. <lst name="engine">
  564. <str name="name">lingo3g</str>
  565. <bool name="optional">true</bool>
  566. <str name="carrot.algorithm">com.carrotsearch.lingo3g.Lingo3GClusteringAlgorithm</str>
  567. <str name="carrot.resourcesDir">clustering/carrot2</str>
  568. </lst>
  569.  
  570. <lst name="engine">
  571. <str name="name">lingo</str>
  572. <str name="carrot.algorithm">org.carrot2.clustering.lingo.LingoClusteringAlgorithm</str>
  573. <str name="carrot.resourcesDir">clustering/carrot2</str>
  574. </lst>
  575.  
  576. <lst name="engine">
  577. <str name="name">stc</str>
  578. <str name="carrot.algorithm">org.carrot2.clustering.stc.STCClusteringAlgorithm</str>
  579. <str name="carrot.resourcesDir">clustering/carrot2</str>
  580. </lst>
  581.  
  582. <lst name="engine">
  583. <str name="name">kmeans</str>
  584. <str name="carrot.algorithm">org.carrot2.clustering.kmeans.BisectingKMeansClusteringAlgorithm</str>
  585. <str name="carrot.resourcesDir">clustering/carrot2</str>
  586. </lst>
  587. </searchComponent>
  588.  
  589. <!-- A request handler for demonstrating the clustering component.
  590. This is meant as an example.
  591. In reality you will likely want to add the component to your
  592. already specified request handlers.
  593. -->
  594. <requestHandler name="/clustering"
  595. startup="lazy"
  596. enable="${solr.clustering.enabled:false}"
  597. class="solr.SearchHandler">
  598. <lst name="defaults">
  599. <bool name="clustering">true</bool>
  600. <bool name="clustering.results">true</bool>
  601. <!-- Field name with the logical "title" of a each document (optional) -->
  602. <str name="carrot.title">name</str>
  603. <!-- Field name with the logical "URL" of a each document (optional) -->
  604. <str name="carrot.url">id</str>
  605. <!-- Field name with the logical "content" of a each document (optional) -->
  606. <str name="carrot.snippet">features</str>
  607. <!-- Apply highlighter to the title/ content and use this for clustering. -->
  608. <bool name="carrot.produceSummary">true</bool>
  609. <!-- the maximum number of labels per cluster -->
  610. <!--<int name="carrot.numDescriptions">5</int>-->
  611. <!-- produce sub clusters -->
  612. <bool name="carrot.outputSubClusters">false</bool>
  613.  
  614. <!-- Configure the remaining request handler parameters. -->
  615. <str name="defType">edismax</str>
  616. <str name="qf">
  617. text^0.5 features^1.0 name^1.2 sku^1.5 id^10.0 manu^1.1 cat^1.4
  618. </str>
  619. <str name="q.alt">*:*</str>
  620. <str name="rows">100</str>
  621. <str name="fl">*,score</str>
  622. </lst>
  623. <arr name="last-components">
  624. <str>clustering</str>
  625. </arr>
  626. </requestHandler>
  627.  
  628. <!-- Terms Component
  629.  
  630. http://wiki.apache.org/solr/TermsComponent
  631.  
  632. A component to return terms and document frequency of those
  633. terms
  634. -->
  635. <searchComponent name="terms" class="solr.TermsComponent"/>
  636.  
  637. <!-- A request handler for demonstrating the terms component -->
  638. <requestHandler name="/terms" class="solr.SearchHandler" startup="lazy">
  639. <lst name="defaults">
  640. <bool name="terms">true</bool>
  641. <bool name="distrib">false</bool>
  642. </lst>
  643. <arr name="components">
  644. <str>terms</str>
  645. </arr>
  646. </requestHandler>
  647.  
  648. <!-- Query Elevation Component
  649.  
  650. http://wiki.apache.org/solr/QueryElevationComponent
  651.  
  652. a search component that enables you to configure the top
  653. results for a given query regardless of the normal lucene
  654. scoring.
  655. -->
  656. <searchComponent name="elevator" class="solr.QueryElevationComponent" >
  657. <!-- pick a fieldType to analyze queries -->
  658. <str name="queryFieldType">string</str>
  659. <str name="config-file">elevate.xml</str>
  660. </searchComponent>
  661.  
  662. <!-- A request handler for demonstrating the elevator component -->
  663. <requestHandler name="/elevate" class="solr.SearchHandler" startup="lazy">
  664. <lst name="defaults">
  665. <str name="echoParams">explicit</str>
  666. </lst>
  667. <arr name="last-components">
  668. <str>elevator</str>
  669. </arr>
  670. </requestHandler>
  671.  
  672. <!-- Highlighting Component
  673.  
  674. http://wiki.apache.org/solr/HighlightingParameters
  675. -->
  676. <searchComponent class="solr.HighlightComponent" name="highlight">
  677. <highlighting>
  678. <!-- Configure the standard fragmenter -->
  679. <!-- This could most likely be commented out in the "default" case -->
  680. <fragmenter name="gap"
  681. default="true"
  682. class="solr.highlight.GapFragmenter">
  683. <lst name="defaults">
  684. <int name="hl.fragsize">100</int>
  685. </lst>
  686. </fragmenter>
  687.  
  688. <!-- A regular-expression-based fragmenter
  689. (for sentence extraction)
  690. -->
  691. <fragmenter name="regex"
  692. class="solr.highlight.RegexFragmenter">
  693. <lst name="defaults">
  694. <!-- slightly smaller fragsizes work better because of slop -->
  695. <int name="hl.fragsize">70</int>
  696. <!-- allow 50% slop on fragment sizes -->
  697. <float name="hl.regex.slop">0.5</float>
  698. <!-- a basic sentence pattern -->
  699. <str name="hl.regex.pattern">[-\w ,/\n\&quot;&apos;]{20,200}</str>
  700. </lst>
  701. </fragmenter>
  702.  
  703. <!-- Configure the standard formatter -->
  704. <formatter name="html"
  705. default="true"
  706. class="solr.highlight.HtmlFormatter">
  707. <lst name="defaults">
  708. <str name="hl.simple.pre"><![CDATA[<em>]]></str>
  709. <str name="hl.simple.post"><![CDATA[</em>]]></str>
  710. </lst>
  711. </formatter>
  712.  
  713. <!-- Configure the standard encoder -->
  714. <encoder name="html"
  715. class="solr.highlight.HtmlEncoder" />
  716.  
  717. <!-- Configure the standard fragListBuilder -->
  718. <fragListBuilder name="simple"
  719. class="solr.highlight.SimpleFragListBuilder"/>
  720.  
  721. <!-- Configure the single fragListBuilder -->
  722. <fragListBuilder name="single"
  723. class="solr.highlight.SingleFragListBuilder"/>
  724.  
  725. <!-- Configure the weighted fragListBuilder -->
  726. <fragListBuilder name="weighted"
  727. default="true"
  728. class="solr.highlight.WeightedFragListBuilder"/>
  729.  
  730. <!-- default tag FragmentsBuilder -->
  731. <fragmentsBuilder name="default"
  732. default="true"
  733. class="solr.highlight.ScoreOrderFragmentsBuilder">
  734. <!--
  735. <lst name="defaults">
  736. <str name="hl.multiValuedSeparatorChar">/</str>
  737. </lst>
  738. -->
  739. </fragmentsBuilder>
  740.  
  741. <!-- multi-colored tag FragmentsBuilder -->
  742. <fragmentsBuilder name="colored"
  743. class="solr.highlight.ScoreOrderFragmentsBuilder">
  744. <lst name="defaults">
  745. <str name="hl.tag.pre"><![CDATA[
  746. <b style="background:yellow">,<b style="background:lawgreen">,
  747. <b style="background:aquamarine">,<b style="background:magenta">,
  748. <b style="background:palegreen">,<b style="background:coral">,
  749. <b style="background:wheat">,<b style="background:khaki">,
  750. <b style="background:lime">,<b style="background:deepskyblue">]]></str>
  751. <str name="hl.tag.post"><![CDATA[</b>]]></str>
  752. </lst>
  753. </fragmentsBuilder>
  754.  
  755. <boundaryScanner name="default"
  756. default="true"
  757. class="solr.highlight.SimpleBoundaryScanner">
  758. <lst name="defaults">
  759. <str name="hl.bs.maxScan">10</str>
  760. <str name="hl.bs.chars">.,!?
  761.  
  762. </str>
  763. </lst>
  764. </boundaryScanner>
  765.  
  766. <boundaryScanner name="breakIterator"
  767. class="solr.highlight.BreakIteratorBoundaryScanner">
  768. <lst name="defaults">
  769. <!-- type should be one of CHARACTER, WORD(default), LINE and SENTENCE -->
  770. <str name="hl.bs.type">WORD</str>
  771. <!-- language and country are used when constructing Locale object. -->
  772. <!-- And the Locale object will be used when getting instance of BreakIterator -->
  773. <str name="hl.bs.language">en</str>
  774. <str name="hl.bs.country">US</str>
  775. </lst>
  776. </boundaryScanner>
  777. </highlighting>
  778. </searchComponent>
  779.  
  780. <!-- Update Processors
  781.  
  782. Chains of Update Processor Factories for dealing with Update
  783. Requests can be declared, and then used by name in Update
  784. Request Processors
  785.  
  786. http://wiki.apache.org/solr/UpdateRequestProcessor
  787.  
  788. -->
  789. <!-- Deduplication
  790.  
  791. An example dedup update processor that creates the "id" field
  792. on the fly based on the hash code of some other fields. This
  793. example has overwriteDupes set to false since we are using the
  794. id field as the signatureField and Solr will maintain
  795. uniqueness based on that anyway.
  796.  
  797. -->
  798. <!--
  799. <updateRequestProcessorChain name="dedupe">
  800. <processor class="solr.processor.SignatureUpdateProcessorFactory">
  801. <bool name="enabled">true</bool>
  802. <str name="signatureField">id</str>
  803. <bool name="overwriteDupes">false</bool>
  804. <str name="fields">name,features,cat</str>
  805. <str name="signatureClass">solr.processor.Lookup3Signature</str>
  806. </processor>
  807. <processor class="solr.LogUpdateProcessorFactory" />
  808. <processor class="solr.RunUpdateProcessorFactory" />
  809. </updateRequestProcessorChain>
  810. -->
  811.  
  812. <!-- Language identification
  813.  
  814. This example update chain identifies the language of the incoming
  815. documents using the langid contrib. The detected language is
  816. written to field language_s. No field name mapping is done.
  817. The fields used for detection are text, title, subject and description,
  818. making this example suitable for detecting languages form full-text
  819. rich documents injected via ExtractingRequestHandler.
  820. See more about langId at http://wiki.apache.org/solr/LanguageDetection
  821. -->
  822. <!--
  823. <updateRequestProcessorChain name="langid">
  824. <processor class="org.apache.solr.update.processor.TikaLanguageIdentifierUpdateProcessorFactory">
  825. <str name="langid.fl">text,title,subject,description</str>
  826. <str name="langid.langField">language_s</str>
  827. <str name="langid.fallback">en</str>
  828. </processor>
  829. <processor class="solr.LogUpdateProcessorFactory" />
  830. <processor class="solr.RunUpdateProcessorFactory" />
  831. </updateRequestProcessorChain>
  832. -->
  833.  
  834. <!-- Script update processor
  835.  
  836. This example hooks in an update processor implemented using JavaScript.
  837.  
  838. See more about the script update processor at http://wiki.apache.org/solr/ScriptUpdateProcessor
  839. -->
  840. <!--
  841. <updateRequestProcessorChain name="script">
  842. <processor class="solr.StatelessScriptUpdateProcessorFactory">
  843. <str name="script">update-script.js</str>
  844. <lst name="params">
  845. <str name="config_param">example config parameter</str>
  846. </lst>
  847. </processor>
  848. <processor class="solr.RunUpdateProcessorFactory" />
  849. </updateRequestProcessorChain>
  850. -->
  851.  
  852. <!-- Response Writers
  853.  
  854. http://wiki.apache.org/solr/QueryResponseWriter
  855.  
  856. Request responses will be written using the writer specified by
  857. the 'wt' request parameter matching the name of a registered
  858. writer.
  859.  
  860. The "default" writer is the default and will be used if 'wt' is
  861. not specified in the request.
  862. -->
  863. <!-- The following response writers are implicitly configured unless
  864. overridden...
  865. -->
  866. <!--
  867. <queryResponseWriter name="xml"
  868. default="true"
  869. class="solr.XMLResponseWriter" />
  870. <queryResponseWriter name="json" class="solr.JSONResponseWriter"/>
  871. <queryResponseWriter name="python" class="solr.PythonResponseWriter"/>
  872. <queryResponseWriter name="ruby" class="solr.RubyResponseWriter"/>
  873. <queryResponseWriter name="php" class="solr.PHPResponseWriter"/>
  874. <queryResponseWriter name="phps" class="solr.PHPSerializedResponseWriter"/>
  875. <queryResponseWriter name="csv" class="solr.CSVResponseWriter"/>
  876. <queryResponseWriter name="schema.xml" class="solr.SchemaXmlResponseWriter"/>
  877. -->
  878.  
  879. <queryResponseWriter name="json" class="solr.JSONResponseWriter">
  880. <!-- For the purposes of the tutorial, JSON responses are written as
  881. plain text so that they are easy to read in *any* browser.
  882. If you expect a MIME type of "application/json" just remove this override.
  883. -->
  884. <str name="content-type">text/plain; charset=UTF-8</str>
  885. </queryResponseWriter>
  886.  
  887. <!--
  888. Custom response writers can be declared as needed...
  889. -->
  890. <queryResponseWriter name="velocity" class="solr.VelocityResponseWriter" startup="lazy">
  891. <str name="template.base.dir">${velocity.template.base.dir:}</str>
  892. </queryResponseWriter>
  893.  
  894. <!-- XSLT response writer transforms the XML output by any xslt file found
  895. in Solr's conf/xslt directory. Changes to xslt files are checked for
  896. every xsltCacheLifetimeSeconds.
  897. -->
  898. <queryResponseWriter name="xslt" class="solr.XSLTResponseWriter">
  899. <int name="xsltCacheLifetimeSeconds">5</int>
  900. </queryResponseWriter>
  901.  
  902. <!-- Query Parsers
  903.  
  904. https://cwiki.apache.org/confluence/display/solr/Query+Syntax+and+Parsing
  905.  
  906. Multiple QParserPlugins can be registered by name, and then
  907. used in either the "defType" param for the QueryComponent (used
  908. by SearchHandler) or in LocalParams
  909. -->
  910. <!-- example of registering a query parser -->
  911. <!--
  912. <queryParser name="myparser" class="com.mycompany.MyQParserPlugin"/>
  913. -->
  914.  
  915. <!-- Function Parsers
  916.  
  917. http://wiki.apache.org/solr/FunctionQuery
  918.  
  919. Multiple ValueSourceParsers can be registered by name, and then
  920. used as function names when using the "func" QParser.
  921. -->
  922. <!-- example of registering a custom function parser -->
  923. <!--
  924. <valueSourceParser name="myfunc"
  925. class="com.mycompany.MyValueSourceParser" />
  926. -->
  927.  
  928. <!-- Document Transformers
  929. http://wiki.apache.org/solr/DocTransformers
  930. -->
  931. <!--
  932. Could be something like:
  933. <transformer name="db" class="com.mycompany.LoadFromDatabaseTransformer" >
  934. <int name="connection">jdbc://....</int>
  935. </transformer>
  936.  
  937. To add a constant value to all docs, use:
  938. <transformer name="mytrans2" class="org.apache.solr.response.transform.ValueAugmenterFactory" >
  939. <int name="value">5</int>
  940. </transformer>
  941.  
  942. If you want the user to still be able to change it with _value:something_ use this:
  943. <transformer name="mytrans3" class="org.apache.solr.response.transform.ValueAugmenterFactory" >
  944. <double name="defaultValue">5</double>
  945. </transformer>
  946.  
  947. If you are using the QueryElevationComponent, you may wish to mark documents that get boosted. The
  948. EditorialMarkerFactory will do exactly that:
  949. <transformer name="qecBooster" class="org.apache.solr.response.transform.EditorialMarkerFactory" />
  950. -->
  951.  
  952. </config>

Solr 6.7学习笔记(03)-- 样例配置文件 solrconfig.xml的更多相关文章

  1. Solr 6.7学习笔记(02)-- 配置文件 managed-schema (schema.xml) -- 样例(6)

    managed-schema 样例: <?xml version="1.0" encoding="UTF-8" ?> <!-- License ...

  2. Solr 6.7学习笔记(02)-- 配置文件 managed-schema (schema.xml) - filter(5)

    自定义fieldType时,通常还会用到filter.filter必须跟在tokenizer或其它filter之后.如: <fieldType> <analyzer> < ...

  3. Solr 6.7学习笔记(02)-- 配置文件 managed-schema (schema.xml)(3)

         5. <fieldType> fieldType主要定义了一些字段类型,其name属性值用于前面<field>中的type属性的值.e.g. <fieldTyp ...

  4. Solr 6.7学习笔记(02)-- 配置文件 managed-schema (schema.xml)(1)

    刚学Solr(版本6.7.0),新建一个core时,提示要求schema.xml文件,我找了半天也没在源码包中找到名为schema.xml的文件.这个版本其实用的是managed-schema文件,没 ...

  5. Solr 6.7学习笔记(02)-- 配置文件 managed-schema (schema.xml)(2)

    接上篇    2. <dynamicField> 为满足前辍或后辍的一些字段提供统一的定义.如<dynamicField name="*_s" index=&qu ...

  6. Solr 6.7学习笔记(02)-- 配置文件 managed-schema (schema.xml) - Analyzer, tokenizer(4)

    有些时候,我们需要自定义 fieldType.下面的例子就是自定义的 fieldType,<analyzer type="index"> 表示索引时怎么处理,<a ...

  7. 【学习笔记】Struts2之配置文件struts.xml

    在默认情况下,Struts2只自动加载类加载路径下的struts.xml.default-struts.xml和struts-plugin.xml三类文件.但是随着应用规模的增大,系统中Action数 ...

  8. Solr 6.7学习笔记(04)-- Suggest

    当我们使用baidu或者Google时,你输入很少的字符,就会自动跳出来一些建议选项,在Solr里,我们称之为Suggest,在solrconfig.xml里做一些简单的配置,即可实现这一功能.配置如 ...

  9. OpenCV 学习笔记03 findContours函数

    opencv-python   4.0.1 1 函数释义 词义:发现轮廓! 从二进制图像中查找轮廓(Finds contours in a binary image):轮廓是形状分析和物体检测和识别的 ...

随机推荐

  1. oracle-jforum论坛链接Oracle

    问题描述 jforum论坛链接Oracle jforum论坛链接Oracle数据库 论坛主题页面不显示 是权限引起的吗 解决方案 页面不显示,你需要看一下错误,估计是配置不对引起的 参考一下这个 jf ...

  2. WebsiteCrawler

    看到网上不少py的爬虫功能极强大,可惜对py了解的不多,以前尝试过使用c# WebHttpRequert类来读取网站的html页面源码,然后通过正则表达式筛选出想要的结果,但现在的网站中,多数使用js ...

  3. [egret+pomelo]实时游戏杂记(4)

    了解了前后端的通信,下面就可以开始自己的业务逻辑了,首先玩家输入名称,选择角色后进入游戏世界. 服务端的demo中已经提供了一些简单的角色信息和属性,数据地址位于 game-server/config ...

  4. EASYARM-IMX283 烧写uboot和linux系统

    新入手一台EASYARM-IMX283开发板(以下简称IMX823),价格比较便宜,配置也不错. 开发板默认安装了WINCE,我还是决定重新烧写uboot和linux内核. 开发板配套光盘里面有不少烧 ...

  5. error:Flash Download failed-“Cortex-M3”,“Programming Algorithm”【转】

    本文转载自:http://www.yfrobot.com/thread-11763-1-1.html 最近安装了KEIL5,在使用KEIL5和JLIN实现在线调试功能时,一定会在Utilities选项 ...

  6. MysqL的root用户不允许远程连接,只能通过PHPMYADMIN

    解决方法:1.改表法 可能是你的帐号不允许从远程登陆,只能在localhost.这个时候只要在localhost的那台电脑,登入mysql后,更改 "mysql" 数据库里的 &q ...

  7. 分享知识-快乐自己:java 中的访问修饰符

    1):Java中的访问修饰符: Java面向对象的基本思想之一是封装细节并且公开接口.Java语言采用访问控制修饰符来控制类及类的方法和变量的访问权限,从而向使用者暴露接口,但隐藏实现细节. 访问控制 ...

  8. CentOS 7编译安装Tengine+PHP+MariaDB全程笔记

    安装环境:CentOS7 3.10.0-693.5.2.el7.x86_64 准备源码包: pcre-8.41.tar.gz openssl-1.0.1h.tar.gz zlib-1.2.11.tar ...

  9. Maven项目中使用JUnit进行单元测试

    1.打开maven项目中的pom.xml,添加JUnit 的jar包 2.在src/test/java下右键新建JUnit Test Cast

  10. leetcode 104 Maximum Depth of Binary Tree(DFS)

    Given a binary tree, find its maximum depth. The maximum depth is the number of nodes along the long ...