当前位置:   article > 正文

浅谈solrCloud的分布式设计_solrcloud shard模式

solrcloud shard模式
在solr cloud 中一个collection是一个 文档的 集合。一个collection可以分为多个slice,
    每个slice的实例和其备份(replica)都称为shard。一个shard与一个solr core 对应。
    一个物理主机可以有多个solr core。
    
    solr的Master-slave模式:(增加人手)
    当对solr的request太多,单个物理主机无法满足用户响应要求时,
    通过增加备份,将任务通过round-robin(或其他任务调度算法)分配到多个备份上,
    进而提高系统的的整体性能,满足用户体验的要求。这就是Master-slaves模式。
    该策略可以称之为“增加人手”:一个人一天可以最多可以完成20个任务,但现在要求一天完成100个任务;
    为了完成一天的任务要求,只好再增加4个人(相当于备份);
    
    solr的shard模式:(减小工作量)
    当业务量的增加到任何一个单机都无法满足用户体验的性能要求时,只好将单机处理的业务量减小。
    即将整个业务量划分为不同的部分(shard), 不同的机器负责不同的shard。
    该策略可以称之为“减小工作量”;
   
    solr的shard模式+Master-Slave模式:(减小工作量+增加人手)  (solrCloud的模式)
    要想进一步提高系统的整体性能, 可以对每一个shard都采用 Master-slave模式;
   

   一个系统通过“增加人手,减小工作量”,这样整个系统就是一个分布式系统,具有容错,分布式查询的功能。


  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. http://www.apache.org/licenses/LICENSE-2.0
  10. Unless required by applicable law or agreed to in writing, software
  11. distributed under the License is distributed on an "AS IS" BASIS,
  12. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. See the License for the specific language governing permissions and
  14. limitations under the License.
  15. -->
  16. <!--
  17. //配置一个或多个solr core以及对它们的管理
  18. This is an example of a simple "solr.xml" file for configuring one or
  19. more Solr Cores, as well as allowing Cores to be added, removed, and
  20. reloaded via HTTP requests.
  21. More information about options available in this configuration file,
  22. and Solr Core administration can be found online:
  23. http://wiki.apache.org/solr/CoreAdmin
  24. -->
  25. <!--
  26. //所有的路径都是相对安装路径的的相对路径
  27. All (relative) paths are relative to the installation path
  28. //持久化改变
  29. persistent: Save changes made via the API to this file
  30. //共享库路径
  31. sharedLib: path to a lib directory that will be shared across all cores
  32. -->
  33. <solr persistent="false">
  34. <!-- //设置logging的level等
  35. by default, this is 50 @ WARN
  36. <logging enabled="true">
  37. <watcher size="100" threshold="INFO" />
  38. </logging>
  39. -->
  40. <!--
  41. adminPath: RequestHandler path to manage cores.
  42. If 'null' (or absent), cores will not be manageable via request handler
  43. //为solr添加多个core
  44. 在solr cloud 中一个collection是一个 文档的 集合。一个collection可以分为多个slice,
  45. 每个slice的实例和其备份(replica)都称为shard。一个shard与一个solr core 对应。
  46. 一个物理主机可以有多个solr core。
  47. solr的Master-slave模式:(增加人手)
  48. 当对solr的request太多,单个物理主机无法满足用户响应要求时,
  49. 通过增加备份,将任务通过round-robin(或其他任务调度算法)分配到多个备份上,
  50. 进而提高系统的的整体性能,满足用户体验的要求。这就是Master-slaves模式。
  51. 该策略可以称之为“增加人手”:一个人一天可以最多可以完成20个任务,但现在要求一天完成100个任务;
  52. 为了完成一天的任务要求,只好再增加4个人(相当于备份);
  53. solr的shard模式:(减小工作量)
  54. 当业务量的增加到任何一个单机都无法满足用户体验的性能要求时,只好将单机处理的业务量减小。
  55. 即将整个业务量划分为不同的部分(shard), 不同的机器负责不同的shard。
  56. 该策略可以称之为“减小工作量”;
  57. solr的shard模式+Master-Slave模式:(减小工作量+增加人手) (solrCloud的模式)
  58. 要想进一步提高系统的整体性能, 可以对每一个shard都采用 Master-slave模式;
  59. 一个系统通过“增加人手,减小工作量”,这样整个系统就是一个分布式系统,具有容错,分布式查询的功能。
  60. -->
  61. <cores adminPath="/admin/cores" defaultCoreName="collection" host="${host:}" hostPort="${jetty.port:}">
  62. <core name="collection" instanceDir="." />
  63. <core name="collection0" instanceDir="../multicore/core0" />
  64. <core name="collection1" instanceDir="../multicore/core1" />
  65. </cores>
  66. </solr>


2.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. http://www.apache.org/licenses/LICENSE-2.0
  10. Unless required by applicable law or agreed to in writing, software
  11. distributed under the License is distributed on an "AS IS" BASIS,
  12. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. See the License for the specific language governing permissions and
  14. limitations under the License.
  15. -->
  16. <!--
  17. //所有的路径都是相对于安装路径:solr.solr.home
  18. All (relative) paths are relative to the installation path
  19. //持久化改变:通过API对该文件(solrconfig.xml)改变
  20. persistent: Save changes made via the API to this file
  21. //共享库的路径
  22. sharedLib: path to a lib directory that will be shared across all cores
  23. -->
  24. <!--
  25. For more details about configurations options that may appear in
  26. this file, see http://wiki.apache.org/solr/SolrConfigXml.
  27. -->
  28. <config>
  29. <!--
  30. //solr.是org.apache.solr.(search|update|request|core|analysis)的别名
  31. In all configuration below, a prefix of "solr." for class names
  32. is an alias that causes solr to search appropriate packages,
  33. including org.apache.solr.(search|update|request|core|analysis)
  34. //可以使用称的classname
  35. You may also specify a fully qualified Java classname if you
  36. have your own custom plugins.
  37. -->
  38. <!--
  39. //指定LUCENE版本:不同的版本之间有明显的差异
  40. Controls what version of Lucene various components of Solr
  41. adhere to. Generally, you want to use the latest version to
  42. get all bug fixes and improvements. It is highly recommended
  43. that you fully re-index after changing this setting as it can
  44. affect both how text is indexed and queried.
  45. -->
  46. <luceneMatchVersion>LUCENE_40</luceneMatchVersion>
  47. <!--
  48. //lib指令:指示solr加载相关的jarballs for plugins used in
  49. solrconfig.xml or schema.xml中
  50. lib directives can be used to instruct Solr to load an Jars
  51. identified and use them to resolve any "plugins" specified in
  52. your solrconfig.xml or schema.xml (ie: Analyzers, Request
  53. Handlers, etc...).
  54. //所有的路径都是相对于solr(instanceDir)实例路径:solr.solr.home来说的
  55. All directories and paths are resolved relative to the
  56. instanceDir.
  57. //如果在solr的instanceDir(solr.solr.home)下有 lib目录
  58. 那么./lib中所有文件都被included:<lib dir="./lib" />
  59. If a "./lib" directory exists in your instanceDir, all files
  60. found in it are included as if you had used the following
  61. syntax...
  62. <lib dir="./lib" />
  63. -->
  64. <!-- //lib指令的dir选项将指定的目录中所有jar文件加入到了classpath中
  65. A 'dir' option by itself adds any files found in the directory
  66. to the classpath, this is useful for including all jars in a
  67. directory.
  68. -->
  69. <!--
  70. <lib dir="../add-everything-found-in-this-dir-to-the-classpath" />
  71. -->
  72. <lib dir="./lib" />
  73. <!--
  74. //lib指令的regex选项用来过滤dir目录中jar文件,只有符合regex正则的jar文件才included。
  75. When a 'regex' is specified in addition to a 'dir', only the
  76. files in that directory which completely match the regex
  77. (anchored on both ends) will be included.
  78. -->
  79. <lib dir="../../dist/" regex="apache-solr-cell-\d.*\.jar" />
  80. <lib dir="../../contrib/extraction/lib" regex=".*\.jar" />
  81. <lib dir="../../dist/" regex="apache-solr-clustering-\d.*\.jar" />
  82. <lib dir="../../contrib/clustering/lib/" regex=".*\.jar" />
  83. <lib dir="../../dist/" regex="apache-solr-langid-\d.*\.jar" />
  84. <lib dir="../../contrib/langid/lib/" regex=".*\.jar" />
  85. <lib dir="../../dist/" regex="apache-solr-velocity-\d.*\.jar" />
  86. <lib dir="../../contrib/velocity/lib" regex=".*\.jar" />
  87. <!--
  88. //无用的dir路径被忽略
  89. If a 'dir' option (with or without a regex) is used and nothing
  90. is found that matches, it will be ignored
  91. -->
  92. <lib dir="/total/crap/dir/ignored" />
  93. <!--
  94. //一个关于jar的准确的path路径的path选项可以代替dir来指定单个jar文件
  95. //如果该jar文件不能被加载将引起serious error日志
  96. an exact 'path' can be used instead of a 'dir' to specify a
  97. specific file. This will cause a serious error to be logged if
  98. it can't be loaded.
  99. -->
  100. <!--
  101. <lib path="../a-jar-that-does-not-exist.jar" />
  102. -->
  103. <!--
  104. //solr建索引的数据目录:./data (default)
  105. //Data Directory
  106. //当使用备份replication时,应该与replication的配置一致
  107. Used to specify an alternate directory to hold all index data
  108. other than the default ./data under the Solr home. If
  109. replication is in use, this should match the replication
  110. configuration.
  111. -->
  112. <dataDir>${solr.data.dir:}</dataDir>
  113. <!-- //The DirectoryFactory to use for indexes.
  114. //建索引用的DirectoryFactory:solr.StandardDirectoryFactory
  115. //选一个适合当前的JVM和平台的最好的基于文件系统(filesystem)的
  116. //也可以强制指派一个:如solr.MMapDirectoryFactory
  117. // solr.NIOFSDirectoryFactory solr.SimpleFSDirectoryFactory
  118. solr.StandardDirectoryFactory, the default, is filesystem
  119. based and tries to pick the best implementation for the current
  120. JVM and platform. One can force a particular implementation
  121. via solr.MMapDirectoryFactory, solr.NIOFSDirectoryFactory, or
  122. solr.SimpleFSDirectoryFactory.
  123. //基于内存的: solr.RAMDirectoryFactory
  124. //不能持久化(persistent)也不能用作备份(replication)
  125. solr.RAMDirectoryFactory is memory based, not
  126. persistent, and doesn't work with replication.
  127. -->
  128. <directoryFactory name="DirectoryFactory" class="${solr.directoryFactory:solr.StandardDirectoryFactory}"/>
  129. <!-- // Lucene index writer的相关设置
  130. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  131. Index Config - These settings control low-level behavior of indexing
  132. Most example settings here show the default value, but are commented
  133. out, to more easily see where customizations have been made.
  134. Note: This replaces <indexDefaults> and <mainIndex> from older versions
  135. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
  136. <indexConfig>
  137. <!-- //maxFieldLength 设置被移除,可以再schama.xml中的field定义中通过过滤器实现
  138. maxFieldLength was removed in 4.0. To get similar behavior, include a
  139. LimitTokenCountFilterFactory in your fieldType definition. E.g.
  140. <filter class="solr.LimitTokenCountFilterFactory" maxTokenCount="10000"/>
  141. -->
  142. <!-- //IndexWriter等待writer Lock超时时间(timeout)
  143. Maximum time to wait for a write lock (ms) for an IndexWriter. Default: 1000 -->
  144. <writeLockTimeout>1000</writeLockTimeout>
  145. <!-- 专家指出:使用compound file 能够减少index使用的文件数目,但同时是以性能(performance)下降为代价的
  146. Expert: Enabling compound file will use less files for the index,
  147. using fewer file descriptors on the expense of performance decrease.
  148. Default in Lucene is "true". Default in Solr is "false" (since 3.6) -->
  149. <useCompoundFile>false</useCompoundFile>
  150. <!-- ramBufferSizeMB: RAM Buffer for Luncene indexing:缓存的使用
  151. ramBufferSizeMB sets the amount of RAM that may be used by Lucene
  152. indexing for buffering added documents and deletions before they are
  153. flushed to the Directory.
  154. //maxBufferDocs:设置从上次刷新以来,能缓存的最大documents number
  155. maxBufferedDocs sets a limit on the number of documents buffered
  156. before flushing.
  157. //两者同时设置,有其一满足,就执行刷新flush
  158. If both ramBufferSizeMB and maxBufferedDocs is set, then
  159. Lucene will flush based on whichever limit is hit first. -->
  160. <ramBufferSizeMB>32</ramBufferSizeMB>
  161. <maxBufferedDocs>1000</maxBufferedDocs>
  162. <!-- Merger Policy:合并策略 TieredMergePolicy
  163. Expert: Merge Policy
  164. The Merge Policy in Lucene controls how merging of segments is done.
  165. The default since Solr/Lucene 3.3 is TieredMergePolicy.
  166. The default since Lucene 2.3 was the LogByteSizeMergePolicy,
  167. Even older versions of Lucene used LogDocMergePolicy.
  168. -->
  169. <mergePolicy class="org.apache.lucene.index.TieredMergePolicy">
  170. <int name="maxMergeAtOnce">10</int>
  171. <int name="segmentsPerTier">10</int>
  172. </mergePolicy>
  173. <!-- Merge Factor:归并因子
  174. The merge factor controls how many segments will get merged at a time.
  175. For TieredMergePolicy, mergeFactor is a convenience parameter which
  176. will set both MaxMergeAtOnce and SegmentsPerTier at once.
  177. For LogByteSizeMergePolicy, mergeFactor decides how many new segments
  178. will be allowed before they are merged into one.
  179. Default is 10 for both merge policies.
  180. -->
  181. <mergeFactor>10</mergeFactor>
  182. <!-- Expert: Merge Scheduler:归并调度器
  183. The Merge Scheduler in Lucene controls how merges are
  184. performed. The ConcurrentMergeScheduler (Lucene 2.3 default)
  185. can perform merges in the background using separate threads.
  186. The SerialMergeScheduler (Lucene 2.2 default) does not.
  187. -->
  188. <mergeScheduler class="org.apache.lucene.index.ConcurrentMergeScheduler"/>
  189. <!-- LockFactory :锁
  190. This option specifies which Lucene LockFactory implementation
  191. to use.
  192. //只读index,单例 singleInstance
  193. single = SingleInstanceLockFactory - suggested for a
  194. read-only index or when there is no possibility of
  195. another process trying to modify the index.
  196. //本地的,OS本地的文件lock
  197. native = NativeFSLockFactory - uses OS native file locking.
  198. Do not use when multiple solr webapps in the same
  199. JVM are attempting to share a single index.
  200. //简单:使用一个普通文件(plan file)
  201. simple = SimpleFSLockFactory - uses a plain file for locking
  202. //默认设置: simple
  203. Defaults: 'native' is default for Solr3.6 and later, otherwise
  204. 'simple' is the default
  205. More details on the nuances of each LockFactory...
  206. http://wiki.apache.org/lucene-java/AvailableLockFactories
  207. -->
  208. <lockType>simple</lockType>
  209. <!-- Unlock On Startup:启动时,解锁,慎用!
  210. If true, unlock any held write or commit locks on startup.
  211. This defeats the locking mechanism that allows multiple
  212. processes to safely access a lucene index, and should be used
  213. with care. Default is "false".
  214. //lock type为none或者single时,不需要设置该选项
  215. This is not needed if lock type is 'none' or 'single'
  216. -->
  217. <unlockOnStartup>false</unlockOnStartup>
  218. <!-- Lucene加载terms的频率
  219. Expert: Controls how often Lucene loads terms into memory
  220. Default is 128 and is likely good for most everyone.
  221. -->
  222. <termIndexInterval>128</termIndexInterval>
  223. <!-- reopenIndexReaders:for more effcient
  224. If true, IndexReaders will be reopened (often more efficient)
  225. instead of closed and then opened. Default: true
  226. -->
  227. <reopenReaders>true</reopenReaders>
  228. <!-- Commit Deletion Policy:确认删除策略
  229. Custom deletion policies can be specified here. The class must
  230. implement org.apache.lucene.index.IndexDeletionPolicy.
  231. http://lucene.apache.org/java/3_5_0/api/core/org/apache/lucene/index/IndexDeletionPolicy.html
  232. //默认删除策略:commit的次数和commit的age以及optimized的状态
  233. The default Solr IndexDeletionPolicy implementation supports
  234. deleting index commit points on number of commits, age of
  235. commit point and optimized status.
  236. //最后一次的commitpoint应该被保留与标准无关
  237. The latest commit point should always be preserved regardless
  238. of the criteria.
  239. -->
  240. <deletionPolicy class="solr.SolrDeletionPolicy">
  241. <!-- The number of commit points to be kept -->
  242. <str name="maxCommitsToKeep">1</str>
  243. <!-- The number of optimized commit points to be kept -->
  244. <str name="maxOptimizedCommitsToKeep">0</str>
  245. <!--
  246. Delete all commit points once they have reached the given age.
  247. Supports DateMathParser syntax e.g.
  248. -->
  249. <!--
  250. <str name="maxCommitAge">30MINUTES</str>
  251. <str name="maxCommitAge">1DAY</str>
  252. -->
  253. <str name="maxCommitAge">30MINUTES</str>
  254. </deletionPolicy>
  255. <!-- Lucene InfoStream: for advanced debugging
  256. To aid in advanced debugging, Lucene provides an "InfoStream"
  257. of detailed information when indexing.
  258. Setting The value to true will instruct the underlying Lucene
  259. IndexWriter to write its debugging info the specified file
  260. -->
  261. <!-- <infoStream file="INFOSTREAM.txt">false</infoStream> -->
  262. <infoStream file="INFOSTREAM.txt">false</infoStream>
  263. </indexConfig>
  264. <!-- JMX:java management extended:Solr configuration
  265. and statistics to JMX 获取统计信息
  266. This example enables JMX if and only if an existing MBeanServer
  267. is found, use this if you want to configure JMX through JVM
  268. parameters. Remove this to disable exposing Solr configuration
  269. and statistics to JMX.
  270. For more details see http://wiki.apache.org/solr/SolrJmx
  271. -->
  272. <jmx />
  273. <!-- If you want to connect to a particular server, specify the
  274. agentId
  275. -->
  276. <!-- <jmx agentId="myAgent" /> -->
  277. <!-- If you want to start a new MBeanServer, specify the serviceUrl -->
  278. <!-- <jmx serviceUrl="service:jmx:rmi:///jndi/rmi://localhost:9999/solr"/>
  279. -->
  280. //high-performance update handler
  281. <!-- The default high-performance update handler -->
  282. <updateHandler class="solr.DirectUpdateHandler2">
  283. <!-- AutoCommit :自动提交
  284. Perform a hard commit automatically under certain conditions.
  285. Instead of enabling autoCommit, consider using "commitWithin"
  286. when adding documents.
  287. http://wiki.apache.org/solr/UpdateXmlMessages
  288. maxDocs - Maximum number of documents to add since the last
  289. commit before automatically triggering a new commit.
  290. maxTime - Maximum amount of time in ms that is allowed to pass
  291. since a document was added before automaticly
  292. triggering a new commit.
  293. openSearcher - if false, the commit causes recent index changes
  294. to be flushed to stable storage, but does not cause a new
  295. searcher to be opened to make those changes visible.
  296. -->
  297. <autoCommit>
  298. <maxDocs>100</maxDocs>
  299. <maxTime>100</maxTime>
  300. <openSearcher>false</openSearcher>
  301. </autoCommit>
  302. <!--//softAutoCommit:使提交可见,但不保证改变存储到disk
  303. for near-realtime
  304. softAutoCommit is like autoCommit except it causes a
  305. 'soft' commit which only ensures that changes are visible
  306. but does not ensure that data is synced to disk. This is
  307. faster and more near-realtime friendly than a hard commit.
  308. -->
  309. <autoSoftCommit>
  310. <maxTime>10</maxTime>
  311. </autoSoftCommit>
  312. <!-- Update Related Event Listeners //更新相关的事件监听器
  313. Various IndexWriter related events can trigger Listeners to
  314. take actions.
  315. postCommit - fired after every commit or optimize command
  316. postOptimize - fired after every optimize command
  317. -->
  318. <!-- The RunExecutableListener executes an external command from a
  319. hook such as postCommit or postOptimize.
  320. exe - the name of the executable to run
  321. dir - dir to use as the current working directory. (default=".")
  322. wait - the calling thread waits until the executable returns.
  323. (default="true")
  324. args - the arguments to pass to the program. (default is none)
  325. env - environment variables to set. (default is none)
  326. -->
  327. <!-- This example shows how RunExecutableListener could be used
  328. with the script based replication...
  329. http://wiki.apache.org/solr/CollectionDistribution
  330. -->
  331. <!--
  332. <listener event="postCommit" class="solr.RunExecutableListener">
  333. <str name="exe">solr/bin/snapshooter</str>
  334. <str name="dir">.</str>
  335. <bool name="wait">true</bool>
  336. <arr name="args"> <str>arg1</str> <str>arg2</str> </arr>
  337. <arr name="env"> <str>MYVAR=val1</str> </arr>
  338. </listener>
  339. -->
  340. <!--使能事务日志(Enable Transaction log)
  341. Enables a transaction log, currently used for real-time get.
  342. "dir" - the target directory for transaction logs,
  343. defaults to the solr data directory.
  344. -->
  345. <updateLog>
  346. <str name="dir">${solr.data.dir:}</str>
  347. </updateLog>
  348. </updateHandler>
  349. <!-- IndexReaderFactory :自定义的
  350. Use the following format to specify a custom IndexReaderFactory,
  351. which allows for alternate IndexReader implementations.
  352. ** Experimental Feature ** //实验性质的
  353. Please note - Using a custom IndexReaderFactory may prevent
  354. certain other features from working. The API to
  355. IndexReaderFactory may change without warning or may even be
  356. removed from future releases if the problems cannot be resolved.
  357. ** Features that may not work with custom IndexReaderFactory **
  358. The ReplicationHandler assumes a disk-resident index. Using a
  359. custom IndexReader implementation may cause incompatibility
  360. with ReplicationHandler and may cause replication to not work
  361. correctly. See SOLR-1366 for details.
  362. -->
  363. <!--
  364. <indexReaderFactory name="IndexReaderFactory" class="package.class">
  365. <str name="someArg">Some Value</str>
  366. </indexReaderFactory >
  367. -->
  368. <!-- By explicitly declaring the Factory, the termIndexDivisor can
  369. be specified.
  370. -->
  371. <!--
  372. <indexReaderFactory name="IndexReaderFactory"
  373. class="solr.StandardIndexReaderFactory">
  374. <int name="setTermIndexDivisor">12</int>
  375. </indexReaderFactory >
  376. -->
  377. <!-- //Query 设置
  378. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  379. Query section - these settings control query time things like caches
  380. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
  381. <query>
  382. <!-- Max Boolean Clauses //query操作中 boolean关系的项数
  383. Maximum number of clauses in each BooleanQuery, an exception
  384. is thrown if exceeded.
  385. ** WARNING ** 全局设置,多种设置,最后一个有效
  386. This option actually modifies a global Lucene property that
  387. will affect all SolrCores. If multiple solrconfig.xml files
  388. disagree on this property, the value at any given moment will
  389. be based on the last SolrCore to be initialized.
  390. -->
  391. <maxBooleanClauses>1024</maxBooleanClauses>
  392. <!-- Solr Internal Query Caches: 内部缓存for query
  393. There are two implementations of cache available for Solr,
  394. LRUCache, based on a synchronized LinkedHashMap, and
  395. FastLRUCache, based on a ConcurrentHashMap.
  396. FastLRUCache has faster gets and slower puts in single
  397. threaded operation and thus is generally faster than LRUCache
  398. when the hit ratio of the cache is high (> 75%), and may be
  399. faster under other scenarios on multi-cpu systems.
  400. -->
  401. <!-- Filter Cache:过滤 cache
  402. Cache used by SolrIndexSearcher for filters (DocSets),
  403. unordered sets of *all* documents that match a query. When a
  404. new searcher is opened, its caches may be prepopulated or
  405. "autowarmed" using data from caches in the old searcher.
  406. autowarmCount is the number of items to prepopulate. For
  407. LRUCache, the autowarmed items will be the most recently
  408. accessed items.
  409. Parameters:
  410. class - the SolrCache implementation LRUCache or
  411. (LRUCache or FastLRUCache)
  412. size - the maximum number of entries in the cache
  413. initialSize - the initial capacity (number of entries) of
  414. the cache. (see java.util.HashMap)
  415. autowarmCount - the number of entries to prepopulate from
  416. and old cache.
  417. -->
  418. <filterCache class="solr.FastLRUCache" size="512"
  419. initialSize="512" autowarmCount="0"/>
  420. <!-- Query Result Cache
  421. Caches results of searches - ordered lists of document ids
  422. (DocList) based on a query, a sort, and the range of documents requested.
  423. -->
  424. <queryResultCache class="solr.LRUCache" size="512"
  425. initialSize="512" autowarmCount="0"/>
  426. <!-- Document Cache
  427. Caches Lucene Document objects (the stored fields for each
  428. document). Since Lucene internal document ids are transient,
  429. this cache will not be autowarmed.
  430. -->
  431. <documentCache class="solr.LRUCache" size="512"
  432. initialSize="512" autowarmCount="0"/>
  433. <!-- Field Value Cache
  434. Cache used to hold field values that are quickly accessible
  435. by document id. The fieldValueCache is created by default
  436. even if not configured here.
  437. -->
  438. <fieldValueCache class="solr.FastLRUCache" size="512"
  439. autowarmCount="128" showItems="32" />
  440. <!-- Custom Cache :for用户的应用设置
  441. Example of a generic cache. These caches may be accessed by
  442. name through SolrIndexSearcher.getCache(),cacheLookup(), and
  443. cacheInsert(). The purpose is to enable easy caching of
  444. user/application level data. The regenerator argument should
  445. be specified as an implementation of solr.CacheRegenerator
  446. if autowarming is desired.
  447. -->
  448. <!--
  449. <cache name="myUserCache"
  450. class="solr.LRUCache"
  451. size="4096"
  452. initialSize="1024"
  453. autowarmCount="1024"
  454. regenerator="com.mycompany.MyRegenerator"
  455. />
  456. -->
  457. <!-- Lazy Field Loading //字段的迟加载
  458. If true, stored fields that are not requested will be loaded
  459. lazily. This can result in a significant speed improvement
  460. if the usual case is to not load all stored fields,
  461. especially if the skipped fields are large compressed text
  462. fields.
  463. -->
  464. <enableLazyFieldLoading>true</enableLazyFieldLoading>
  465. <!-- Use Filter For Sorted Query
  466. A possible optimization that attempts to use a filter to
  467. satisfy a search. If the requested sort does not include
  468. score, then the filterCache will be checked for a filter
  469. matching the query. If found, the filter will be used as the
  470. source of document ids, and then the sort will be applied to
  471. that.
  472. For most situations, this will not be useful unless you
  473. frequently get the same search repeatedly with different sort
  474. options, and none of them ever use "score"
  475. -->
  476. <useFilterForSortedQuery>true</useFilterForSortedQuery>
  477. <!-- Result Window Size
  478. An optimization for use with the queryResultCache. When a search
  479. is requested, a superset of the requested number of document ids
  480. are collected. For example, if a search for a particular query
  481. requests matching documents 10 through 19, and queryWindowSize is 50,
  482. then documents 0 through 49 will be collected and cached. Any further
  483. requests in that range can be satisfied via the cache.
  484. -->
  485. <queryResultWindowSize>20</queryResultWindowSize>
  486. <!-- Maximum number of documents to cache for any entry in the
  487. queryResultCache.
  488. -->
  489. <queryResultMaxDocsCached>200</queryResultMaxDocsCached>
  490. <!-- Query Related Event Listeners
  491. Various IndexSearcher related events can trigger Listeners to
  492. take actions.
  493. newSearcher - fired whenever a new searcher is being prepared
  494. and there is a current searcher handling requests (aka
  495. registered). It can be used to prime certain caches to
  496. prevent long request times for certain requests.
  497. firstSearcher - fired whenever a new searcher is being
  498. prepared but there is no current registered searcher to handle
  499. requests or to gain autowarming data from.
  500. -->
  501. <!-- QuerySenderListener takes an array of NamedList and executes a
  502. local query request for each NamedList in sequence.
  503. -->
  504. <listener event="newSearcher" class="solr.QuerySenderListener">
  505. <arr name="queries">
  506. <!--
  507. <lst>
  508. <str name="q">solr</str>
  509. <str name="sort">price asc</str>
  510. </lst>
  511. <lst>
  512. <str name="q">rocks</str>
  513. <str name="sort">weight asc</str>
  514. </lst>
  515. -->
  516. </arr>
  517. </listener>
  518. <listener event="firstSearcher" class="solr.QuerySenderListener">
  519. <arr name="queries">
  520. <lst>
  521. <str name="q">static firstSearcher warming in solrconfig.xml</str>
  522. </lst>
  523. </arr>
  524. </listener>
  525. <!-- Use Cold Searcher
  526. If a search request comes in and there is no current
  527. registered searcher, then immediately register the still
  528. warming searcher and use it. If "false" then all requests
  529. will block until the first searcher is done warming.
  530. -->
  531. <useColdSearcher>false</useColdSearcher>
  532. <!-- Max Warming Searchers
  533. Maximum number of searchers that may be warming in the
  534. background concurrently. An error is returned if this limit
  535. is exceeded.
  536. Recommend values of 1-2 for read-only slaves, higher for
  537. masters w/o cache warming.
  538. -->
  539. <maxWarmingSearchers>2</maxWarmingSearchers>
  540. </query>
  541. <!-- Request Dispatcher:request 派发器
  542. This section contains instructions for how the SolrDispatchFilter
  543. should behave when processing requests for this SolrCore.
  544. handleSelect is a legacy option that affects the behavior of requests
  545. such as /select?qt=XXX
  546. handleSelect="true" will cause the SolrDispatchFilter to process
  547. the request and dispatch the query to a handler specified by the
  548. "qt" param, assuming "/select" isn't already registered.
  549. handleSelect="false" will cause the SolrDispatchFilter to
  550. ignore "/select" requests, resulting in a 404 unless a handler
  551. is explicitly registered with the name "/select"
  552. handleSelect="true" is not recommended for new users, but is the default
  553. for backwards compatibility
  554. -->
  555. <requestDispatcher handleSelect="false" >
  556. <!-- Request Parsing
  557. These settings indicate how Solr Requests may be parsed, and
  558. what restrictions may be placed on the ContentStreams from
  559. those requests
  560. enableRemoteStreaming - enables use of the stream.file
  561. and stream.url parameters for specifying remote streams.
  562. multipartUploadLimitInKB - specifies the max size of
  563. Multipart File Uploads that Solr will allow in a Request.
  564. *** WARNING ***
  565. The settings below authorize Solr to fetch remote files, You
  566. should make sure your system has some authentication before
  567. using enableRemoteStreaming="true"
  568. -->
  569. <requestParsers enableRemoteStreaming="true" multipartUploadLimitInKB="2048000" />
  570. <!-- HTTP Caching
  571. Set HTTP caching related parameters (for proxy caches and clients).
  572. The options below instruct Solr not to output any HTTP Caching related headers
  573. -->
  574. <httpCaching never304="true" />
  575. <!-- If you include a <cacheControl> directive, it will be used to
  576. generate a Cache-Control header (as well as an Expires header
  577. if the value contains "max-age=")
  578. By default, no Cache-Control header is generated.
  579. You can use the <cacheControl> option even if you have set
  580. never304="true"
  581. -->
  582. <!--
  583. <httpCaching never304="true" >
  584. <cacheControl>max-age=30, public</cacheControl>
  585. </httpCaching>
  586. -->
  587. <!-- To enable Solr to respond with automatically generated HTTP
  588. Caching headers, and to response to Cache Validation requests
  589. correctly, set the value of never304="false"
  590. This will cause Solr to generate Last-Modified and ETag
  591. headers based on the properties of the Index.
  592. The following options can also be specified to affect the
  593. values of these headers...
  594. lastModFrom - the default value is "openTime" which means the
  595. Last-Modified value (and validation against If-Modified-Since
  596. requests) will all be relative to when the current Searcher
  597. was opened. You can change it to lastModFrom="dirLastMod" if
  598. you want the value to exactly correspond to when the physical
  599. index was last modified.
  600. etagSeed="..." is an option you can change to force the ETag
  601. header (and validation against If-None-Match requests) to be
  602. different even if the index has not changed (ie: when making
  603. significant changes to your config file)
  604. (lastModifiedFrom and etagSeed are both ignored if you use
  605. the never304="true" option)
  606. -->
  607. <!--
  608. <httpCaching lastModifiedFrom="openTime"
  609. etagSeed="Solr">
  610. <cacheControl>max-age=30, public</cacheControl>
  611. </httpCaching>
  612. -->
  613. </requestDispatcher>
  614. <!-- Request Handlers //request处理器
  615. http://wiki.apache.org/solr/SolrRequestHandler
  616. Incoming queries will be dispatched to a specific handler by name
  617. based on the path specified in the request.
  618. Legacy behavior: If the request path uses "/select" but no Request
  619. Handler has that name, and if handleSelect="true" has been specified in
  620. the requestDispatcher, then the Request Handler is dispatched based on
  621. the qt parameter. Handlers without a leading '/' are accessed this way
  622. like so: http://host/app/[core/]select?qt=name If no qt is
  623. given, then the requestHandler that declares default="true" will be
  624. used or the one named "standard".
  625. If a Request Handler is declared with startup="lazy", then it will
  626. not be initialized until the first request that uses it.
  627. -->
  628. <!-- SearchHandler : 基本的searcher支持分布式查询
  629. http://wiki.apache.org/solr/SearchHandler
  630. For processing Search Queries, the primary Request Handler
  631. provided with Solr is "SearchHandler" It delegates to a sequent
  632. of SearchComponents (see below) and supports distributed
  633. queries across multiple shards
  634. -->
  635. <requestHandler name="/select" class="solr.SearchHandler">
  636. <!-- default values for query parameters can be specified, these
  637. will be overridden by parameters in the request
  638. // df: deafault field name 必须在schema.xml文件中定义不然启动时,会有exception
  639. 默认设置
  640. -->
  641. <lst name="defaults">
  642. <str name="echoParams">explicit</str>
  643. <int name="rows">10</int>
  644. <str name="df">text</str>
  645. </lst>
  646. <!-- In addition to defaults, "appends" params can be specified
  647. to identify values which should be appended to the list of
  648. multi-val params from the query (or the existing "defaults").
  649. -->
  650. <!-- In this example, the param "fq=instock:true" would be appended to
  651. any query time fq params the user may specify, as a mechanism for
  652. partitioning the index, independent of any user selected filtering
  653. that may also be desired (perhaps as a result of faceted searching).
  654. NOTE: there is *absolutely* nothing a client can do to prevent these
  655. "appends" values from being used, so don't use this mechanism
  656. unless you are sure you always want it.
  657. -->
  658. <!--
  659. <lst name="appends">
  660. <str name="fq">inStock:true</str>
  661. </lst>
  662. -->
  663. <!-- "invariants" are a way of letting the Solr maintainer lock down
  664. the options available to Solr clients. Any params values
  665. specified here are used regardless of what values may be specified
  666. in either the query, the "defaults", or the "appends" params.
  667. In this example, the facet.field and facet.query params would
  668. be fixed, limiting the facets clients can use. Faceting is
  669. not turned on by default - but if the client does specify
  670. facet=true in the request, these are the only facets they
  671. will be able to see counts for; regardless of what other
  672. facet.field or facet.query params they may specify.
  673. NOTE: there is *absolutely* nothing a client can do to prevent these
  674. "invariants" values from being used, so don't use this mechanism
  675. unless you are sure you always want it.
  676. -->
  677. <!--
  678. <lst name="invariants">
  679. <str name="facet.field">cat</str>
  680. <str name="facet.field">manu_exact</str>
  681. <str name="facet.query">price:[* TO 500]</str>
  682. <str name="facet.query">price:[500 TO *]</str>
  683. </lst>
  684. -->
  685. <!-- If the default list of SearchComponents is not desired, that
  686. list can either be overridden completely, or components can be
  687. prepended or appended to the default list. (see below)
  688. -->
  689. <!--
  690. <arr name="components">
  691. <str>nameOfCustomComponent1</str>
  692. <str>nameOfCustomComponent2</str>
  693. </arr>
  694. -->
  695. </requestHandler>
  696. <!-- A request handler that returns indented JSON by default -->
  697. <requestHandler name="/query" class="solr.SearchHandler">
  698. <lst name="defaults">
  699. <str name="echoParams">explicit</str>
  700. <str name="wt">json</str>
  701. <str name="indent">true</str>
  702. <str name="df">text</str>
  703. </lst>
  704. </requestHandler>
  705. <!-- realtime get handler, guaranteed to return the latest stored fields of
  706. any document, without the need to commit or open a new searcher. The
  707. current implementation relies on the updateLog feature being enabled. -->
  708. <requestHandler name="/get" class="solr.RealTimeGetHandler">
  709. <lst name="defaults">
  710. <str name="omitHeader">true</str>
  711. </lst>
  712. </requestHandler>
  713. <!-- A Robust Example :一个健壮的实例
  714. This example SearchHandler declaration shows off usage of the
  715. SearchHandler with many defaults declared
  716. //一个request handler可以有多个实例可以设置不同的名字和参数
  717. Note that multiple instances of the same Request Handler
  718. (SearchHandler) can be registered multiple times with different
  719. names (and different init parameters)
  720. -->
  721. <requestHandler name="/browse" class="solr.SearchHandler">
  722. <lst name="defaults">
  723. <str name="echoParams">explicit</str>
  724. <!-- VelocityResponseWriter settings -->
  725. <str name="wt">velocity</str>
  726. <str name="v.template">browse</str>
  727. <str name="v.layout">layout</str>
  728. <str name="title">Solritas</str>
  729. <!-- Query settings -->
  730. <str name="defType">edismax</str>
  731. <str name="qf">
  732. text^0.5 features^1.0 name^1.2 sku^1.5 id^10.0 manu^1.1 cat^1.4
  733. </str>
  734. <str name="mm">100%</str>
  735. <str name="q.alt">*:*</str>
  736. <str name="rows">10</str>
  737. <str name="fl">*,score</str>
  738. <str name="mlt.qf">
  739. text^0.5 features^1.0 name^1.2 sku^1.5 id^10.0 manu^1.1 cat^1.4
  740. </str>
  741. <str name="mlt.fl">text,features,name,sku,id,manu,cat</str>
  742. <int name="mlt.count">3</int>
  743. <!-- Faceting defaults -->
  744. <str name="facet">on</str>
  745. <str name="facet.field">cat</str>
  746. <str name="facet.field">manu_exact</str>
  747. <str name="facet.query">ipod</str>
  748. <str name="facet.query">GB</str>
  749. <str name="facet.mincount">1</str>
  750. <str name="facet.pivot">cat,inStock</str>
  751. <str name="facet.range.other">after</str>
  752. <str name="facet.range">price</str>
  753. <int name="f.price.facet.range.start">0</int>
  754. <int name="f.price.facet.range.end">600</int>
  755. <int name="f.price.facet.range.gap">50</int>
  756. <str name="facet.range">popularity</str>
  757. <int name="f.popularity.facet.range.start">0</int>
  758. <int name="f.popularity.facet.range.end">10</int>
  759. <int name="f.popularity.facet.range.gap">3</int>
  760. <str name="facet.range">manufacturedate_dt</str>
  761. <str name="f.manufacturedate_dt.facet.range.start">NOW/YEAR-10YEARS</str>
  762. <str name="f.manufacturedate_dt.facet.range.end">NOW</str>
  763. <str name="f.manufacturedate_dt.facet.range.gap">+1YEAR</str>
  764. <str name="f.manufacturedate_dt.facet.range.other">before</str>
  765. <str name="f.manufacturedate_dt.facet.range.other">after</str>
  766. <!-- Highlighting defaults -->
  767. <str name="hl">on</str>
  768. <str name="hl.fl">text features name</str>
  769. <str name="f.name.hl.fragsize">0</str>
  770. <str name="f.name.hl.alternateField">name</str>
  771. <!-- Spell checking defaults -->
  772. <str name="spellcheck">on</str>
  773. <str name="spellcheck.extendedResults">false</str>
  774. <str name="spellcheck.count">5</str>
  775. <str name="spellcheck.alternativeTermCount">2</str>
  776. <str name="spellcheck.maxResultsForSuggest">5</str>
  777. <str name="spellcheck.collate">true</str>
  778. <str name="spellcheck.collateExtendedResults">true</str>
  779. <str name="spellcheck.maxCollationTries">5</str>
  780. <str name="spellcheck.maxCollations">3</str>
  781. </lst>
  782. <!-- append spellchecking to our list of components -->
  783. <arr name="last-components">
  784. <str>spellcheck</str>
  785. </arr>
  786. </requestHandler>
  787. <!-- Update Request Handler. :更新处理
  788. http://wiki.apache.org/solr/UpdateXmlMessages
  789. The canonical Request Handler for Modifying the Index through
  790. commands specified using XML, JSON, CSV, or JAVABIN
  791. Note: Since solr1.1 requestHandlers requires a valid content
  792. type header if posted in the body. For example, curl now
  793. requires: -H 'Content-type:text/xml; charset=utf-8'
  794. To override the request content type and force a specific
  795. Content-type, use the request parameter:
  796. ?update.contentType=text/csv
  797. This handler will pick a response format to match the input
  798. if the 'wt' parameter is not explicit
  799. -->
  800. <requestHandler name="/update" class="solr.UpdateRequestHandler">
  801. <!-- See below for information on defining
  802. updateRequestProcessorChains that can be used by name
  803. on each Update Request
  804. -->
  805. <!--
  806. <lst name="defaults">
  807. <str name="update.chain">dedupe</str>
  808. </lst>
  809. -->
  810. </requestHandler>
  811. <!-- Solr Cell Update Request Handler: Content extract library
  812. http://wiki.apache.org/solr/ExtractingRequestHandler
  813. -->
  814. <requestHandler name="/update/extract" startup="lazy"
  815. class="solr.extraction.ExtractingRequestHandler" >
  816. <lst name="defaults">
  817. <!-- All the main content goes into "text"... if you need to return
  818. the extracted text or do highlighting, use a stored field. -->
  819. <str name="fmap.content">text</str>
  820. <str name="lowernames">true</str>
  821. <str name="uprefix">ignored_</str>
  822. <!-- capture link hrefs but ignore div attributes -->
  823. <str name="captureAttr">true</str>
  824. <str name="fmap.a">links</str>
  825. <str name="fmap.div">ignored_</str>
  826. </lst>
  827. </requestHandler>
  828. <!-- Field Analysis Request Handler : for Field
  829. RequestHandler that provides much the same functionality as
  830. analysis.jsp. Provides the ability to specify multiple field
  831. types and field names in the same request and outputs
  832. index-time and query-time analysis for each of them.
  833. Request parameters are:
  834. analysis.fieldname - field name whose analyzers are to be used
  835. analysis.fieldtype - field type whose analyzers are to be used
  836. analysis.fieldvalue - text for index-time analysis
  837. q (or analysis.q) - text for query time analysis
  838. analysis.showmatch (true|false) - When set to true and when
  839. query analysis is performed, the produced tokens of the
  840. field value analysis will be marked as "matched" for every
  841. token that is produces by the query analysis
  842. -->
  843. <requestHandler name="/analysis/field" startup="lazy"
  844. class="solr.FieldAnalysisRequestHandler" />
  845. <!-- Document Analysis Handler: for Document
  846. http://wiki.apache.org/solr/AnalysisRequestHandler
  847. An analysis handler that provides a breakdown of the analysis
  848. process of provided documents. This handler expects a (single)
  849. content stream with the following format:
  850. <docs>
  851. <doc>
  852. <field name="id">1</field>
  853. <field name="name">The Name</field>
  854. <field name="text">The Text Value</field>
  855. </doc>
  856. <doc>...</doc>
  857. <doc>...</doc>
  858. ...
  859. </docs>
  860. Note: Each document must contain a field which serves as the
  861. unique key. This key is used in the returned response to associate
  862. an analysis breakdown to the analyzed document.
  863. Like the FieldAnalysisRequestHandler, this handler also supports
  864. query analysis by sending either an "analysis.query" or "q"
  865. request parameter that holds the query text to be analyzed. It
  866. also supports the "analysis.showmatch" parameter which when set to
  867. true, all field tokens that match the query tokens will be marked
  868. as a "match".
  869. -->
  870. <requestHandler name="/analysis/document"
  871. class="solr.DocumentAnalysisRequestHandler"
  872. startup="lazy" />
  873. <!-- Admin Handlers: for Admin
  874. Admin Handlers - This will register all the standard admin
  875. RequestHandlers.
  876. -->
  877. <requestHandler name="/admin/"
  878. class="solr.admin.AdminHandlers" />
  879. <!-- This single handler is equivalent to the following... -->
  880. <!--
  881. <requestHandler name="/admin/luke" class="solr.admin.LukeRequestHandler" />
  882. <requestHandler name="/admin/system" class="solr.admin.SystemInfoHandler" />
  883. <requestHandler name="/admin/plugins" class="solr.admin.PluginInfoHandler" />
  884. <requestHandler name="/admin/threads" class="solr.admin.ThreadDumpHandler" />
  885. <requestHandler name="/admin/properties" class="solr.admin.PropertiesRequestHandler" />
  886. <requestHandler name="/admin/file" class="solr.admin.ShowFileRequestHandler" >
  887. -->
  888. <!-- If you wish to hide files under ${solr.home}/conf, explicitly
  889. register the ShowFileRequestHandler using:
  890. -->
  891. <!--
  892. <requestHandler name="/admin/file"
  893. class="solr.admin.ShowFileRequestHandler" >
  894. <lst name="invariants">
  895. <str name="hidden">synonyms.txt</str>
  896. <str name="hidden">anotherfile.txt</str>
  897. </lst>
  898. </requestHandler>
  899. -->
  900. <!-- ping/healthcheck -->
  901. <requestHandler name="/admin/ping" class="solr.PingRequestHandler">
  902. <lst name="invariants">
  903. <str name="q">solrpingquery</str>
  904. </lst>
  905. <lst name="defaults">
  906. <str name="echoParams">all</str>
  907. </lst>
  908. <!-- An optional feature of the PingRequestHandler is to configure the
  909. handler with a "healthcheckFile" which can be used to enable/disable
  910. the PingRequestHandler.
  911. relative paths are resolved against the data dir
  912. -->
  913. <!-- <str name="healthcheckFile">server-enabled.txt</str> -->
  914. </requestHandler>
  915. <!-- Echo the request contents back to the client -->
  916. <requestHandler name="/debug/dump" class="solr.DumpRequestHandler" >
  917. <lst name="defaults">
  918. <str name="echoParams">explicit</str>
  919. <str name="echoHandler">true</str>
  920. </lst>
  921. </requestHandler>
  922. <!-- Solr Replication: Solr备份:master/slave的配置
  923. The SolrReplicationHandler supports replicating indexes from a
  924. "master" used for indexing and "slaves" used for queries.
  925. http://wiki.apache.org/solr/SolrReplication
  926. In the example below,
  927. remove the <lst name="master"> section if this is just a slave and
  928. remove the <lst name="slave" > section if this is just a master.
  929. -->
  930. <!--
  931. <requestHandler name="/replication" class="solr.ReplicationHandler" >
  932. <lst name="master">
  933. <str name="replicateAfter">commit</str>
  934. <str name="replicateAfter">startup</str>
  935. <str name="confFiles">schema.xml,stopwords.txt</str>
  936. </lst>
  937. <lst name="slave">
  938. <str name="masterUrl">http://localhost:8983/solr/replication</str>
  939. <str name="pollInterval">00:00:60</str>
  940. </lst>
  941. </requestHandler>
  942. -->
  943. <!-- Solr Replication for SolrCloud Recovery:SolrCloud备份
  944. This is the config need for SolrCloud's recovery replication.
  945. -->
  946. <requestHandler name="/replication" class="solr.ReplicationHandler" startup="lazy" />
  947. <!-- Search Components :搜索组件
  948. Search components are registered to SolrCore and used by
  949. instances of SearchHandler (which can access them by name)
  950. By default, the following components are available:
  951. <searchComponent name="query" class="solr.QueryComponent" />
  952. <searchComponent name="facet" class="solr.FacetComponent" />
  953. <searchComponent name="mlt" class="solr.MoreLikeThisComponent" />
  954. <searchComponent name="highlight" class="solr.HighlightComponent" />
  955. <searchComponent name="stats" class="solr.StatsComponent" />
  956. <searchComponent name="debug" class="solr.DebugComponent" />
  957. Default configuration in a requestHandler would look like:
  958. <arr name="components">
  959. <str>query</str>
  960. <str>facet</str>
  961. <str>mlt</str>
  962. <str>highlight</str>
  963. <str>stats</str>
  964. <str>debug</str>
  965. </arr>
  966. If you register a searchComponent to one of the standard names,
  967. that will be used instead of the default.
  968. To insert components before or after the 'standard' components, use:
  969. <arr name="first-components">
  970. <str>myFirstComponentName</str>
  971. </arr>
  972. <arr name="last-components">
  973. <str>myLastComponentName</str>
  974. </arr>
  975. NOTE: The component registered with the name "debug" will
  976. always be executed after the "last-components"
  977. -->
  978. <!-- Spell Check
  979. The spell check component can return a list of alternative spelling
  980. suggestions.
  981. http://wiki.apache.org/solr/SpellCheckComponent
  982. -->
  983. <searchComponent name="spellcheck" class="solr.SpellCheckComponent">
  984. <str name="queryAnalyzerFieldType">textSpell</str>
  985. <!-- Multiple "Spell Checkers" can be declared and used by this
  986. component
  987. -->
  988. <!-- a spellchecker built from a field of the main index -->
  989. <lst name="spellchecker">
  990. <str name="name">default</str>
  991. <str name="field">name</str>
  992. <str name="classname">solr.DirectSolrSpellChecker</str>
  993. <!-- the spellcheck distance measure used, the default is the internal levenshtein -->
  994. <str name="distanceMeasure">internal</str>
  995. <!-- minimum accuracy needed to be considered a valid spellcheck suggestion -->
  996. <float name="accuracy">0.5</float>
  997. <!-- the maximum #edits we consider when enumerating terms: can be 1 or 2 -->
  998. <int name="maxEdits">2</int>
  999. <!-- the minimum shared prefix when enumerating terms -->
  1000. <int name="minPrefix">1</int>
  1001. <!-- maximum number of inspections per result. -->
  1002. <int name="maxInspections">5</int>
  1003. <!-- minimum length of a query term to be considered for correction -->
  1004. <int name="minQueryLength">4</int>
  1005. <!-- maximum threshold of documents a query term can appear to be considered for correction -->
  1006. <float name="maxQueryFrequency">0.01</float>
  1007. <!-- uncomment this to require suggestions to occur in 1% of the documents
  1008. <float name="thresholdTokenFrequency">.01</float>
  1009. -->
  1010. </lst>
  1011. <!-- a spellchecker that can break or combine words. See "/spell" handler below for usage -->
  1012. <lst name="spellchecker">
  1013. <str name="name">wordbreak</str>
  1014. <str name="classname">solr.WordBreakSolrSpellChecker</str>
  1015. <str name="field">name</str>
  1016. <str name="combineWords">true</str>
  1017. <str name="breakWords">true</str>
  1018. <int name="maxChanges">10</int>
  1019. </lst>
  1020. <!-- a spellchecker that uses a different distance measure -->
  1021. <!--
  1022. <lst name="spellchecker">
  1023. <str name="name">jarowinkler</str>
  1024. <str name="field">spell</str>
  1025. <str name="classname">solr.DirectSolrSpellChecker</str>
  1026. <str name="distanceMeasure">
  1027. org.apache.lucene.search.spell.JaroWinklerDistance
  1028. </str>
  1029. </lst>
  1030. -->
  1031. <!-- a spellchecker that use an alternate comparator
  1032. comparatorClass be one of:
  1033. 1. score (default)
  1034. 2. freq (Frequency first, then score)
  1035. 3. A fully qualified class name
  1036. -->
  1037. <!--
  1038. <lst name="spellchecker">
  1039. <str name="name">freq</str>
  1040. <str name="field">lowerfilt</str>
  1041. <str name="classname">solr.DirectSolrSpellChecker</str>
  1042. <str name="comparatorClass">freq</str>
  1043. -->
  1044. <!-- A spellchecker that reads the list of words from a file -->
  1045. <!--
  1046. <lst name="spellchecker">
  1047. <str name="classname">solr.FileBasedSpellChecker</str>
  1048. <str name="name">file</str>
  1049. <str name="sourceLocation">spellings.txt</str>
  1050. <str name="characterEncoding">UTF-8</str>
  1051. <str name="spellcheckIndexDir">spellcheckerFile</str>
  1052. </lst>
  1053. -->
  1054. </searchComponent>
  1055. <!--
  1056. //a demo for Spell check
  1057. A request handler for demonstrating the spellcheck component.
  1058. NOTE: This is purely as an example. The whole purpose of the
  1059. SpellCheckComponent is to hook it into the request handler that
  1060. handles your normal user queries so that a separate request is
  1061. not needed to get suggestions.
  1062. IN OTHER WORDS, THERE IS REALLY GOOD CHANCE THE SETUP BELOW IS
  1063. NOT WHAT YOU WANT FOR YOUR PRODUCTION SYSTEM!
  1064. See http://wiki.apache.org/solr/SpellCheckComponent for details
  1065. on the request parameters.
  1066. -->
  1067. <requestHandler name="/spell" class="solr.SearchHandler" startup="lazy">
  1068. <lst name="defaults">
  1069. <str name="df">text</str>
  1070. <!-- Solr will use suggestions from both the 'default' spellchecker
  1071. and from the 'wordbreak' spellchecker and combine them.
  1072. collations (re-written queries) can include a combination of
  1073. corrections from both spellcheckers -->
  1074. <str name="spellcheck.dictionary">default</str>
  1075. <str name="spellcheck.dictionary">wordbreak</str>
  1076. <str name="spellcheck">on</str>
  1077. <str name="spellcheck.extendedResults">true</str>
  1078. <str name="spellcheck.count">10</str>
  1079. <str name="spellcheck.alternativeTermCount">5</str>
  1080. <str name="spellcheck.maxResultsForSuggest">5</str>
  1081. <str name="spellcheck.collate">true</str>
  1082. <str name="spellcheck.collateExtendedResults">true</str>
  1083. <str name="spellcheck.maxCollationTries">10</str>
  1084. <str name="spellcheck.maxCollations">5</str>
  1085. </lst>
  1086. <arr name="last-components">
  1087. <str>spellcheck</str>
  1088. </arr>
  1089. </requestHandler>
  1090. <!-- Term Vector Component
  1091. http://wiki.apache.org/solr/TermVectorComponent
  1092. -->
  1093. <searchComponent name="tvComponent" class="solr.TermVectorComponent"/>
  1094. <!-- A request handler for demonstrating the term vector component
  1095. This is purely as an example.
  1096. In reality you will likely want to add the component to your
  1097. already specified request handlers.
  1098. -->
  1099. <requestHandler name="/tvrh" class="solr.SearchHandler" startup="lazy">
  1100. <lst name="defaults">
  1101. <str name="df">text</str>
  1102. <bool name="tv">true</bool>
  1103. </lst>
  1104. <arr name="last-components">
  1105. <str>tvComponent</str>
  1106. </arr>
  1107. </requestHandler>
  1108. <!-- Clustering Component
  1109. http://wiki.apache.org/solr/ClusteringComponent
  1110. You'll need to set the solr.cluster.enabled system property
  1111. when running solr to run with clustering enabled:
  1112. java -Dsolr.clustering.enabled=true -jar start.jar
  1113. -->
  1114. <searchComponent name="clustering"
  1115. enable="${solr.clustering.enabled:false}"
  1116. class="solr.clustering.ClusteringComponent" >
  1117. <!-- Declare an engine -->
  1118. <lst name="engine">
  1119. <!-- The name, only one can be named "default" -->
  1120. <str name="name">default</str>
  1121. <!-- Class name of Carrot2 clustering algorithm.
  1122. Currently available algorithms are:
  1123. * org.carrot2.clustering.lingo.LingoClusteringAlgorithm
  1124. * org.carrot2.clustering.stc.STCClusteringAlgorithm
  1125. * org.carrot2.clustering.kmeans.BisectingKMeansClusteringAlgorithm
  1126. See http://project.carrot2.org/algorithms.html for the
  1127. algorithm's characteristics.
  1128. -->
  1129. <str name="carrot.algorithm">org.carrot2.clustering.lingo.LingoClusteringAlgorithm</str>
  1130. <!-- Overriding values for Carrot2 default algorithm attributes.
  1131. For a description of all available attributes, see:
  1132. http://download.carrot2.org/stable/manual/#chapter.components.
  1133. Use attribute key as name attribute of str elements
  1134. below. These can be further overridden for individual
  1135. requests by specifying attribute key as request parameter
  1136. name and attribute value as parameter value.
  1137. -->
  1138. <str name="LingoClusteringAlgorithm.desiredClusterCountBase">20</str>
  1139. <!-- Location of Carrot2 lexical resources.
  1140. A directory from which to load Carrot2-specific stop words
  1141. and stop labels. Absolute or relative to Solr config directory.
  1142. If a specific resource (e.g. stopwords.en) is present in the
  1143. specified dir, it will completely override the corresponding
  1144. default one that ships with Carrot2.
  1145. For an overview of Carrot2 lexical resources, see:
  1146. http://download.carrot2.org/head/manual/#chapter.lexical-resources
  1147. -->
  1148. <str name="carrot.lexicalResourcesDir">clustering/carrot2</str>
  1149. <!-- The language to assume for the documents.
  1150. For a list of allowed values, see:
  1151. http://download.carrot2.org/stable/manual/#section.attribute.lingo.MultilingualClustering.defaultLanguage
  1152. -->
  1153. <str name="MultilingualClustering.defaultLanguage">ENGLISH</str>
  1154. </lst>
  1155. <lst name="engine">
  1156. <str name="name">stc</str>
  1157. <str name="carrot.algorithm">org.carrot2.clustering.stc.STCClusteringAlgorithm</str>
  1158. </lst>
  1159. </searchComponent>
  1160. <!-- A request handler for demonstrating the clustering component
  1161. This is purely as an example.
  1162. In reality you will likely want to add the component to your
  1163. already specified request handlers.
  1164. -->
  1165. <requestHandler name="/clustering" startup="lazy"
  1166. enable="${solr.clustering.enabled:false}"
  1167. class="solr.SearchHandler">
  1168. <lst name="defaults">
  1169. <bool name="clustering">true</bool>
  1170. <str name="clustering.engine">default</str>
  1171. <bool name="clustering.results">true</bool>
  1172. <!-- The title field -->
  1173. <str name="carrot.title">name</str>
  1174. <str name="carrot.url">id</str>
  1175. <!-- The field to cluster on -->
  1176. <str name="carrot.snippet">features</str>
  1177. <!-- produce summaries -->
  1178. <bool name="carrot.produceSummary">true</bool>
  1179. <!-- the maximum number of labels per cluster -->
  1180. <!--<int name="carrot.numDescriptions">5</int>-->
  1181. <!-- produce sub clusters -->
  1182. <bool name="carrot.outputSubClusters">false</bool>
  1183. <str name="defType">edismax</str>
  1184. <str name="qf">
  1185. text^0.5 features^1.0 name^1.2 sku^1.5 id^10.0 manu^1.1 cat^1.4
  1186. </str>
  1187. <str name="q.alt">*:*</str>
  1188. <str name="rows">10</str>
  1189. <str name="fl">*,score</str>
  1190. </lst>
  1191. <arr name="last-components">
  1192. <str>clustering</str>
  1193. </arr>
  1194. </requestHandler>
  1195. <!-- Terms Component
  1196. http://wiki.apache.org/solr/TermsComponent
  1197. A component to return terms and document frequency of those
  1198. terms
  1199. -->
  1200. <searchComponent name="terms" class="solr.TermsComponent"/>
  1201. <!-- A request handler for demonstrating the terms component -->
  1202. <requestHandler name="/terms" class="solr.SearchHandler" startup="lazy">
  1203. <lst name="defaults">
  1204. <bool name="terms">true</bool>
  1205. </lst>
  1206. <arr name="components">
  1207. <str>terms</str>
  1208. </arr>
  1209. </requestHandler>
  1210. <!-- Query Elevation Component
  1211. http://wiki.apache.org/solr/QueryElevationComponent
  1212. a search component that enables you to configure the top
  1213. results for a given query regardless of the normal lucene
  1214. scoring.
  1215. -->
  1216. <searchComponent name="elevator" class="solr.QueryElevationComponent" >
  1217. <!-- pick a fieldType to analyze queries -->
  1218. <str name="queryFieldType">string</str>
  1219. <str name="config-file">elevate.xml</str>
  1220. </searchComponent>
  1221. <!-- A request handler for demonstrating the elevator component -->
  1222. <requestHandler name="/elevate" class="solr.SearchHandler" startup="lazy">
  1223. <lst name="defaults">
  1224. <str name="echoParams">explicit</str>
  1225. <str name="df">text</str>
  1226. </lst>
  1227. <arr name="last-components">
  1228. <str>elevator</str>
  1229. </arr>
  1230. </requestHandler>
  1231. <!-- Highlighting Component
  1232. http://wiki.apache.org/solr/HighlightingParameters
  1233. -->
  1234. <searchComponent class="solr.HighlightComponent" name="highlight">
  1235. <highlighting>
  1236. <!-- Configure the standard fragmenter -->
  1237. <!-- This could most likely be commented out in the "default" case -->
  1238. <fragmenter name="gap"
  1239. default="true"
  1240. class="solr.highlight.GapFragmenter">
  1241. <lst name="defaults">
  1242. <int name="hl.fragsize">100</int>
  1243. </lst>
  1244. </fragmenter>
  1245. <!-- A regular-expression-based fragmenter
  1246. (for sentence extraction)
  1247. -->
  1248. <fragmenter name="regex"
  1249. class="solr.highlight.RegexFragmenter">
  1250. <lst name="defaults">
  1251. <!-- slightly smaller fragsizes work better because of slop -->
  1252. <int name="hl.fragsize">70</int>
  1253. <!-- allow 50% slop on fragment sizes -->
  1254. <float name="hl.regex.slop">0.5</float>
  1255. <!-- a basic sentence pattern -->
  1256. <str name="hl.regex.pattern">[-\w ,/\n\"']{20,200}</str>
  1257. </lst>
  1258. </fragmenter>
  1259. <!-- Configure the standard formatter -->
  1260. <formatter name="html"
  1261. default="true"
  1262. class="solr.highlight.HtmlFormatter">
  1263. <lst name="defaults">
  1264. <str name="hl.simple.pre"><![CDATA[<em>]]></str>
  1265. <str name="hl.simple.post"><![CDATA[</em>]]></str>
  1266. </lst>
  1267. </formatter>
  1268. <!-- Configure the standard encoder -->
  1269. <encoder name="html"
  1270. class="solr.highlight.HtmlEncoder" />
  1271. <!-- Configure the standard fragListBuilder -->
  1272. <fragListBuilder name="simple"
  1273. class="solr.highlight.SimpleFragListBuilder"/>
  1274. <!-- Configure the single fragListBuilder -->
  1275. <fragListBuilder name="single"
  1276. class="solr.highlight.SingleFragListBuilder"/>
  1277. <!-- Configure the weighted fragListBuilder -->
  1278. <fragListBuilder name="weighted"
  1279. default="true"
  1280. class="solr.highlight.WeightedFragListBuilder"/>
  1281. <!-- default tag FragmentsBuilder -->
  1282. <fragmentsBuilder name="default"
  1283. default="true"
  1284. class="solr.highlight.ScoreOrderFragmentsBuilder">
  1285. <!--
  1286. <lst name="defaults">
  1287. <str name="hl.multiValuedSeparatorChar">/</str>
  1288. </lst>
  1289. -->
  1290. </fragmentsBuilder>
  1291. <!-- multi-colored tag FragmentsBuilder -->
  1292. <fragmentsBuilder name="colored"
  1293. class="solr.highlight.ScoreOrderFragmentsBuilder">
  1294. <lst name="defaults">
  1295. <str name="hl.tag.pre"><![CDATA[
  1296. <b style="background:yellow">,<b style="background:lawgreen">,
  1297. <b style="background:aquamarine">,<b style="background:magenta">,
  1298. <b style="background:palegreen">,<b style="background:coral">,
  1299. <b style="background:wheat">,<b style="background:khaki">,
  1300. <b style="background:lime">,<b style="background:deepskyblue">]]></str>
  1301. <str name="hl.tag.post"><![CDATA[</b>]]></str>
  1302. </lst>
  1303. </fragmentsBuilder>
  1304. <boundaryScanner name="default"
  1305. default="true"
  1306. class="solr.highlight.SimpleBoundaryScanner">
  1307. <lst name="defaults">
  1308. <str name="hl.bs.maxScan">10</str>
  1309. <str name="hl.bs.chars">.,!?
  1310. </str>
  1311. </lst>
  1312. </boundaryScanner>
  1313. <boundaryScanner name="breakIterator"
  1314. class="solr.highlight.BreakIteratorBoundaryScanner">
  1315. <lst name="defaults">
  1316. <!-- type should be one of CHARACTER, WORD(default), LINE and SENTENCE -->
  1317. <str name="hl.bs.type">WORD</str>
  1318. <!-- language and country are used when constructing Locale object. -->
  1319. <!-- And the Locale object will be used when getting instance of BreakIterator -->
  1320. <str name="hl.bs.language">en</str>
  1321. <str name="hl.bs.country">US</str>
  1322. </lst>
  1323. </boundaryScanner>
  1324. </highlighting>
  1325. </searchComponent>
  1326. <!-- Update Processors
  1327. Chains of Update Processor Factories for dealing with Update
  1328. Requests can be declared, and then used by name in Update
  1329. Request Processors
  1330. http://wiki.apache.org/solr/UpdateRequestProcessor
  1331. -->
  1332. <!-- Deduplication
  1333. An example dedup update processor that creates the "id" field
  1334. on the fly based on the hash code of some other fields. This
  1335. example has overwriteDupes set to false since we are using the
  1336. id field as the signatureField and Solr will maintain
  1337. uniqueness based on that anyway.
  1338. -->
  1339. <!--
  1340. <updateRequestProcessorChain name="dedupe">
  1341. <processor class="solr.processor.SignatureUpdateProcessorFactory">
  1342. <bool name="enabled">true</bool>
  1343. <str name="signatureField">id</str>
  1344. <bool name="overwriteDupes">false</bool>
  1345. <str name="fields">name,features,cat</str>
  1346. <str name="signatureClass">solr.processor.Lookup3Signature</str>
  1347. </processor>
  1348. <processor class="solr.LogUpdateProcessorFactory" />
  1349. <processor class="solr.RunUpdateProcessorFactory" />
  1350. </updateRequestProcessorChain>
  1351. -->
  1352. <!-- Language identification
  1353. This example update chain identifies the language of the incoming
  1354. documents using the langid contrib. The detected language is
  1355. written to field language_s. No field name mapping is done.
  1356. The fields used for detection are text, title, subject and description,
  1357. making this example suitable for detecting languages form full-text
  1358. rich documents injected via ExtractingRequestHandler.
  1359. See more about langId at http://wiki.apache.org/solr/LanguageDetection
  1360. -->
  1361. <!--
  1362. <updateRequestProcessorChain name="langid">
  1363. <processor class="org.apache.solr.update.processor.TikaLanguageIdentifierUpdateProcessorFactory">
  1364. <str name="langid.fl">text,title,subject,description</str>
  1365. <str name="langid.langField">language_s</str>
  1366. <str name="langid.fallback">en</str>
  1367. </processor>
  1368. <processor class="solr.LogUpdateProcessorFactory" />
  1369. <processor class="solr.RunUpdateProcessorFactory" />
  1370. </updateRequestProcessorChain>
  1371. -->
  1372. <!-- Response Writers:
  1373. http://wiki.apache.org/solr/QueryResponseWriter
  1374. Request responses will be written using the writer specified by
  1375. the 'wt' request parameter matching the name of a registered
  1376. writer.
  1377. The "default" writer is the default and will be used if 'wt' is
  1378. not specified in the request.
  1379. -->
  1380. <!-- The following response writers are implicitly configured unless
  1381. overridden...
  1382. -->
  1383. <!--
  1384. <queryResponseWriter name="xml" default="true"
  1385. class="solr.XMLResponseWriter" />
  1386. <queryResponseWriter name="json" class="solr.JSONResponseWriter"/>
  1387. <queryResponseWriter name="python" class="solr.PythonResponseWriter"/>
  1388. <queryResponseWriter name="ruby" class="solr.RubyResponseWriter"/>
  1389. <queryResponseWriter name="php" class="solr.PHPResponseWriter"/>
  1390. <queryResponseWriter name="phps" class="solr.PHPSerializedResponseWriter"/>
  1391. <queryResponseWriter name="csv" class="solr.CSVResponseWriter"/>
  1392. -->
  1393. <queryResponseWriter name="json" class="solr.JSONResponseWriter">
  1394. <!-- For the purposes of the tutorial, JSON responses are written as
  1395. plain text so that they are easy to read in *any* browser.
  1396. If you expect a MIME type of "application/json" just remove this override.
  1397. -->
  1398. <str name="content-type">text/plain; charset=UTF-8</str>
  1399. </queryResponseWriter>
  1400. <!--
  1401. Custom response writers can be declared as needed...
  1402. -->
  1403. <queryResponseWriter name="velocity" class="solr.VelocityResponseWriter" startup="lazy"/>
  1404. <!-- XSLT response writer transforms the XML output by any xslt file found
  1405. in Solr's conf/xslt directory. Changes to xslt files are checked for
  1406. every xsltCacheLifetimeSeconds.
  1407. -->
  1408. <queryResponseWriter name="xslt" class="solr.XSLTResponseWriter">
  1409. <int name="xsltCacheLifetimeSeconds">5</int>
  1410. </queryResponseWriter>
  1411. <!-- Query Parsers
  1412. http://wiki.apache.org/solr/SolrQuerySyntax
  1413. Multiple QParserPlugins can be registered by name, and then
  1414. used in either the "defType" param for the QueryComponent (used
  1415. by SearchHandler) or in LocalParams
  1416. -->
  1417. <!-- example of registering a query parser -->
  1418. <!--
  1419. <queryParser name="myparser" class="com.mycompany.MyQParserPlugin"/>
  1420. -->
  1421. <!-- Function Parsers
  1422. http://wiki.apache.org/solr/FunctionQuery
  1423. Multiple ValueSourceParsers can be registered by name, and then
  1424. used as function names when using the "func" QParser.
  1425. -->
  1426. <!-- example of registering a custom function parser -->
  1427. <!--
  1428. <valueSourceParser name="myfunc"
  1429. class="com.mycompany.MyValueSourceParser" />
  1430. -->
  1431. <!-- Document Transformers
  1432. http://wiki.apache.org/solr/DocTransformers
  1433. -->
  1434. <!--
  1435. Could be something like:
  1436. <transformer name="db" class="com.mycompany.LoadFromDatabaseTransformer" >
  1437. <int name="connection">jdbc://....</int>
  1438. </transformer>
  1439. To add a constant value to all docs, use:
  1440. <transformer name="mytrans2" class="org.apache.solr.response.transform.ValueAugmenterFactory" >
  1441. <int name="value">5</int>
  1442. </transformer>
  1443. If you want the user to still be able to change it with _value:something_ use this:
  1444. <transformer name="mytrans3" class="org.apache.solr.response.transform.ValueAugmenterFactory" >
  1445. <double name="defaultValue">5</double>
  1446. </transformer>
  1447. If you are using the QueryElevationComponent, you may wish to mark documents that get boosted. The
  1448. EditorialMarkerFactory will do exactly that:
  1449. <transformer name="qecBooster" class="org.apache.solr.response.transform.EditorialMarkerFactory" />
  1450. -->
  1451. <!-- Legacy config for the admin interface -->
  1452. <admin>
  1453. <defaultQuery>*:*</defaultQuery>
  1454. </admin>
  1455. </config>

3. Schema.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. http://www.apache.org/licenses/LICENSE-2.0
  10. Unless required by applicable law or agreed to in writing, software
  11. distributed under the License is distributed on an "AS IS" BASIS,
  12. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. See the License for the specific language governing permissions and
  14. limitations under the License.
  15. -->
  16. <!-- //Introduction to the schema.xml file
  17. This is the Solr schema file. This file should be named "schema.xml" and
  18. should be in the conf directory under the solr home
  19. (i.e. ./solr/conf/schema.xml by default)
  20. or located where the classloader for the Solr webapp can find it.
  21. This example schema is the recommended starting point for users.
  22. It should be kept correct and concise, usable out-of-the-box.
  23. For more information, on how to customize this file, please see
  24. http://wiki.apache.org/solr/SchemaXml
  25. PERFORMANCE NOTE: this schema includes many optional features and should not
  26. be used for benchmarking. To improve performance one could
  27. //提高性能的的选项设置
  28. - set stored="false" for all fields possible (esp large fields) when you
  29. only need to search on the field but don't need to return the original
  30. value. //只建索引的field (只索引,不存储)
  31. - set indexed="false" if you don't need to search on the field, but only
  32. return the field as a result of searching on other indexed fields.
  33. //只作为查询结果的返回的(只存储,不索引)
  34. - remove all unneeded copyField statements //去除所有不必要的备份字段(field)
  35. - for best index size and searching performance, set "index" to false
  36. for all general text fields, use copyField to copy them to the
  37. catchall "text" field, and use that for searching.
  38. //对所有的的文本字段(不索引)而是将它们整合到一个文本杂项(cathall field),通过copyField实现
  39. //可以获得最好的索引量(index size)和搜索性能(search performace)
  40. - For maximum indexing performance, use the StreamingUpdateSolrServer
  41. java client.//使用StreamUpdateSolrServer java client 可以获得最优的建索引性能
  42. - Remember to run the JVM in server mode, and use a higher logging level
  43. that avoids logging every request //jvm server mode,logging level的设置
  44. -->
  45. <!-- schema.xml 主要对应的document的字段的相关信息(字段的类型,字段的备份,多值查询)
  46. A document is a collection of fields. 一个文档时相关字段的集合。
  47. schema.xml也是xml文件,而xml文件的一个中dom(document object model),是一种树形文档结构。
  48. 其根节点是schema,两个主要的子节点types、fields (还有 uniqueKey、copyField等)
  49. types节点中,通过solr中推过的java类,定义类型(type),该type将作为命名field的类型;
  50. fields中定义field,这些fields是solr为文档建index的依据,也是solr查询的依据;
  51. 可以为文档类型(TextField)的field提供Ananlyzer(分析器),
  52. 一个Analyzer是由一个个Tokenizer(分词器) 和多个TokenFilter(过滤器)组成;
  53. 可以为TextField类型的Field的index 和 search 提供不同的Analyzer;
  54. -->
  55. <schema name="example" version="1.5">
  56. <!-- attribute "name" is the name of this schema and is only used for display purposes.
  57. version="x.y" is Solr's version number for the schema syntax and semantics. It should
  58. not normally be changed by applications.
  59. 1.0: multiValued attribute did not exist, all fields are multiValued by nature
  60. 1.1: multiValued attribute introduced, false by default
  61. 1.2: omitTermFreqAndPositions attribute introduced, true by default except for text fields.
  62. 1.3: removed optional field compress feature
  63. 1.4: default auto-phrase (QueryParser feature) to off
  64. 1.5: omitNorms defaults to true for primitive field types (int, float, boolean, string...)
  65. -->
  66. <fields>
  67. <!--field分为两类:
  68. common field: field
  69. dynamic field: dynamicField for wildcard
  70. -->
  71. <!-- Valid attributes for fields:
  72. name: mandatory - the name for the field
  73. type: mandatory - the name of a field type from the
  74. <types> fieldType section
  75. indexed: true if this field should be indexed (searchable or sortable)
  76. stored: true if this field should be retrievable
  77. multiValued: true if this field may contain multiple values per document
  78. omitNorms: (expert) set to true to omit the norms associated with
  79. this field (this disables length normalization and index-time
  80. boosting for the field, and saves some memory). Only full-text
  81. fields or fields that need an index-time boost need norms.
  82. Norms are omitted for primitive (non-analyzed) types by default.
  83. termVectors: [false] set to true to store the term vector for a
  84. given field.
  85. When using MoreLikeThis, fields used for similarity should be
  86. stored for best performance.
  87. termPositions: Store position information with the term vector.
  88. This will increase storage costs.
  89. termOffsets: Store offset information with the term vector. This
  90. will increase storage costs.
  91. required: The field is required. It will throw an error if the
  92. value does not exist
  93. default: a value that should be used if no value is specified
  94. when adding a document.
  95. -->
  96. <!-- field names should consist of alphanumeric or underscore characters only and
  97. not start with a digit. This is not currently strictly enforced,
  98. but other field names will not have first class support from all components
  99. and back compatibility is not guaranteed. Names with both leading and
  100. trailing underscores (e.g. _version_) are reserved.
  101. -->
  102. <field name="id" type="string" indexed="true" stored="true" required="true" />
  103. <field name="sku" type="text_en_splitting_tight" indexed="true" stored="true" omitNorms="true"/>
  104. <field name="name" type="text_general" indexed="true" stored="true"/>
  105. <field name="manu" type="text_general" indexed="true" stored="true" omitNorms="true"/>
  106. <field name="cat" type="string" indexed="true" stored="true" multiValued="true"/>
  107. <field name="features" type="text_general" indexed="true" stored="true" multiValued="true"/>
  108. <field name="includes" type="text_general" indexed="true" stored="true" termVectors="true" termPositions="true" termOffsets="true" />
  109. <field name="weight" type="float" indexed="true" stored="true"/>
  110. <field name="price" type="float" indexed="true" stored="true"/>
  111. <field name="popularity" type="int" indexed="true" stored="true" />
  112. <field name="inStock" type="boolean" indexed="true" stored="true" />
  113. <field name="store" type="location" indexed="true" stored="true"/>
  114. <!-- Common metadata fields, named specifically to match up with
  115. SolrCell metadata when parsing rich documents such as Word, PDF.
  116. Some fields are multiValued only because Tika currently may return
  117. multiple values for them.
  118. -->
  119. <field name="title" type="text_general" indexed="true" stored="true" multiValued="true"/>
  120. <field name="subject" type="text_general" indexed="true" stored="true"/>
  121. <field name="description" type="text_general" indexed="true" stored="true"/>
  122. <field name="comments" type="text_general" indexed="true" stored="true"/>
  123. <field name="author" type="text_general" indexed="true" stored="true"/>
  124. <field name="keywords" type="text_general" indexed="true" stored="true"/>
  125. <field name="category" type="text_general" indexed="true" stored="true"/>
  126. <field name="content_type" type="string" indexed="true" stored="true" multiValued="true"/>
  127. <field name="last_modified" type="date" indexed="true" stored="true"/>
  128. <field name="links" type="string" indexed="true" stored="true" multiValued="true"/>
  129. <!-- catchall field, containing all other searchable text fields (implemented
  130. via copyField further on in this schema -->
  131. <field name="text" type="text_general" indexed="true" stored="false" multiValued="true"/>
  132. <!-- catchall text field that indexes tokens both normally and in reverse for efficient
  133. leading wildcard queries. -->
  134. <field name="text_rev" type="text_general_rev" indexed="true" stored="false" multiValued="true"/>
  135. <!-- non-tokenized version of manufacturer to make it easier to sort or group
  136. results by manufacturer. copied from "manu" via copyField -->
  137. <field name="manu_exact" type="string" indexed="true" stored="false"/>
  138. <field name="payloads" type="payloads" indexed="true" stored="true"/>
  139. <field name="_version_" type="long" indexed="true" stored="true"/>
  140. <!-- Uncommenting the following will create a "timestamp" field using
  141. a default value of "NOW" to indicate when each document was indexed.
  142. -->
  143. <!--
  144. <field name="timestamp" type="date" indexed="true" stored="true" default="NOW" multiValued="false"/>
  145. -->
  146. <!-- Dynamic field definitions allow using convention over configuration
  147. for fields via the specification of patterns to match field names.
  148. EXAMPLE: name="*_i" will match any field ending in _i (like myid_i, z_i)
  149. RESTRICTION: the glob-like pattern in the name attribute must have
  150. a "*" only at the start or the end. -->
  151. <dynamicField name="*_i" type="int" indexed="true" stored="true"/>
  152. <dynamicField name="*_is" type="int" indexed="true" stored="true" multiValued="true"/>
  153. <dynamicField name="*_s" type="string" indexed="true" stored="true" />
  154. <dynamicField name="*_ss" type="string" indexed="true" stored="true" multiValued="true"/>
  155. <dynamicField name="*_l" type="long" indexed="true" stored="true"/>
  156. <dynamicField name="*_ls" type="long" indexed="true" stored="true" multiValued="true"/>
  157. <dynamicField name="*_t" type="text_general" indexed="true" stored="true"/>
  158. <dynamicField name="*_txt" type="text_general" indexed="true" stored="true" multiValued="true"/>
  159. <dynamicField name="*_en" type="text_en" indexed="true" stored="true" multiValued="true"/>
  160. <dynamicField name="*_b" type="boolean" indexed="true" stored="true"/>
  161. <dynamicField name="*_bs" type="boolean" indexed="true" stored="true" multiValued="true"/>
  162. <dynamicField name="*_f" type="float" indexed="true" stored="true"/>
  163. <dynamicField name="*_fs" type="float" indexed="true" stored="true" multiValued="true"/>
  164. <dynamicField name="*_d" type="double" indexed="true" stored="true"/>
  165. <dynamicField name="*_ds" type="double" indexed="true" stored="true" multiValued="true"/>
  166. <!-- Type used to index the lat and lon components for the "location" FieldType -->
  167. <dynamicField name="*_coordinate" type="tdouble" indexed="true" stored="false" />
  168. <dynamicField name="*_dt" type="date" indexed="true" stored="true"/>
  169. <dynamicField name="*_dts" type="date" indexed="true" stored="true" multiValued="true"/>
  170. <dynamicField name="*_p" type="location" indexed="true" stored="true"/>
  171. <!-- some trie-coded dynamic fields for faster range queries -->
  172. <dynamicField name="*_ti" type="tint" indexed="true" stored="true"/>
  173. <dynamicField name="*_tl" type="tlong" indexed="true" stored="true"/>
  174. <dynamicField name="*_tf" type="tfloat" indexed="true" stored="true"/>
  175. <dynamicField name="*_td" type="tdouble" indexed="true" stored="true"/>
  176. <dynamicField name="*_tdt" type="tdate" indexed="true" stored="true"/>
  177. <dynamicField name="*_pi" type="pint" indexed="true" stored="true"/>
  178. <dynamicField name="*_c" type="currency" indexed="true" stored="true"/>
  179. <dynamicField name="ignored_*" type="ignored" multiValued="true"/>
  180. <dynamicField name="attr_*" type="text_general" indexed="true" stored="true" multiValued="true"/>
  181. <dynamicField name="random_*" type="random" />
  182. <!-- uncomment the following to ignore any fields that don't already match an existing
  183. field name or dynamic field, rather than reporting them as an error.
  184. alternately, change the type="ignored" to some other type e.g. "text" if you want
  185. unknown fields indexed and/or stored by default -->
  186. <!--dynamicField name="*" type="ignored" multiValued="true" /-->
  187. </fields>
  188. <!-- //uiquekey:唯一键:id
  189. Field to use to determine and enforce document uniqueness.
  190. Unless this field is marked with required="false", it will be a required field
  191. -->
  192. <uniqueKey>id</uniqueKey>
  193. <!-- //default search Field 默认的搜索字段
  194. DEPRECATED: The defaultSearchField is consulted by various query parsers when
  195. parsing a query string that isn't explicit about the field. Machine (non-user)
  196. generated queries are best made explicit, or they can use the "df" request parameter
  197. which takes precedence over this.
  198. Note: Un-commenting defaultSearchField will be insufficient if your request handler
  199. in solrconfig.xml defines "df", which takes precedence. That would need to be removed.
  200. <defaultSearchField>text</defaultSearchField> -->
  201. <!-- //默认查询操作关系
  202. DEPRECATED: The defaultOperator (AND|OR) is consulted by various query parsers
  203. when parsing a query string to determine if a clause of the query should be marked as
  204. required or optional, assuming the clause isn't already marked by some operator.
  205. The default is OR, which is generally assumed so it is not a good idea to change it
  206. globally here. The "q.op" request parameter takes precedence over this.
  207. <solrQueryParser defaultOperator="OR"/> -->
  208. <!-- 通过copyField可以实现同一个字段的多个索引和备份,或者将多个字段整合为一个杂项字段
  209. 尤其是多个textField
  210. copyField commands copy one field to another at the time a document
  211. is added to the index. It's used either to index the same field differently,
  212. or to add multiple fields to the same field for easier/faster searching. -->
  213. <copyField source="cat" dest="text"/>
  214. <copyField source="name" dest="text"/>
  215. <copyField source="manu" dest="text"/>
  216. <copyField source="features" dest="text"/>
  217. <copyField source="includes" dest="text"/>
  218. <copyField source="manu" dest="manu_exact"/>
  219. <!-- Copy the price into a currency enabled field (default USD) -->
  220. <copyField source="price" dest="price_c"/>
  221. <!-- Above, multiple source fields are copied to the [text] field.
  222. Another way to map multiple source fields to the same
  223. destination field is to use the dynamic field syntax.
  224. copyField also supports a maxChars to copy setting. -->
  225. <!-- <copyField source="*_t" dest="text" maxChars="3000"/> -->
  226. <!-- copy name to alphaNameSort, a field designed for sorting by name -->
  227. <!-- <copyField source="name" dest="alphaNameSort"/> -->
  228. <!-- // for score
  229. Similarity is the scoring routine for each document vs. a query.
  230. A custom similarity may be specified here, but the default is fine
  231. for most applications. -->
  232. <!-- <similarity class="org.apache.lucene.search.similarities.DefaultSimilarity"/> -->
  233. <!-- ... OR ...
  234. Specify a SimilarityFactory class name implementation
  235. allowing parameters to be used.
  236. -->
  237. <!--
  238. <similarity class="com.example.solr.CustomSimilarityFactory">
  239. <str name="paramkey">param value</str>
  240. </similarity>
  241. -->
  242. <types>
  243. <!-- field type definitions. The "name" attribute is
  244. just a label to be used by field definitions. The "class"
  245. attribute and any other attributes determine the real
  246. behavior of the fieldType.
  247. //field type 定义
  248. //简写说明
  249. Class names starting with "solr" refer to java classes in a
  250. standard package such as org.apache.solr.analysis
  251. -->
  252. <!--//strField 不经过分析(analyzed),但是进行逐字的 indexed/stored
  253. The StrField type is not analyzed, but indexed/stored verbatim.
  254. sortMissingLast = true: 当用该字段类型的字段排序文档时,
  255. 没有改字段的文档排在所有具有该字段的文档后面
  256. -->
  257. <fieldType name="string" class="solr.StrField" sortMissingLast="true" />
  258. <!-- boolean type: "true" or "false" -->
  259. <fieldType name="boolean" class="solr.BoolField" sortMissingLast="true"/>
  260. <!-- sortMissingLast and sortMissingFirst attributes are optional attributes are
  261. currently supported on types that are sorted internally as strings
  262. and on numeric types.
  263. This includes "string","boolean", and, as of 3.5 (and 4.x),
  264. int, float, long, date, double, including the "Trie" variants.
  265. - If sortMissingLast="true", then a sort on this field will cause documents
  266. without the field to come after documents with the field,
  267. regardless of the requested sort order (asc or desc).
  268. - If sortMissingFirst="true", then a sort on this field will cause documents
  269. without the field to come before documents with the field,
  270. regardless of the requested sort order.
  271. //默认的排序方式:将空认为最小
  272. - If sortMissingLast="false" and sortMissingFirst="false" (the default),
  273. then default lucene sorting will be used which places docs without the
  274. field first in an ascending sort and last in a descending sort.
  275. -->
  276. <!--
  277. //默认的数值字段类型
  278. Default numeric field types.
  279. //为了获得更快的区间查询,可以考虑使用数值类型对应Trie类型
  280. (可以对Trie这种数据结构了解一下,前缀树)节点的所有孩子节点具有相同的前缀
  281. For faster range queries, consider the tint/tfloat/tlong/tdouble types.
  282. -->
  283. <fieldType name="int" class="solr.TrieIntField" precisionStep="0" positionIncrementGap="0"/>
  284. <fieldType name="float" class="solr.TrieFloatField" precisionStep="0" positionIncrementGap="0"/>
  285. <fieldType name="long" class="solr.TrieLongField" precisionStep="0" positionIncrementGap="0"/>
  286. <fieldType name="double" class="solr.TrieDoubleField" precisionStep="0" positionIncrementGap="0"/>
  287. <!--
  288. //数值字段类型的index精度也将影响区间查询的性能,
  289. Numeric field types that index each value at various levels of precision
  290. to accelerate range queries when the number of values between the range
  291. endpoints is large. See the javadoc for NumericRangeQuery for internal
  292. implementation details.
  293. Smaller precisionStep values (specified in bits) will lead to more tokens
  294. indexed per value, slightly larger index size, and faster range queries.
  295. A precisionStep of 0 disables indexing at different precision levels.
  296. -->
  297. <fieldType name="tint" class="solr.TrieIntField" precisionStep="8" positionIncrementGap="0"/>
  298. <fieldType name="tfloat" class="solr.TrieFloatField" precisionStep="8" positionIncrementGap="0"/>
  299. <fieldType name="tlong" class="solr.TrieLongField" precisionStep="8" positionIncrementGap="0"/>
  300. <fieldType name="tdouble" class="solr.TrieDoubleField" precisionStep="8" positionIncrementGap="0"/>
  301. <!-- Date 日期类型
  302. The format for this date field is of the form 1995-12-31T23:59:59Z, and
  303. is a more restricted form of the canonical representation of dateTime
  304. http://www.w3.org/TR/xmlschema-2/#dateTime
  305. The trailing "Z" designates UTC time and is mandatory.
  306. Optional fractional seconds are allowed: 1995-12-31T23:59:59.999Z
  307. All other components are mandatory.
  308. Expressions can also be used to denote calculations that should be
  309. performed relative to "NOW" to determine the value, ie...
  310. NOW/HOUR
  311. ... Round to the start of the current hour
  312. NOW-1DAY
  313. ... Exactly 1 day prior to now
  314. NOW/DAY+6MONTHS+3DAYS
  315. ... 6 months and 3 days in the future from the start of
  316. the current day
  317. Consult the DateField javadocs for more information.
  318. Note: For faster range queries, consider the tdate type
  319. -->
  320. <fieldType name="date" class="solr.TrieDateField" precisionStep="0" positionIncrementGap="0"/>
  321. <!-- A Trie based date field for faster date range queries and date faceting. -->
  322. <fieldType name="tdate" class="solr.TrieDateField" precisionStep="6" positionIncrementGap="0"/>
  323. <!--
  324. //二进制类型 :Base64(a-zA-Z0-9+-)=
  325. Binary data type. The data should be sent/retrieved in as Base64 encoded Strings -->
  326. <fieldtype name="binary" class="solr.BinaryField"/>
  327. <!--
  328. //plain numeric field
  329. Note:
  330. These should only be used for compatibility with existing indexes (created with lucene or older Solr versions).
  331. Use Trie based fields instead. As of Solr 3.5 and 4.x, Trie based fields support sortMissingFirst/Last
  332. Plain numeric field types that store and index the text
  333. value verbatim (and hence don't correctly support range queries, since the
  334. lexicographic ordering isn't equal to the numeric ordering)
  335. -->
  336. <fieldType name="pint" class="solr.IntField"/>
  337. <fieldType name="plong" class="solr.LongField"/>
  338. <fieldType name="pfloat" class="solr.FloatField"/>
  339. <fieldType name="pdouble" class="solr.DoubleField"/>
  340. <fieldType name="pdate" class="solr.DateField" sortMissingLast="true"/>
  341. <!-- //RandomSortField
  342. The "RandomSortField" is not used to store or search any
  343. data. You can declare fields of this type it in your schema
  344. to generate pseudo-random orderings of your docs for sorting
  345. or function purposes. The ordering is generated based on the field
  346. name and the version of the index. As long as the index version
  347. remains unchanged, and the same field name is reused,
  348. the ordering of the docs will be consistent.
  349. If you want different psuedo-random orderings of documents,
  350. for the same version of the index, use a dynamicField and
  351. change the field name in the request.
  352. -->
  353. <fieldType name="random" class="solr.RandomSortField" indexed="true" />
  354. <!-- //TextField Type:k可以在相应的文本类型中添加自己的Analyzer
  355. solr.TextField allows the specification of custom text analyzers
  356. specified as a tokenizer and a list of token filters. Different
  357. analyzers may be specified for indexing and querying.
  358. The optional positionIncrementGap puts space between multiple fields of
  359. this type on the same document, with the purpose of preventing false phrase
  360. matching across fields.
  361. For more info on customizing your analyzer chain, please see
  362. http://wiki.apache.org/solr/AnalyzersTokenizersTokenFilters
  363. -->
  364. <!-- One can also specify an existing Analyzer class that has a
  365. default constructor via the class attribute on the analyzer element.
  366. Example:
  367. <fieldType name="text_greek" class="solr.TextField">
  368. <analyzer class="org.apache.lucene.analysis.el.GreekAnalyzer"/>
  369. </fieldType>
  370. -->
  371. <!-- //whitespace
  372. A text field that only splits on whitespace for exact matching of words -->
  373. <fieldType name="text_ws" class="solr.TextField" positionIncrementGap="100">
  374. <analyzer>
  375. <tokenizer class="solr.WhitespaceTokenizerFactory"/>
  376. </analyzer>
  377. </fieldType>
  378. <!-- // text_general
  379. A general text field that has reasonable, generic
  380. cross-language defaults: it tokenizes with StandardTokenizer,
  381. removes stop words from case-insensitive "stopwords.txt"
  382. (empty by default), and down cases. At query time only, it
  383. also applies synonyms. -->
  384. <fieldType name="text_general" class="solr.TextField" positionIncrementGap="100">
  385. <analyzer type="index">
  386. <tokenizer class="solr.StandardTokenizerFactory"/>
  387. <filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords.txt" enablePositionIncrements="true" />
  388. <!-- in this example, we will only use synonyms at query time
  389. <filter class="solr.SynonymFilterFactory" synonyms="index_synonyms.txt" ignoreCase="true" expand="false"/>
  390. -->
  391. <filter class="solr.LowerCaseFilterFactory"/>
  392. </analyzer>
  393. <analyzer type="query">
  394. <tokenizer class="solr.StandardTokenizerFactory"/>
  395. <filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords.txt" enablePositionIncrements="true" />
  396. <filter class="solr.SynonymFilterFactory" synonyms="synonyms.txt" ignoreCase="true" expand="true"/>
  397. <filter class="solr.LowerCaseFilterFactory"/>
  398. </analyzer>
  399. </fieldType>
  400. <!-- //text_english
  401. A text field with defaults appropriate for English: it
  402. tokenizes with StandardTokenizer, removes English stop words
  403. (lang/stopwords_en.txt), down cases, protects words from protwords.txt, and
  404. finally applies Porter's stemming. The query time analyzer
  405. also applies synonyms from synonyms.txt. -->
  406. <fieldType name="text_en" class="solr.TextField" positionIncrementGap="100">
  407. <analyzer type="index">
  408. <tokenizer class="solr.StandardTokenizerFactory"/>
  409. <!-- in this example, we will only use synonyms at query time
  410. <filter class="solr.SynonymFilterFactory" synonyms="index_synonyms.txt" ignoreCase="true" expand="false"/>
  411. -->
  412. <!-- Case insensitive stop word removal.
  413. add enablePositionIncrements=true in both the index and query
  414. analyzers to leave a 'gap' for more accurate phrase queries.
  415. -->
  416. <filter class="solr.StopFilterFactory"
  417. ignoreCase="true"
  418. words="lang/stopwords_en.txt"
  419. enablePositionIncrements="true"
  420. />
  421. <filter class="solr.LowerCaseFilterFactory"/>
  422. <filter class="solr.EnglishPossessiveFilterFactory"/>
  423. <filter class="solr.KeywordMarkerFilterFactory" protected="protwords.txt"/>
  424. <!-- Optionally you may want to use this less aggressive stemmer instead of PorterStemFilterFactory:
  425. <filter class="solr.EnglishMinimalStemFilterFactory"/>
  426. -->
  427. <filter class="solr.PorterStemFilterFactory"/>
  428. </analyzer>
  429. <analyzer type="query">
  430. <tokenizer class="solr.StandardTokenizerFactory"/>
  431. <filter class="solr.SynonymFilterFactory" synonyms="synonyms.txt" ignoreCase="true" expand="true"/>
  432. <filter class="solr.StopFilterFactory"
  433. ignoreCase="true"
  434. words="lang/stopwords_en.txt"
  435. enablePositionIncrements="true"
  436. />
  437. <filter class="solr.LowerCaseFilterFactory"/>
  438. <filter class="solr.EnglishPossessiveFilterFactory"/>
  439. <filter class="solr.KeywordMarkerFilterFactory" protected="protwords.txt"/>
  440. <!-- Optionally you may want to use this less aggressive stemmer instead of PorterStemFilterFactory:
  441. <filter class="solr.EnglishMinimalStemFilterFactory"/>
  442. -->
  443. <filter class="solr.PorterStemFilterFactory"/>
  444. </analyzer>
  445. </fieldType>
  446. <!-- //text_english
  447. A text field with defaults appropriate for English, plus
  448. aggressive word-splitting and autophrase features enabled.
  449. This field is just like text_en, except it adds
  450. WordDelimiterFilter to enable splitting and matching of
  451. words on case-change, alpha numeric boundaries, and
  452. non-alphanumeric chars. This means certain compound word
  453. cases will work, for example query "wi fi" will match
  454. document "WiFi" or "wi-fi".
  455. -->
  456. <fieldType name="text_en_splitting" class="solr.TextField" positionIncrementGap="100" autoGeneratePhraseQueries="true">
  457. <analyzer type="index">
  458. <tokenizer class="solr.WhitespaceTokenizerFactory"/>
  459. <!-- in this example, we will only use synonyms at query time
  460. <filter class="solr.SynonymFilterFactory" synonyms="index_synonyms.txt" ignoreCase="true" expand="false"/>
  461. -->
  462. <!-- Case insensitive stop word removal.
  463. add enablePositionIncrements=true in both the index and query
  464. analyzers to leave a 'gap' for more accurate phrase queries.
  465. -->
  466. <filter class="solr.StopFilterFactory"
  467. ignoreCase="true"
  468. words="lang/stopwords_en.txt"
  469. enablePositionIncrements="true"
  470. />
  471. <filter class="solr.WordDelimiterFilterFactory" generateWordParts="1" generateNumberParts="1" catenateWords="1" catenateNumbers="1" catenateAll="0" splitOnCaseChange="1"/>
  472. <filter class="solr.LowerCaseFilterFactory"/>
  473. <filter class="solr.KeywordMarkerFilterFactory" protected="protwords.txt"/>
  474. <filter class="solr.PorterStemFilterFactory"/>
  475. </analyzer>
  476. <analyzer type="query">
  477. <tokenizer class="solr.WhitespaceTokenizerFactory"/>
  478. <filter class="solr.SynonymFilterFactory" synonyms="synonyms.txt" ignoreCase="true" expand="true"/>
  479. <filter class="solr.StopFilterFactory"
  480. ignoreCase="true"
  481. words="lang/stopwords_en.txt"
  482. enablePositionIncrements="true"
  483. />
  484. <filter class="solr.WordDelimiterFilterFactory" generateWordParts="1" generateNumberParts="1" catenateWords="0" catenateNumbers="0" catenateAll="0" splitOnCaseChange="1"/>
  485. <filter class="solr.LowerCaseFilterFactory"/>
  486. <filter class="solr.KeywordMarkerFilterFactory" protected="protwords.txt"/>
  487. <filter class="solr.PorterStemFilterFactory"/>
  488. </analyzer>
  489. </fieldType>
  490. <!-- //text_english
  491. Less flexible matching, but less false matches. Probably not ideal for product names,
  492. but may be good for SKUs. Can insert dashes in the wrong place and still match. -->
  493. <fieldType name="text_en_splitting_tight" class="solr.TextField" positionIncrementGap="100" autoGeneratePhraseQueries="true">
  494. <analyzer>
  495. <tokenizer class="solr.WhitespaceTokenizerFactory"/>
  496. <filter class="solr.SynonymFilterFactory" synonyms="synonyms.txt" ignoreCase="true" expand="false"/>
  497. <filter class="solr.StopFilterFactory" ignoreCase="true" words="lang/stopwords_en.txt"/>
  498. <filter class="solr.WordDelimiterFilterFactory" generateWordParts="0" generateNumberParts="0" catenateWords="1" catenateNumbers="1" catenateAll="0"/>
  499. <filter class="solr.LowerCaseFilterFactory"/>
  500. <filter class="solr.KeywordMarkerFilterFactory" protected="protwords.txt"/>
  501. <filter class="solr.EnglishMinimalStemFilterFactory"/>
  502. <!-- this filter can remove any duplicate tokens that appear at the same position - sometimes
  503. possible with WordDelimiterFilter in conjuncton with stemming. -->
  504. <filter class="solr.RemoveDuplicatesTokenFilterFactory"/>
  505. </analyzer>
  506. </fieldType>
  507. <!-- //text_english for wildcard queries
  508. Just like text_general except it reverses the characters of
  509. each token, to enable more efficient leading wildcard queries. -->
  510. <fieldType name="text_general_rev" class="solr.TextField" positionIncrementGap="100">
  511. <analyzer type="index">
  512. <tokenizer class="solr.StandardTokenizerFactory"/>
  513. <filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords.txt" enablePositionIncrements="true" />
  514. <filter class="solr.LowerCaseFilterFactory"/>
  515. <filter class="solr.ReversedWildcardFilterFactory" withOriginal="true"
  516. maxPosAsterisk="3" maxPosQuestion="2" maxFractionAsterisk="0.33"/>
  517. </analyzer>
  518. <analyzer type="query">
  519. <tokenizer class="solr.StandardTokenizerFactory"/>
  520. <filter class="solr.SynonymFilterFactory" synonyms="synonyms.txt" ignoreCase="true" expand="true"/>
  521. <filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords.txt" enablePositionIncrements="true" />
  522. <filter class="solr.LowerCaseFilterFactory"/>
  523. </analyzer>
  524. </fieldType>
  525. <!-- charFilter + WhitespaceTokenizer -->
  526. <!--
  527. <fieldType name="text_char_norm" class="solr.TextField" positionIncrementGap="100" >
  528. <analyzer>
  529. <charFilter class="solr.MappingCharFilterFactory" mapping="mapping-ISOLatin1Accent.txt"/>
  530. <tokenizer class="solr.WhitespaceTokenizerFactory"/>
  531. </analyzer>
  532. </fieldType>
  533. -->
  534. <!-- This is an example of using the KeywordTokenizer along
  535. With various TokenFilterFactories to produce a sortable field
  536. that does not include some properties of the source text
  537. -->
  538. <fieldType name="alphaOnlySort" class="solr.TextField" sortMissingLast="true" omitNorms="true">
  539. <analyzer>
  540. <!-- KeywordTokenizer does no actual tokenizing, so the entire
  541. input string is preserved as a single token
  542. -->
  543. <tokenizer class="solr.KeywordTokenizerFactory"/>
  544. <!-- The LowerCase TokenFilter does what you expect, which can be
  545. when you want your sorting to be case insensitive
  546. -->
  547. <filter class="solr.LowerCaseFilterFactory" />
  548. <!-- The TrimFilter removes any leading or trailing whitespace -->
  549. <filter class="solr.TrimFilterFactory" />
  550. <!-- The PatternReplaceFilter gives you the flexibility to use
  551. Java Regular expression to replace any sequence of characters
  552. matching a pattern with an arbitrary replacement string,
  553. which may include back references to portions of the original
  554. string matched by the pattern.
  555. See the Java Regular Expression documentation for more
  556. information on pattern and replacement string syntax.
  557. http://java.sun.com/j2se/1.6.0/docs/api/java/util/regex/package-summary.html
  558. -->
  559. <filter class="solr.PatternReplaceFilterFactory"
  560. pattern="([^a-z])" replacement="" replace="all"
  561. />
  562. </analyzer>
  563. </fieldType>
  564. <fieldtype name="phonetic" stored="false" indexed="true" class="solr.TextField" >
  565. <analyzer>
  566. <tokenizer class="solr.StandardTokenizerFactory"/>
  567. <filter class="solr.DoubleMetaphoneFilterFactory" inject="false"/>
  568. </analyzer>
  569. </fieldtype>
  570. <fieldtype name="payloads" stored="false" indexed="true" class="solr.TextField" >
  571. <analyzer>
  572. <tokenizer class="solr.WhitespaceTokenizerFactory"/>
  573. <!--
  574. The DelimitedPayloadTokenFilter can put payloads on tokens... for example,
  575. a token of "foo|1.4" would be indexed as "foo" with a payload of 1.4f
  576. Attributes of the DelimitedPayloadTokenFilterFactory :
  577. "delimiter" - a one character delimiter. Default is | (pipe)
  578. "encoder" - how to encode the following value into a playload
  579. float -> org.apache.lucene.analysis.payloads.FloatEncoder,
  580. integer -> o.a.l.a.p.IntegerEncoder
  581. identity -> o.a.l.a.p.IdentityEncoder
  582. Fully Qualified class name implementing PayloadEncoder, Encoder must have a no arg constructor.
  583. -->
  584. <filter class="solr.DelimitedPayloadTokenFilterFactory" encoder="float"/>
  585. </analyzer>
  586. </fieldtype>
  587. <!-- lowercases the entire field value, keeping it as a single token. -->
  588. <fieldType name="lowercase" class="solr.TextField" positionIncrementGap="100">
  589. <analyzer>
  590. <tokenizer class="solr.KeywordTokenizerFactory"/>
  591. <filter class="solr.LowerCaseFilterFactory" />
  592. </analyzer>
  593. </fieldType>
  594. <fieldType name="text_path" class="solr.TextField" positionIncrementGap="100">
  595. <analyzer>
  596. <tokenizer class="solr.PathHierarchyTokenizerFactory"/>
  597. </analyzer>
  598. </fieldType>
  599. <!-- since fields of this type are by default not stored or indexed,
  600. any data added to them will be ignored outright. -->
  601. <fieldtype name="ignored" stored="false" indexed="false" multiValued="true" class="solr.StrField" />
  602. <!-- This point type indexes the coordinates as separate fields (subFields)
  603. If subFieldType is defined, it references a type, and a dynamic field
  604. definition is created matching *___<typename>. Alternately, if
  605. subFieldSuffix is defined, that is used to create the subFields.
  606. Example: if subFieldType="double", then the coordinates would be
  607. indexed in fields myloc_0___double,myloc_1___double.
  608. Example: if subFieldSuffix="_d" then the coordinates would be indexed
  609. in fields myloc_0_d,myloc_1_d
  610. The subFields are an implementation detail of the fieldType, and end
  611. users normally should not need to know about them.
  612. -->
  613. <fieldType name="point" class="solr.PointType" dimension="2" subFieldSuffix="_d"/>
  614. <!-- A specialized field for geospatial search. If indexed, this fieldType must not be multivalued. -->
  615. <fieldType name="location" class="solr.LatLonType" subFieldSuffix="_coordinate"/>
  616. <!--
  617. A Geohash is a compact representation of a latitude longitude pair in a single field.
  618. See http://wiki.apache.org/solr/SpatialSearch
  619. -->
  620. <fieldtype name="geohash" class="solr.GeoHashField"/>
  621. <!-- Money/currency field type. See http://wiki.apache.org/solr/MoneyFieldType
  622. Parameters:
  623. defaultCurrency: Specifies the default currency if none specified. Defaults to "USD"
  624. precisionStep: Specifies the precisionStep for the TrieLong field used for the amount
  625. providerClass: Lets you plug in other exchange provider backend:
  626. solr.FileExchangeRateProvider is the default and takes one parameter:
  627. currencyConfig: name of an xml file holding exhange rates
  628. solr.OpenExchangeRatesOrgProvider uses rates from openexchangerates.org:
  629. ratesFileLocation: URL or path to rates JSON file (default latest.json on the web)
  630. refreshInterval: Number of minutes between each rates fetch (default: 1440, min: 60)
  631. -->
  632. <fieldType name="currency" class="solr.CurrencyField" precisionStep="8" defaultCurrency="USD" currencyConfig="currency.xml" />
  633. <!-- some examples for different languages (generally ordered by ISO code) -->
  634. <!-- Arabic -->
  635. <fieldType name="text_ar" class="solr.TextField" positionIncrementGap="100">
  636. <analyzer>
  637. <tokenizer class="solr.StandardTokenizerFactory"/>
  638. <!-- for any non-arabic -->
  639. <filter class="solr.LowerCaseFilterFactory"/>
  640. <filter class="solr.StopFilterFactory" ignoreCase="true" words="lang/stopwords_ar.txt" enablePositionIncrements="true"/>
  641. <!-- normalizes ﻯ to ﻱ, etc -->
  642. <filter class="solr.ArabicNormalizationFilterFactory"/>
  643. <filter class="solr.ArabicStemFilterFactory"/>
  644. </analyzer>
  645. </fieldType>
  646. <!-- Bulgarian -->
  647. <fieldType name="text_bg" class="solr.TextField" positionIncrementGap="100">
  648. <analyzer>
  649. <tokenizer class="solr.StandardTokenizerFactory"/>
  650. <filter class="solr.LowerCaseFilterFactory"/>
  651. <filter class="solr.StopFilterFactory" ignoreCase="true" words="lang/stopwords_bg.txt" enablePositionIncrements="true"/>
  652. <filter class="solr.BulgarianStemFilterFactory"/>
  653. </analyzer>
  654. </fieldType>
  655. <!-- Catalan -->
  656. <fieldType name="text_ca" class="solr.TextField" positionIncrementGap="100">
  657. <analyzer>
  658. <tokenizer class="solr.StandardTokenizerFactory"/>
  659. <!-- removes l', etc -->
  660. <filter class="solr.ElisionFilterFactory" ignoreCase="true" articles="lang/contractions_ca.txt"/>
  661. <filter class="solr.LowerCaseFilterFactory"/>
  662. <filter class="solr.StopFilterFactory" ignoreCase="true" words="lang/stopwords_ca.txt" enablePositionIncrements="true"/>
  663. <filter class="solr.SnowballPorterFilterFactory" language="Catalan"/>
  664. </analyzer>
  665. </fieldType>
  666. <!-- CJK bigram (see text_ja for a Japanese configuration using morphological analysis) -->
  667. <fieldType name="text_cjk" class="solr.TextField" positionIncrementGap="100">
  668. <analyzer>
  669. <tokenizer class="solr.StandardTokenizerFactory"/>
  670. <!-- normalize width before bigram, as e.g. half-width dakuten combine -->
  671. <filter class="solr.CJKWidthFilterFactory"/>
  672. <!-- for any non-CJK -->
  673. <filter class="solr.LowerCaseFilterFactory"/>
  674. <filter class="solr.CJKBigramFilterFactory"/>
  675. </analyzer>
  676. </fieldType>
  677. <!-- Czech -->
  678. <fieldType name="text_cz" class="solr.TextField" positionIncrementGap="100">
  679. <analyzer>
  680. <tokenizer class="solr.StandardTokenizerFactory"/>
  681. <filter class="solr.LowerCaseFilterFactory"/>
  682. <filter class="solr.StopFilterFactory" ignoreCase="true" words="lang/stopwords_cz.txt" enablePositionIncrements="true"/>
  683. <filter class="solr.CzechStemFilterFactory"/>
  684. </analyzer>
  685. </fieldType>
  686. <!-- Danish -->
  687. <fieldType name="text_da" class="solr.TextField" positionIncrementGap="100">
  688. <analyzer>
  689. <tokenizer class="solr.StandardTokenizerFactory"/>
  690. <filter class="solr.LowerCaseFilterFactory"/>
  691. <filter class="solr.StopFilterFactory" ignoreCase="true" words="lang/stopwords_da.txt" format="snowball" enablePositionIncrements="true"/>
  692. <filter class="solr.SnowballPorterFilterFactory" language="Danish"/>
  693. </analyzer>
  694. </fieldType>
  695. <!-- German -->
  696. <fieldType name="text_de" class="solr.TextField" positionIncrementGap="100">
  697. <analyzer>
  698. <tokenizer class="solr.StandardTokenizerFactory"/>
  699. <filter class="solr.LowerCaseFilterFactory"/>
  700. <filter class="solr.StopFilterFactory" ignoreCase="true" words="lang/stopwords_de.txt" format="snowball" enablePositionIncrements="true"/>
  701. <filter class="solr.GermanNormalizationFilterFactory"/>
  702. <filter class="solr.GermanLightStemFilterFactory"/>
  703. <!-- less aggressive: <filter class="solr.GermanMinimalStemFilterFactory"/> -->
  704. <!-- more aggressive: <filter class="solr.SnowballPorterFilterFactory" language="German2"/> -->
  705. </analyzer>
  706. </fieldType>
  707. <!-- Greek -->
  708. <fieldType name="text_el" class="solr.TextField" positionIncrementGap="100">
  709. <analyzer>
  710. <tokenizer class="solr.StandardTokenizerFactory"/>
  711. <!-- greek specific lowercase for sigma -->
  712. <filter class="solr.GreekLowerCaseFilterFactory"/>
  713. <filter class="solr.StopFilterFactory" ignoreCase="false" words="lang/stopwords_el.txt" enablePositionIncrements="true"/>
  714. <filter class="solr.GreekStemFilterFactory"/>
  715. </analyzer>
  716. </fieldType>
  717. <!-- Spanish -->
  718. <fieldType name="text_es" class="solr.TextField" positionIncrementGap="100">
  719. <analyzer>
  720. <tokenizer class="solr.StandardTokenizerFactory"/>
  721. <filter class="solr.LowerCaseFilterFactory"/>
  722. <filter class="solr.StopFilterFactory" ignoreCase="true" words="lang/stopwords_es.txt" format="snowball" enablePositionIncrements="true"/>
  723. <filter class="solr.SpanishLightStemFilterFactory"/>
  724. <!-- more aggressive: <filter class="solr.SnowballPorterFilterFactory" language="Spanish"/> -->
  725. </analyzer>
  726. </fieldType>
  727. <!-- Basque -->
  728. <fieldType name="text_eu" class="solr.TextField" positionIncrementGap="100">
  729. <analyzer>
  730. <tokenizer class="solr.StandardTokenizerFactory"/>
  731. <filter class="solr.LowerCaseFilterFactory"/>
  732. <filter class="solr.StopFilterFactory" ignoreCase="true" words="lang/stopwords_eu.txt" enablePositionIncrements="true"/>
  733. <filter class="solr.SnowballPorterFilterFactory" language="Basque"/>
  734. </analyzer>
  735. </fieldType>
  736. <!-- Persian -->
  737. <fieldType name="text_fa" class="solr.TextField" positionIncrementGap="100">
  738. <analyzer>
  739. <!-- for ZWNJ -->
  740. <charFilter class="solr.PersianCharFilterFactory"/>
  741. <tokenizer class="solr.StandardTokenizerFactory"/>
  742. <filter class="solr.LowerCaseFilterFactory"/>
  743. <filter class="solr.ArabicNormalizationFilterFactory"/>
  744. <filter class="solr.PersianNormalizationFilterFactory"/>
  745. <filter class="solr.StopFilterFactory" ignoreCase="true" words="lang/stopwords_fa.txt" enablePositionIncrements="true"/>
  746. </analyzer>
  747. </fieldType>
  748. <!-- Finnish -->
  749. <fieldType name="text_fi" class="solr.TextField" positionIncrementGap="100">
  750. <analyzer>
  751. <tokenizer class="solr.StandardTokenizerFactory"/>
  752. <filter class="solr.LowerCaseFilterFactory"/>
  753. <filter class="solr.StopFilterFactory" ignoreCase="true" words="lang/stopwords_fi.txt" format="snowball" enablePositionIncrements="true"/>
  754. <filter class="solr.SnowballPorterFilterFactory" language="Finnish"/>
  755. <!-- less aggressive: <filter class="solr.FinnishLightStemFilterFactory"/> -->
  756. </analyzer>
  757. </fieldType>
  758. <!-- French -->
  759. <fieldType name="text_fr" class="solr.TextField" positionIncrementGap="100">
  760. <analyzer>
  761. <tokenizer class="solr.StandardTokenizerFactory"/>
  762. <!-- removes l', etc -->
  763. <filter class="solr.ElisionFilterFactory" ignoreCase="true" articles="lang/contractions_fr.txt"/>
  764. <filter class="solr.LowerCaseFilterFactory"/>
  765. <filter class="solr.StopFilterFactory" ignoreCase="true" words="lang/stopwords_fr.txt" format="snowball" enablePositionIncrements="true"/>
  766. <filter class="solr.FrenchLightStemFilterFactory"/>
  767. <!-- less aggressive: <filter class="solr.FrenchMinimalStemFilterFactory"/> -->
  768. <!-- more aggressive: <filter class="solr.SnowballPorterFilterFactory" language="French"/> -->
  769. </analyzer>
  770. </fieldType>
  771. <!-- Irish -->
  772. <fieldType name="text_ga" class="solr.TextField" positionIncrementGap="100">
  773. <analyzer>
  774. <tokenizer class="solr.StandardTokenizerFactory"/>
  775. <!-- removes d', etc -->
  776. <filter class="solr.ElisionFilterFactory" ignoreCase="true" articles="lang/contractions_ga.txt"/>
  777. <!-- removes n-, etc. position increments is intentionally false! -->
  778. <filter class="solr.StopFilterFactory" ignoreCase="true" words="lang/hyphenations_ga.txt" enablePositionIncrements="false"/>
  779. <filter class="solr.IrishLowerCaseFilterFactory"/>
  780. <filter class="solr.StopFilterFactory" ignoreCase="true" words="lang/stopwords_ga.txt" enablePositionIncrements="true"/>
  781. <filter class="solr.SnowballPorterFilterFactory" language="Irish"/>
  782. </analyzer>
  783. </fieldType>
  784. <!-- Galician -->
  785. <fieldType name="text_gl" class="solr.TextField" positionIncrementGap="100">
  786. <analyzer>
  787. <tokenizer class="solr.StandardTokenizerFactory"/>
  788. <filter class="solr.LowerCaseFilterFactory"/>
  789. <filter class="solr.StopFilterFactory" ignoreCase="true" words="lang/stopwords_gl.txt" enablePositionIncrements="true"/>
  790. <filter class="solr.GalicianStemFilterFactory"/>
  791. <!-- less aggressive: <filter class="solr.GalicianMinimalStemFilterFactory"/> -->
  792. </analyzer>
  793. </fieldType>
  794. <!-- Hindi -->
  795. <fieldType name="text_hi" class="solr.TextField" positionIncrementGap="100">
  796. <analyzer>
  797. <tokenizer class="solr.StandardTokenizerFactory"/>
  798. <filter class="solr.LowerCaseFilterFactory"/>
  799. <!-- normalizes unicode representation -->
  800. <filter class="solr.IndicNormalizationFilterFactory"/>
  801. <!-- normalizes variation in spelling -->
  802. <filter class="solr.HindiNormalizationFilterFactory"/>
  803. <filter class="solr.StopFilterFactory" ignoreCase="true" words="lang/stopwords_hi.txt" enablePositionIncrements="true"/>
  804. <filter class="solr.HindiStemFilterFactory"/>
  805. </analyzer>
  806. </fieldType>
  807. <!-- Hungarian -->
  808. <fieldType name="text_hu" class="solr.TextField" positionIncrementGap="100">
  809. <analyzer>
  810. <tokenizer class="solr.StandardTokenizerFactory"/>
  811. <filter class="solr.LowerCaseFilterFactory"/>
  812. <filter class="solr.StopFilterFactory" ignoreCase="true" words="lang/stopwords_hu.txt" format="snowball" enablePositionIncrements="true"/>
  813. <filter class="solr.SnowballPorterFilterFactory" language="Hungarian"/>
  814. <!-- less aggressive: <filter class="solr.HungarianLightStemFilterFactory"/> -->
  815. </analyzer>
  816. </fieldType>
  817. <!-- Armenian -->
  818. <fieldType name="text_hy" class="solr.TextField" positionIncrementGap="100">
  819. <analyzer>
  820. <tokenizer class="solr.StandardTokenizerFactory"/>
  821. <filter class="solr.LowerCaseFilterFactory"/>
  822. <filter class="solr.StopFilterFactory" ignoreCase="true" words="lang/stopwords_hy.txt" enablePositionIncrements="true"/>
  823. <filter class="solr.SnowballPorterFilterFactory" language="Armenian"/>
  824. </analyzer>
  825. </fieldType>
  826. <!-- Indonesian -->
  827. <fieldType name="text_id" class="solr.TextField" positionIncrementGap="100">
  828. <analyzer>
  829. <tokenizer class="solr.StandardTokenizerFactory"/>
  830. <filter class="solr.LowerCaseFilterFactory"/>
  831. <filter class="solr.StopFilterFactory" ignoreCase="true" words="lang/stopwords_id.txt" enablePositionIncrements="true"/>
  832. <!-- for a less aggressive approach (only inflectional suffixes), set stemDerivational to false -->
  833. <filter class="solr.IndonesianStemFilterFactory" stemDerivational="true"/>
  834. </analyzer>
  835. </fieldType>
  836. <!-- Italian -->
  837. <fieldType name="text_it" class="solr.TextField" positionIncrementGap="100">
  838. <analyzer>
  839. <tokenizer class="solr.StandardTokenizerFactory"/>
  840. <!-- removes l', etc -->
  841. <filter class="solr.ElisionFilterFactory" ignoreCase="true" articles="lang/contractions_it.txt"/>
  842. <filter class="solr.LowerCaseFilterFactory"/>
  843. <filter class="solr.StopFilterFactory" ignoreCase="true" words="lang/stopwords_it.txt" format="snowball" enablePositionIncrements="true"/>
  844. <filter class="solr.ItalianLightStemFilterFactory"/>
  845. <!-- more aggressive: <filter class="solr.SnowballPorterFilterFactory" language="Italian"/> -->
  846. </analyzer>
  847. </fieldType>
  848. <!-- Japanese using morphological analysis (see text_cjk for a configuration using bigramming)
  849. NOTE: If you want to optimize search for precision, use default operator AND in your query
  850. parser config with <solrQueryParser defaultOperator="AND"/> further down in this file. Use
  851. OR if you would like to optimize for recall (default).
  852. -->
  853. <fieldType name="text_ja" class="solr.TextField" positionIncrementGap="100" autoGeneratePhraseQueries="false">
  854. <analyzer>
  855. <!-- Kuromoji Japanese morphological analyzer/tokenizer (JapaneseTokenizer)
  856. Kuromoji has a search mode (default) that does segmentation useful for search. A heuristic
  857. is used to segment compounds into its parts and the compound itself is kept as synonym.
  858. Valid values for attribute mode are:
  859. normal: regular segmentation
  860. search: segmentation useful for search with synonyms compounds (default)
  861. extended: same as search mode, but unigrams unknown words (experimental)
  862. For some applications it might be good to use search mode for indexing and normal mode for
  863. queries to reduce recall and prevent parts of compounds from being matched and highlighted.
  864. Use <analyzer type="index"> and <analyzer type="query"> for this and mode normal in query.
  865. Kuromoji also has a convenient user dictionary feature that allows overriding the statistical
  866. model with your own entries for segmentation, part-of-speech tags and readings without a need
  867. to specify weights. Notice that user dictionaries have not been subject to extensive testing.
  868. User dictionary attributes are:
  869. userDictionary: user dictionary filename
  870. userDictionaryEncoding: user dictionary encoding (default is UTF-8)
  871. See lang/userdict_ja.txt for a sample user dictionary file.
  872. See http://wiki.apache.org/solr/JapaneseLanguageSupport for more on Japanese language support.
  873. -->
  874. <tokenizer class="solr.JapaneseTokenizerFactory" mode="search"/>
  875. <!--<tokenizer class="solr.JapaneseTokenizerFactory" mode="search" userDictionary="lang/userdict_ja.txt"/>-->
  876. <!-- Reduces inflected verbs and adjectives to their base/dictionary forms (辞書形) -->
  877. <filter class="solr.JapaneseBaseFormFilterFactory"/>
  878. <!-- Removes tokens with certain part-of-speech tags -->
  879. <filter class="solr.JapanesePartOfSpeechStopFilterFactory" tags="lang/stoptags_ja.txt" enablePositionIncrements="true"/>
  880. <!-- Normalizes full-width romaji to half-width and half-width kana to full-width (Unicode NFKC subset) -->
  881. <filter class="solr.CJKWidthFilterFactory"/>
  882. <!-- Removes common tokens typically not useful for search, but have a negative effect on ranking -->
  883. <filter class="solr.StopFilterFactory" ignoreCase="true" words="lang/stopwords_ja.txt" enablePositionIncrements="true" />
  884. <!-- Normalizes common katakana spelling variations by removing any last long sound character (U+30FC) -->
  885. <filter class="solr.JapaneseKatakanaStemFilterFactory" minimumLength="4"/>
  886. <!-- Lower-cases romaji characters -->
  887. <filter class="solr.LowerCaseFilterFactory"/>
  888. </analyzer>
  889. </fieldType>
  890. <!-- Latvian -->
  891. <fieldType name="text_lv" class="solr.TextField" positionIncrementGap="100">
  892. <analyzer>
  893. <tokenizer class="solr.StandardTokenizerFactory"/>
  894. <filter class="solr.LowerCaseFilterFactory"/>
  895. <filter class="solr.StopFilterFactory" ignoreCase="true" words="lang/stopwords_lv.txt" enablePositionIncrements="true"/>
  896. <filter class="solr.LatvianStemFilterFactory"/>
  897. </analyzer>
  898. </fieldType>
  899. <!-- Dutch -->
  900. <fieldType name="text_nl" class="solr.TextField" positionIncrementGap="100">
  901. <analyzer>
  902. <tokenizer class="solr.StandardTokenizerFactory"/>
  903. <filter class="solr.LowerCaseFilterFactory"/>
  904. <filter class="solr.StopFilterFactory" ignoreCase="true" words="lang/stopwords_nl.txt" format="snowball" enablePositionIncrements="true"/>
  905. <filter class="solr.StemmerOverrideFilterFactory" dictionary="lang/stemdict_nl.txt" ignoreCase="false"/>
  906. <filter class="solr.SnowballPorterFilterFactory" language="Dutch"/>
  907. </analyzer>
  908. </fieldType>
  909. <!-- Norwegian -->
  910. <fieldType name="text_no" class="solr.TextField" positionIncrementGap="100">
  911. <analyzer>
  912. <tokenizer class="solr.StandardTokenizerFactory"/>
  913. <filter class="solr.LowerCaseFilterFactory"/>
  914. <filter class="solr.StopFilterFactory" ignoreCase="true" words="lang/stopwords_no.txt" format="snowball" enablePositionIncrements="true"/>
  915. <filter class="solr.SnowballPorterFilterFactory" language="Norwegian"/>
  916. <!-- less aggressive: <filter class="solr.NorwegianLightStemFilterFactory"/> -->
  917. <!-- singular/plural: <filter class="solr.NorwegianMinimalStemFilterFactory"/> -->
  918. </analyzer>
  919. </fieldType>
  920. <!-- Portuguese -->
  921. <fieldType name="text_pt" class="solr.TextField" positionIncrementGap="100">
  922. <analyzer>
  923. <tokenizer class="solr.StandardTokenizerFactory"/>
  924. <filter class="solr.LowerCaseFilterFactory"/>
  925. <filter class="solr.StopFilterFactory" ignoreCase="true" words="lang/stopwords_pt.txt" format="snowball" enablePositionIncrements="true"/>
  926. <filter class="solr.PortugueseLightStemFilterFactory"/>
  927. <!-- less aggressive: <filter class="solr.PortugueseMinimalStemFilterFactory"/> -->
  928. <!-- more aggressive: <filter class="solr.SnowballPorterFilterFactory" language="Portuguese"/> -->
  929. <!-- most aggressive: <filter class="solr.PortugueseStemFilterFactory"/> -->
  930. </analyzer>
  931. </fieldType>
  932. <!-- Romanian -->
  933. <fieldType name="text_ro" class="solr.TextField" positionIncrementGap="100">
  934. <analyzer>
  935. <tokenizer class="solr.StandardTokenizerFactory"/>
  936. <filter class="solr.LowerCaseFilterFactory"/>
  937. <filter class="solr.StopFilterFactory" ignoreCase="true" words="lang/stopwords_ro.txt" enablePositionIncrements="true"/>
  938. <filter class="solr.SnowballPorterFilterFactory" language="Romanian"/>
  939. </analyzer>
  940. </fieldType>
  941. <!-- Russian -->
  942. <fieldType name="text_ru" class="solr.TextField" positionIncrementGap="100">
  943. <analyzer>
  944. <tokenizer class="solr.StandardTokenizerFactory"/>
  945. <filter class="solr.LowerCaseFilterFactory"/>
  946. <filter class="solr.StopFilterFactory" ignoreCase="true" words="lang/stopwords_ru.txt" format="snowball" enablePositionIncrements="true"/>
  947. <filter class="solr.SnowballPorterFilterFactory" language="Russian"/>
  948. <!-- less aggressive: <filter class="solr.RussianLightStemFilterFactory"/> -->
  949. </analyzer>
  950. </fieldType>
  951. <!-- Swedish -->
  952. <fieldType name="text_sv" class="solr.TextField" positionIncrementGap="100">
  953. <analyzer>
  954. <tokenizer class="solr.StandardTokenizerFactory"/>
  955. <filter class="solr.LowerCaseFilterFactory"/>
  956. <filter class="solr.StopFilterFactory" ignoreCase="true" words="lang/stopwords_sv.txt" format="snowball" enablePositionIncrements="true"/>
  957. <filter class="solr.SnowballPorterFilterFactory" language="Swedish"/>
  958. <!-- less aggressive: <filter class="solr.SwedishLightStemFilterFactory"/> -->
  959. </analyzer>
  960. </fieldType>
  961. <!-- Thai -->
  962. <fieldType name="text_th" class="solr.TextField" positionIncrementGap="100">
  963. <analyzer>
  964. <tokenizer class="solr.StandardTokenizerFactory"/>
  965. <filter class="solr.LowerCaseFilterFactory"/>
  966. <filter class="solr.ThaiWordFilterFactory"/>
  967. <filter class="solr.StopFilterFactory" ignoreCase="true" words="lang/stopwords_th.txt" enablePositionIncrements="true"/>
  968. </analyzer>
  969. </fieldType>
  970. <!-- Turkish -->
  971. <fieldType name="text_tr" class="solr.TextField" positionIncrementGap="100">
  972. <analyzer>
  973. <tokenizer class="solr.StandardTokenizerFactory"/>
  974. <filter class="solr.TurkishLowerCaseFilterFactory"/>
  975. <filter class="solr.StopFilterFactory" ignoreCase="false" words="lang/stopwords_tr.txt" enablePositionIncrements="true"/>
  976. <filter class="solr.SnowballPorterFilterFactory" language="Turkish"/>
  977. </analyzer>
  978. </fieldType>
  979. </types>
  980. </schema>




声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/weixin_40725706/article/detail/238030
推荐阅读
相关标签
  

闽ICP备14008679号