solrconfig.xml文件包含了大部分的参数用来配置Solr本身的。

Solrconfig.xml代码 
  1. dataDir parameter:<dataDir>/var/data/solr</dataDir>
  2. 用来指定一个替换原先在Solr目录下默认存放所有的索引数据,可以在Solr目录以外的任意目录中。如果复制使用后应该符合该参数。如果这个目录不是绝对路径的话,那么应该以当前的容器为相对路径。
  3. mainIndex :
  4. 这个参数的值用来控制合并多个索引段。
  5. <useCompoundFile>:通过将很多 Lucene 内部文件整合到单一一个文件来减少使用中的文件的数量。这可有助于减少 Solr 使用的文件句柄数目,代价是降低了性能。除非是应用程序用完了文件句柄,否则 false 的默认值应该就已经足够。
  6. mergeFactor:
  7. 决定低水平的 Lucene 段被合并的频率。较小的值(最小为 2)使用的内存较少但导致的索引时间也更慢。较大的值可使索引时间变快但会牺牲较多的内存。
  8. maxBufferedDocs:
  9. 在合并内存中文档和创建新段之前,定义所需索引的最小文档数。段 是用来存储索引信息的 Lucene 文件。较大的值可使索引时间变快但会牺牲较多的内存。
  10. maxMergeDocs:
  11. 控制可由 Solr ,000) 最适合于具有合并的 Document 的最大数。较小的值 (< 10大量更新的应用程序。该参数不允许lucene在任何索引段里包含比这个值更多的文档,但是,多余的文档可以创建一个新的索引段进行替换。
  12. maxFieldLength:
  13. 对于给定的 Document,控制可添加到 Field 的最大条目数,进而截断该文档。如果文档可能会很大,就需要增加这个数值。然而,若将这个值设置得过高会导致内存不足错误。
  14. unlockOnStartup:
  15. unlockOnStartup 告知 Solr 忽略在多线程环境中用来保护索引的锁定机制。在某些情况下,索引可能会由于不正确的关机或其他错误而一直处于锁定,这就妨碍了添加和更新。将其设置为 true 可以禁用启动锁定,进而允许进行添加和更新。
  16. <mainIndex>
  17. <!-- lucene options specific to the main on-disk lucene index -->
  18. <useCompoundFile>false</useCompoundFile>
  19. <mergeFactor>10</mergeFactor>
  20. <maxBufferedDocs>1000</maxBufferedDocs>
  21. <maxMergeDocs>2147483647</maxMergeDocs>
  22. <maxFieldLength>10000</maxFieldLength>
  23. </mainIndex>
  24. updateHandler:
  25. 这个更新处理器主要涉及底层的关于如何更新处理内部的信息。(此参数不能跟高层次的配置参数Request Handlers对处理发自客户端的更新相混淆)。
  26. <updateHandler class="solr.DirectUpdateHandler2">
  27. <!-- Limit the number of deletions Solr will buffer during doc updating.
  28. Setting this lower can help bound memory use during indexing.
  29. -->
  30. 缓冲更新这么多的数目,设置如下比较低的值,可以约束索引时候所用的内存
  31. <maxPendingDeletes>100000</maxPendingDeletes>
  32. 等待文档满足一定的标准后将自动提交,未来版本可以扩展现有的标准
  33. <!-- autocommit pending docs if certain criteria are met.  Future versions may expand the available
  34. criteria -->
  35. <autoCommit>
  36. <maxDocs>10000</maxDocs> <!-- maximum uncommited docs before autocommit triggered -->
  37. 触发自动提交前最多可以等待提交的文档数量
  38. <maxTime>86000</maxTime> <!-- maximum time (in MS) after adding a doc before an autocommit is triggered -->
  39. 在添加了一个文档之后,触发自动提交之前所最大的等待时间
  40. </autoCommit>
  41. 这个参数用来配置执行外部的命令。
  42. 一个postCommit的事件被触发当每一个提交之后
  43. <listener event="postCommit" class="solr.RunExecutableListener">
  44. <str name="exe">snapshooter</str>
  45. <str name="dir">solr/bin</str>
  46. <bool name="wait">true</bool>
  47. <!--
  48. <arr name="args"> <str>arg1</str> <str>arg2</str> </arr>
  49. <arr name="env"> <str>MYVAR=val1</str> </arr>
  50. -->
  51. </listener>
  52. exe--可执行的文件类型
  53. dir--可以用该目录做为当前的工作目录。默认为"."
  54. wait--调用线程要等到可执行的返回值
  55. args--传递给程序的参数 默认nothing
  56. env--环境变量的设置 默认nothing
  57. <query>
  58. <!-- Maximum number of clauses in a boolean query... can affect range
  59. or wildcard queries that expand to big boolean queries.
  60. 一次布尔查询的最大数量,可以影响查询的范围或者进行通配符的查询,借此来扩展一个更强大的查询。
  61. An exception is thrown if exceeded.
  62. -->
  63. <maxBooleanClauses>1024</maxBooleanClauses>
  64. <query>:
  65. 控制跟查询相关的一切东东。
  66. Caching:修改这个参数可以做为索引的增长和变化。
  67. <!-- Cache used by SolrIndexSearcher for filters (DocSets),
  68. unordered sets of *all* documents that match a query.
  69. 在过滤器中过滤文档集合的时候,或者是一个无序的所有的文档集合中将在在SolrIndexSearcher中使用缓存来匹配符合查询的所有文档。
  70. When a new searcher is opened, its caches may be prepopulated
  71. or "autowarmed" using data from caches in the old searcher.
  72. 当一次搜索被打开,它可以自动的或者预先从旧的搜索中使用缓存数据。
  73. autowarmCount is the number of items to prepopulate.
  74. autowarmCount这个值是预先设置的数值项。
  75. For LRUCache,
  76. the autowarmed items will be the most recently accessed items.
  77. 在LRUCache中,这个autowarmed 项中保存的是最近访问的项。
  78. Parameters: 参数选项
  79. class - the SolrCache implementation (currently only LRUCache)实现SolrCache接口的类 当前仅有LRUCache
  80. size - the maximum number of entries in the cache
  81. 在cache中最大的上限值
  82. initialSize - the initial capacity (number of entries) of
  83. the cache.  (seel java.util.HashMap)
  84. 在cache中初始化的数量
  85. autowarmCount - the number of entries to prepopulate from
  86. and old cache.
  87. 从旧的缓存中预先设置的项数。
  88. -->
  89. <filterCache
  90. class="solr.LRUCache"
  91. size="512"
  92. initialSize="512"
  93. autowarmCount="256"/>
  94. <!-- queryResultCache caches results of searches - ordered lists of
  95. document ids (DocList) based on a query, a sort, and the range
  96. of documents requested.  -->
  97. 查询结果缓存
  98. <queryResultCache
  99. class="solr.LRUCache"
  100. size="512"
  101. initialSize="512"
  102. autowarmCount="256"/>
  103. <!-- documentCache caches Lucene Document objects (the stored fields for each document).
  104. documentCache缓存Lucene的文档对象(存储领域的每一个文件)
  105. Since Lucene internal document ids are transient, this cache will not be autowarmed.  -->
  106. 由于Lucene的内部文档ID标识(文档名称)是短暂的,所以这种缓存不会被自动warmed。
  107. <documentCache
  108. class="solr.LRUCache"
  109. size="512"
  110. initialSize="512"
  111. autowarmCount="0"/>
  112. <!-- Example of a generic cache.
  113. 一个通用缓存的列子。
  114. These caches may be accessed by name
  115. through SolrIndexSearcher.getCache().cacheLookup(), and cacheInsert().
  116. 这些缓存可以通过在SolrIndexSearcher.getCache().cacheLookup()和cacheInsert()中利用缓存名称访问得到。
  117. The purpose is to enable easy caching of user/application level data.
  118. 这样做的目的就是很方便的缓存用户级或应用程序级的数据。
  119. The regenerator argument should be specified as an implementation
  120. of solr.search.CacheRegenerator if autowarming is desired.  -->
  121. 这么做的的关键就是应该明确规定实现solr.search.CacheRegenerator接口如果autowarming是比较理想化的设置。
  122. <!--
  123. <cache name="myUserCache"
  124. class="solr.LRUCache"
  125. size="4096"
  126. initialSize="1024"
  127. autowarmCount="1024"
  128. regenerator="org.mycompany.mypackage.MyRegenerator"
  129. />
  130. -->
  131. <!-- An optimization that attempts to use a filter to satisfy a search.
  132. 一种优化方式就是利用一个过滤器,以满足搜索需求。
  133. If the requested sort does not include a score,
  134. 如果请求的不是要求包括得分的类型,filterCache 这种过滤器将检查与过滤器相匹配的结果。如果找到,过滤器将被用来作为文档的来源识别码,并在这个基础上进行排序。
  135. then the filterCache
  136. will be checked for a filter matching the query.  If found, the filter
  137. will be used as the source of document ids, and then the sort will be
  138. applied to that.
  139. -->
  140. <useFilterForSortedQuery>true</useFilterForSortedQuery>
  141. <!-- An optimization for use with the queryResultCache.  When a search
  142. is requested, a superset of the requested number of document ids
  143. are collected.  For example, of a search for a particular query
  144. requests matching documents 10 through 19, and queryWindowSize is 50,
  145. then documents 0 through 50 will be collected and cached. Any further
  146. requests in that range can be satisfied via the cache.
  147. -->
  148. 一种优化用于queryResultCache,当一个搜索被请求,也会收集一定数量的文档ID做为一个超集。举个例子,一个特定的查询请求匹配的文档是10到19,此时,queryWindowSize是50,这样,文档从0到50都会被收集并缓存。这样,任何更多的在这个范围内的请求都会通过缓存来满足查询。
  149. <queryResultWindowSize>50</queryResultWindowSize>
  150. <!-- This entry enables an int hash representation for filters (DocSets)
  151. when the number of items in the set is less than maxSize. For smaller
  152. sets, this representation is more memory efficient, more efficient to
  153. iterate over, and faster to take intersections.
  154. -->
  155. <HashDocSet maxSize="3000" loadFactor="0.75"/>
  156. <!-- boolToFilterOptimizer converts boolean clauses with zero boost
  157. cached filters if the number of docs selected by the clause exceeds the
  158. threshold (represented as a fraction of the total index)
  159. -->
  160. <boolTofilterOptimizer enabled="true" cacheSize="32" threshold=".05"/>
  161. <!-- Lazy field loading will attempt to read only parts of documents on disk that are
  162. requested.  Enabling should be faster if you aren't retrieving all stored fields.
  163. -->
  164. <enableLazyFieldLoading>false</enableLazyFieldLoading>

另一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. 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. -->
  26. <schema name="musicbrainz" version="1.1">
  27. <!-- attribute "name" is the name of this schema and is only used for display purposes.
  28. Applications should change this to reflect the nature of the search collection.
  29. version="1.1" is Solr's version number for the schema syntax and semantics.  It should
  30. not normally be changed by applications.
  31. 1.0: multiValued attribute did not exist, all fields are multiValued by nature
  32. 1.1: multiValued attribute introduced, false by default -->
  33. <types>
  34. <!-- field type definitions. The "name" attribute is
  35. just a label to be used by field definitions.  The "class"
  36. attribute and any other attributes determine the real
  37. behavior of the fieldType.
  38. Class names starting with "solr" refer to java classes in the
  39. org.apache.solr.analysis package.
  40. -->
  41. <!-- The StrField type is not analyzed, but indexed/stored verbatim.
  42. - StrField and TextField support an optional compressThreshold which
  43. limits compression (if enabled in the derived fields) to values which
  44. exceed a certain size (in characters).
  45. name: 字段类型名
  46. class: java类名
  47. indexed:缺省true。 说明这个数据应被搜索和排序,如果数据没有indexed,则stored应是true。
  48. stored: 缺省true。说明这个字段被包含在搜索结果中是合适的。如果数据没有stored,则indexed应是true。
  49. sortMissingLast:指没有该指定字段数据的document排在有该指定字段数据的document的后面
  50. sortMissingFirst:指没有该指定字段数据的document排在有该指定字段数据的document的前面
  51. omitNorms:字段的长度不影响得分和在索引时不做boost时,设置它为true。一般文本字段不设置为true。
  52. termVectors:如果字段被用来做more like this 和highlight的特性时应设置为true。
  53. compressed:字段是压缩的。这可能导致索引和搜索变慢,但会减少存储空间,只有StrField和TextField是可以压缩,这通常适合字段的长度超过200个字符。
  54. multiValued:字段多于一个值的时候,可设置为true。
  55. positionIncrementGap:和multiValued一起使用,设置多个值之间的虚拟空白的数量
  56. -->
  57. <fieldType name="string" class="solr.StrField" sortMissingLast="true" omitNorms="true"/>
  58. <!-- boolean type: "true" or "false" -->
  59. <fieldType name="boolean" class="solr.BoolField" sortMissingLast="true" omitNorms="true"/>
  60. <!-- The optional sortMissingLast and sortMissingFirst attributes are
  61. currently supported on types that are sorted internally as strings.
  62. - If sortMissingLast="true", then a sort on this field will cause documents
  63. without the field to come after documents with the field,
  64. regardless of the requested sort order (asc or desc).
  65. - If sortMissingFirst="true", then a sort on this field will cause documents
  66. without the field to come before documents with the field,
  67. regardless of the requested sort order.
  68. - If sortMissingLast="false" and sortMissingFirst="false" (the default),
  69. then default lucene sorting will be used which places docs without the
  70. field first in an ascending sort and last in a descending sort.
  71. -->
  72. <!-- numeric field types that store and index the text
  73. value verbatim (and hence don't support range queries, since the
  74. lexicographic ordering isn't equal to the numeric ordering) -->
  75. <fieldType name="integer" class="solr.IntField" omitNorms="true"/>
  76. <fieldType name="long" class="solr.LongField" omitNorms="true"/>
  77. <fieldType name="float" class="solr.FloatField" omitNorms="true"/>
  78. <fieldType name="double" class="solr.DoubleField" omitNorms="true"/>
  79. <!-- Numeric field types that manipulate the value into
  80. a string value that isn't human-readable in its internal form,
  81. but with a lexicographic ordering the same as the numeric ordering,
  82. so that range queries work correctly. -->
  83. <fieldType name="sint" class="solr.SortableIntField" sortMissingLast="true" omitNorms="true"/>
  84. <fieldType name="slong" class="solr.SortableLongField" sortMissingLast="true" omitNorms="true"/>
  85. <fieldType name="sfloat" class="solr.SortableFloatField" sortMissingLast="true" omitNorms="true"/>
  86. <fieldType name="sdouble" class="solr.SortableDoubleField" sortMissingLast="true" omitNorms="true"/>
  87. <!-- The format for this date field is of the form 1995-12-31T23:59:59Z, and
  88. is a more restricted form of the canonical representation of dateTime
  89. http://www.w3.org/TR/xmlschema-2/#dateTime
  90. The trailing "Z" designates UTC time and is mandatory.
  91. Optional fractional seconds are allowed: 1995-12-31T23:59:59.999Z
  92. All other components are mandatory.
  93. Expressions can also be used to denote calculations that should be
  94. performed relative to "NOW" to determine the value, ie...
  95. NOW/HOUR
  96. ... Round to the start of the current hour
  97. NOW-1DAY
  98. ... Exactly 1 day prior to now
  99. NOW/DAY+6MONTHS+3DAYS
  100. ... 6 months and 3 days in the future from the start of
  101. the current day
  102. Consult the DateField javadocs for more information.
  103. -->
  104. <fieldType name="date" class="solr.DateField" sortMissingLast="true" omitNorms="true"/>
  105. <!-- The "RandomSortField" is not used to store or search any
  106. data.  You can declare fields of this type it in your schema
  107. to generate psuedo-random orderings of your docs for sorting
  108. purposes.  The ordering is generated based on the field name
  109. and the version of the index, As long as the index version
  110. remains unchanged, and the same field name is reused,
  111. the ordering of the docs will be consistent.
  112. If you want differend psuedo-random orderings of documents,
  113. for the same version of the index, use a dynamicField and
  114. change the name
  115. -->
  116. <fieldType name="random" class="solr.RandomSortField" indexed="true" />
  117. <!-- solr.TextField allows the specification of custom text analyzers
  118. specified as a tokenizer and a list of token filters. Different
  119. analyzers may be specified for indexing and querying.
  120. The optional positionIncrementGap puts space between multiple fields of
  121. this type on the same document, with the purpose of preventing false phrase
  122. matching across fields.
  123. For more info on customizing your analyzer chain, please see
  124. http://wiki.apache.org/solr/AnalyzersTokenizersTokenFilters
  125. -->
  126. <!-- One can also specify an existing Analyzer class that has a
  127. default constructor via the class attribute on the analyzer element
  128. <fieldType name="text_greek" class="solr.TextField">
  129. <analyzer class="org.apache.lucene.analysis.el.GreekAnalyzer"/>
  130. </fieldType>
  131. -->
  132. <!-- A text field that only splits on whitespace for exact matching of words -->
  133. <fieldType name="text_ws" class="solr.TextField" positionIncrementGap="100">
  134. <analyzer>
  135. <tokenizer class="solr.WhitespaceTokenizerFactory"/>
  136. </analyzer>
  137. </fieldType>
  138. <!-- A text field that uses WordDelimiterFilter to enable splitting and matching of
  139. words on case-change, alpha numeric boundaries, and non-alphanumeric chars,
  140. so that a query of "wifi" or "wi fi" could match a document containing "Wi-Fi".
  141. Synonyms and stopwords are customized by external files, and stemming is enabled.
  142. Duplicate tokens at the same position (which may result from Stemmed Synonyms or
  143. WordDelim parts) are removed.
  144. -->
  145. <fieldType name="text" class="solr.TextField" positionIncrementGap="100">
  146. <analyzer type="index">
  147. <tokenizer class="solr.WhitespaceTokenizerFactory"/>
  148. <!-- in this example, we will only use synonyms at query time
  149. <filter class="solr.SynonymFilterFactory" synonyms="index_synonyms.txt" ignoreCase="true" expand="false"/>
  150. -->
  151. <!-- Case insensitive stop word removal.
  152. enablePositionIncrements=true ensures that a 'gap' is left to
  153. allow for accurate phrase queries.
  154. -->
  155. <filter class="solr.StopFilterFactory"
  156. ignoreCase="true"
  157. words="stopwords.txt"
  158. enablePositionIncrements="true"
  159. />
  160. <filter class="solr.WordDelimiterFilterFactory" generateWordParts="1" generateNumberParts="1" catenateWords="1" catenateNumbers="1" catenateAll="0" splitOnCaseChange="1"/>
  161. <filter class="solr.LowerCaseFilterFactory"/>
  162. <filter class="solr.EnglishPorterFilterFactory" protected="protwords.txt"/>
  163. <filter class="solr.RemoveDuplicatesTokenFilterFactory"/>
  164. </analyzer>
  165. <analyzer type="query">
  166. <tokenizer class="solr.WhitespaceTokenizerFactory"/>
  167. <filter class="solr.SynonymFilterFactory" synonyms="synonyms.txt" ignoreCase="true" expand="true"/>
  168. <filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords.txt"/>
  169. <filter class="solr.WordDelimiterFilterFactory" generateWordParts="1" generateNumberParts="1" catenateWords="0" catenateNumbers="0" catenateAll="0" splitOnCaseChange="1"/>
  170. <filter class="solr.LowerCaseFilterFactory"/>
  171. <filter class="solr.EnglishPorterFilterFactory" protected="protwords.txt"/>
  172. <filter class="solr.RemoveDuplicatesTokenFilterFactory"/>
  173. </analyzer>
  174. </fieldType>
  175. <!-- Less flexible matching, but less false matches.  Probably not ideal for product names,
  176. but may be good for SKUs.  Can insert dashes in the wrong place and still match. -->
  177. <fieldType name="textTight" class="solr.TextField" positionIncrementGap="100" >
  178. <analyzer>
  179. <tokenizer class="solr.WhitespaceTokenizerFactory"/>
  180. <filter class="solr.SynonymFilterFactory" synonyms="synonyms.txt" ignoreCase="true" expand="false"/>
  181. <filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords.txt"/>
  182. <filter class="solr.WordDelimiterFilterFactory" generateWordParts="0" generateNumberParts="0" catenateWords="1" catenateNumbers="1" catenateAll="0"/>
  183. <filter class="solr.LowerCaseFilterFactory"/>
  184. <filter class="solr.EnglishPorterFilterFactory" protected="protwords.txt"/>
  185. <filter class="solr.RemoveDuplicatesTokenFilterFactory"/>
  186. </analyzer>
  187. </fieldType>
  188. <!-- MusicBrainz names for things -->
  189. <fieldType name="title" class="solr.TextField" positionIncrementGap="100" >
  190. <analyzer>
  191. <tokenizer class="solr.WhitespaceTokenizerFactory"/>
  192. <!-- <filter class="solr.SynonymFilterFactory" synonyms="synonyms.txt" ignoreCase="true" expand="false"/> -->
  193. <filter class="solr.WordDelimiterFilterFactory" generateWordParts="0" generateNumberParts="0" catenateWords="1" catenateNumbers="1" catenateAll="0"/>
  194. <filter class="solr.LowerCaseFilterFactory"/>
  195. <!-- <filter class="solr.EnglishPorterFilterFactory" protected="protwords.txt"/> -->
  196. <filter class="solr.RemoveDuplicatesTokenFilterFactory"/>
  197. </analyzer>
  198. </fieldType>
  199. <!--
  200. Setup simple analysis for spell checking
  201. <fieldType name="textSpell" class="solr.TextField" positionIncrementGap="100" stored="false" >
  202. <analyzer>
  203. <tokenizer class="solr.StandardTokenizerFactory"/>
  204. <filter class="solr.LowerCaseFilterFactory"/>
  205. <filter class="solr.RemoveDuplicatesTokenFilterFactory"/>
  206. </analyzer>
  207. </fieldType>
  208. -->
  209. <fieldType name="textSpell" class="solr.TextField" positionIncrementGap="100" stored="false" multiValued="true">
  210. <analyzer type="index">
  211. <tokenizer class="solr.StandardTokenizerFactory"/>
  212. <filter class="solr.LowerCaseFilterFactory"/>
  213. <filter class="solr.SynonymFilterFactory" synonyms="synonyms.txt" ignoreCase="true" expand="true"/>
  214. <filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords.txt"/>
  215. <filter class="solr.StandardFilterFactory"/>
  216. <filter class="solr.RemoveDuplicatesTokenFilterFactory"/>
  217. </analyzer>
  218. <analyzer type="query">
  219. <tokenizer class="solr.StandardTokenizerFactory"/>
  220. <filter class="solr.LowerCaseFilterFactory"/>
  221. <filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords.txt"/>
  222. <filter class="solr.StandardFilterFactory"/>
  223. <filter class="solr.RemoveDuplicatesTokenFilterFactory"/>
  224. </analyzer>
  225. </fieldType>
  226. <!-- names & titles only -->
  227. <fieldType name="textSpellPhrase" class="solr.TextField" positionIncrementGap="100" stored="false" multiValued="true">
  228. <analyzer>
  229. <tokenizer class="solr.KeywordTokenizerFactory"/>
  230. <filter class="solr.LowerCaseFilterFactory"/>
  231. </analyzer>
  232. </fieldType>
  233. <!-- This is an example of using the KeywordTokenizer along
  234. With various TokenFilterFactories to produce a sortable field
  235. that does not include some properties of the source text
  236. -->
  237. <fieldType name="alphaOnlySort" class="solr.TextField" sortMissingLast="true" omitNorms="true">
  238. <analyzer>
  239. <!-- KeywordTokenizer does no actual tokenizing, so the entire
  240. input string is preserved as a single token
  241. -->
  242. <tokenizer class="solr.KeywordTokenizerFactory"/>
  243. <!-- The LowerCase TokenFilter does what you expect, which can be
  244. when you want your sorting to be case insensitive
  245. -->
  246. <filter class="solr.LowerCaseFilterFactory" />
  247. <!-- The TrimFilter removes any leading or trailing whitespace -->
  248. <filter class="solr.TrimFilterFactory" />
  249. <!-- The PatternReplaceFilter gives you the flexibility to use
  250. Java Regular expression to replace any sequence of characters
  251. matching a pattern with an arbitrary replacement string,
  252. which may include back refrences to portions of the orriginal
  253. string matched by the pattern.
  254. See the Java Regular Expression documentation for more
  255. infomation on pattern and replacement string syntax.
  256. http://java.sun.com/j2se/1.5.0/docs/api/java/util/regex/package-summary.html
  257. -->
  258. <filter class="solr.PatternReplaceFilterFactory"
  259. pattern="([^a-z])" replacement="" replace="all"
  260. />
  261. </analyzer>
  262. </fieldType>
  263. <fieldType name="rType" class="solr.TextField" sortMissingLast="true" omitNorms="true">
  264. <analyzer>
  265. <tokenizer class="solr.KeywordTokenizerFactory"/>
  266. <filter class="solr.PatternReplaceFilterFactory"
  267. pattern="^(0|1\d\d)$" replacement="" replace="first" />
  268. <filter class="solr.LengthFilterFactory" min="1" max="100" />
  269. <filter class="solr.SynonymFilterFactory" synonyms="mb_attributes.txt" ignoreCase="false" expand="false"/>
  270. </analyzer>
  271. </fieldType>
  272. <fieldType name="rOfficial" class="solr.TextField" sortMissingLast="true" omitNorms="true">
  273. <analyzer>
  274. <tokenizer class="solr.KeywordTokenizerFactory"/>
  275. <filter class="solr.PatternReplaceFilterFactory"
  276. pattern="^(0|\d\d?)$" replacement="" replace="first" />
  277. <filter class="solr.LengthFilterFactory" min="1" max="100" />
  278. <filter class="solr.SynonymFilterFactory" synonyms="mb_attributes.txt" ignoreCase="false" expand="false"/>
  279. </analyzer>
  280. </fieldType>
  281. <fieldType name="bucketFirstLetter" class="solr.TextField" sortMissingLast="true" omitNorms="true">
  282. <analyzer type="index">
  283. <tokenizer class="solr.PatternTokenizerFactory" pattern="^([a-zA-Z]).*" group="1" />
  284. <filter class="solr.SynonymFilterFactory" synonyms="mb_letterBuckets.txt" ignoreCase="true" expand="false"/>
  285. </analyzer>
  286. <analyzer type="query">
  287. <tokenizer class="solr.KeywordTokenizerFactory"/>
  288. </analyzer>
  289. </fieldType>
  290. <!-- since fields of this type are by default not stored or indexed, any data added to
  291. them will be ignored outright
  292. -->
  293. <fieldtype name="ignored" stored="false" indexed="false" class="solr.StrField" />
  294. </types>
  295. <fields>
  296. <!-- Valid attributes for fields:
  297. name: mandatory - the name for the field
  298. type: mandatory - the name of a previously defined type from the <types> section
  299. indexed: true if this field should be indexed (searchable or sortable)
  300. stored: true if this field should be retrievable
  301. compressed: [false] if this field should be stored using gzip compression
  302. (this will only apply if the field type is compressable; among
  303. the standard field types, only TextField and StrField are)
  304. multiValued: true if this field may contain multiple values per document
  305. omitNorms: (expert) set to true to omit the norms associated with
  306. this field (this disables length normalization and index-time
  307. boosting for the field, and saves some memory).  Only full-text
  308. fields or fields that need an index-time boost need norms.
  309. termVectors: [false] set to true to store the term vector for a given field.
  310. When using MoreLikeThis, fields used for similarity should be stored for
  311. best performance.
  312. name:字段的名字。
  313. type:字段的类型。
  314. default:一般用来记录索引的时间。
  315. required:设置为true时,当字段没有值,则solr会索引文档失败。
  316. -->
  317. <field name="id" type="string" required="true" /><!-- Artist:11650 -->
  318. <field name="type" type="string" required="true" /><!-- Artist | Release | Label -->
  319. <!-- artist -->
  320. <field name="a_name" type="title" /><!-- The Smashing Pumpkins -->
  321. <field name="a_name_sort" type="string" stored="false" /><!-- Smashing Pumpkins, The -->
  322. <field name="a_alias" type="title" stored="false" multiValued="true" />
  323. <field name="a_type" type="string" /><!-- group | person -->
  324. <field name="a_begin_date" type="date" />
  325. <field name="a_end_date" type="date" />
  326. <field name="a_member_name" type="title" multiValued="true" /><!-- Billy Corgan -->
  327. <field name="a_member_id" type="title" multiValued="true" /><!-- 102693 -->
  328. <field name="a_release_date_latest" type="date" />
  329. <!--note: for spell correction; populated via copyFields -->
  330. <field name="a_spell" type="textSpell" />
  331. <field name="a_spellPhrase" type="textSpellPhrase" />
  332. <!-- release -->
  333. <field name="r_name" type="title" /><!-- Siamese Dream -->
  334. <field name="r_name_sort" type="alphaOnlySort" stored="false"/><!-- Siamese Dream -->
  335. <field name="r_name_facetLetter" type="bucketFirstLetter" stored="false" />
  336. <field name="r_a_name" type="title" /><!-- The Smashing Pumpkins -->
  337. <field name="r_a_id" type="string" /><!-- 11650 -->
  338. <!-- Attributes 1-11: Album | Single | EP |... etc. -->
  339. <!-- Attributes 100+: Official | Bootleg | Promotional -->
  340. <field name="r_attributes" type="integer" multiValued="true" indexed="false" /><!-- ex: 0, 1, 100 -->
  341. <field name="r_type" type="rType" multiValued="true" stored="false"/><!-- Album | Single | EP |... etc. -->
  342. <field name="r_official" type="rOfficial" multiValued="true" stored="false"/><!-- Official | Bootleg | Promotional -->
  343. <field name="r_lang" type="string" indexed="false" /> <!-- eng / latn -->
  344. <field name="r_tracks" type="sint" indexed="false" />
  345. <field name="r_event_country" type="string" multiValued="true" /><!-- us -->
  346. <field name="r_event_date" type="date" multiValued="true" />
  347. <field name="r_event_date_earliest" type="date" multiValued="false" />
  348. <!-- label -->
  349. <field name="l_name" type="title" /><!-- Virgin Records America -->
  350. <field name="l_name_sort" type="string" stored="false" />
  351. <field name="l_type" type="string" /><!-- Distributor, Orig. Prod., Production -->
  352. <field name="l_begin_date" type="date" />
  353. <field name="l_end_date" type="date" />
  354. <!-- track -->
  355. <field name="t_name" type="title" /><!-- Cherub Rock -->
  356. <field name="t_duration" type="sint"/><!-- 298 (seconds) -->
  357. <field name="t_a_id" type="string" /><!-- 11650 -->
  358. <field name="t_a_name" type="title" /><!-- The Smashing Pumpkins -->
  359. <field name="t_num" type="integer" indexed="false" /><!-- 1 -->
  360. <field name="t_r_id" type="string" /><!-- 22429 -->
  361. <field name="t_r_name" type="title" /><!-- Siamese Dream -->
  362. <field name="t_r_attributes"  multiValued="true" type="integer" /><!-- album | single | compilation -->
  363. <field name="t_r_tracks" type="sint" /><!-- 13 -->
  364. <field name="t_trm_lookups" type="sint" /><!-- 250 -->
  365. <!-- TODO -->
  366. <field name="word" type="ignored" />
  367. <field name="includes" type="ignored" />
  368. </fields>
  369. <!-- Field to use to determine and enforce document uniqueness.
  370. Unless this field is marked with required="false", it will be a required field
  371. 唯一标识文档的字段
  372. -->
  373. <uniqueKey>id</uniqueKey>
  374. <!--
  375. field for the QueryParser to use when an explicit fieldname is absent
  376. 默认搜索字段
  377. -->
  378. <defaultSearchField>a_name</defaultSearchField>
  379. <!-- SolrQueryParser configuration: defaultOperator="AND|OR" -->
  380. <!-- <solrQueryParser defaultOperator="AND"/> -->
  381. <!-- copyField commands copy one field to another at the time a document
  382. is added to the index.  It's used either to index the same field differently,
  383. or to add multiple fields to the same field for easier/faster searching.  -->
  384. <copyField source="a_name" dest="a_spell" />
  385. <copyField source="a_alias" dest="a_spell" />
  386. <copyField source="a_name" dest="a_spellPhrase" />
  387. <copyField source="a_alias" dest="a_spellPhrase" />
  388. <copyField source="r_name" dest="r_name_sort" />
  389. <copyField source="r_name" dest="r_name_facetLetter" />
  390. <copyField source="r_attributes" dest="r_type" />
  391. <copyField source="r_attributes" dest="r_official" />
  392. <!-- Similarity is the scoring routine for each document vs. a query.
  393. A custom similarity may be specified here, but the default is fine
  394. for most applications.  -->
  395. <!-- <similarity class="org.apache.lucene.search.DefaultSimilarity"/> -->
  396. <!-- ... OR ...
  397. Specify a SimilarityFactory class name implementation
  398. allowing parameters to be used.
  399. -->
  400. <!--
  401. <similarity class="com.example.solr.CustomSimilarityFactory">
  402. <str name="paramkey">param value</str>
  403. </similarity>
  404. -->
  405. </schema>

转载于:https://www.cnblogs.com/ibook360/archive/2011/11/02/2232875.html

Apache Solr solrconfig.xml 中文说明相关推荐

  1. Apache Solr schema.xml及solrconfig.xml文件中文注解

    一.字段配置(schema) schema.xml位于solr/conf/目录下,类似于数据表配置文件, 定义了加入索引的数据的数据类型,主要包括type.fields和其他的一些缺省设置. 1.先来 ...

  2. Solr基础教程之solrconfig.xml(三)

    前面介绍过schema.xml的一些配置信息,本章介绍solrconfig.xml的配置,以及怎样安装smartcn分词器和IK分词器,并介绍主要的查询语法. 1. solr配置solrconfig. ...

  3. solr之schema.xml中文翻译

    译者:张春玲 原文地址:http://blog.csdn.net/zcl_love_wx/article/details/51907488 翻译中----- 声明:faceting我也一直不清楚在so ...

  4. solr之搭建企业搜索平台,配置文件详细solrconfig.xml

    本节详细讲解solrconfig.xml 1.如果配置文件配置错误,是否提示.true要报错,false不报错. <abortOnConfigurationError>${solr.abo ...

  5. 【solr专题之二】配置文件:solr.xml solrConfig.xml schema.xml

    1.关于默认搜索域 If you are using the Lucene query parser, queries that don't specify a field name will use ...

  6. solr 6.5.1 创建core失败的原因 Can‘t find resource ‘solrconfig.xml‘

    solr 6.5.1 创建core失败的原因 Can't find resource 'solrconfig.xml'

  7. Solr安装、中文分词以及定时更新索引

    Solr安装及使用 一.安装 1.官网下载地址 直接下载 zip格式即可 2.解压下载的压缩包即可完成Solr安装. 3.打开DOS,路径切换至solr_home\bin,执行命令:solr star ...

  8. Apache Solr 9.1-(一)初体验单机模式运行

    Apache Solr 9.1-(一)初体验单机模式运行 Solr是一个基于Apache Lucene的搜索服务器,Apache Lucene是开源的.基于Java的信息检索库,Solr能为用户提供无 ...

  9. Solr Schema.xml分析

    2019独角兽企业重金招聘Python工程师标准>>> Solr Schema.xml分析 一.字段配置(schema) schema.xml位于solr/conf/目录下,类似于数 ...

最新文章

  1. 5G 时代的 Android App 开发入门与项目实战
  2. Java内存回收机制基础[转]
  3. git 可视化工具_最值得推荐的8个git/github项目数据分析工具
  4. 用prototype 方式来创建客户端组件类
  5. 福特第三代自动驾驶在美开启公开道路测试
  6. python pywin32 微信_python win32con安装_python-2.7 – 安装pywin32
  7. 【ARM】Tiny4412裸机编程之GPIO简介
  8. 什么是 TypeScript 变量的 declared type
  9. S/4HANA Extension field的UI visible checkbox逻辑
  10. 将WildFly绑定到其他IP地址或多宿主上的所有地址
  11. ab 模拟_Ab测试第二部分的直观模拟
  12. 最大字段和---C语言实现
  13. requirejs 学习笔记 0
  14. 数组指针和指针数组的区别(转)
  15. 命令行 蓝牙_蓝牙键盘接入UOS系统的方法
  16. 学习STM32 RS485 原理与应用
  17. MyEclipse断点无效
  18. Excel 2010 SQL应用052 将英文字母转换为小写字母
  19. 爬虫日记(23):用scrapy快速地爬取蜂鸟网图片
  20. 区块链应用在网络安全的六个案例

热门文章

  1. Java之消息摘要(MD5)
  2. Ext 中使用Ajax
  3. ubuntu 是基于debian gnu/linux,在 Ubuntu 或其它 GNU/Linux 系统下安装 Debian
  4. ios java环境变量_iOS 环境变量配置(DebugReleaseTest)
  5. 中介者模式php,php设计模式 Mediator (中介者模式)
  6. Python 根据文件绝对路径删除文件
  7. vim java自动补全_java – eclim没有在vim中做自动完成
  8. ssh 免密_大数据时代:SSH如何免密码登录?
  9. gateway nacos注册服务_使用Nacos作为微服务注册中心和配置中心
  10. ftp ---- vsftpd安装卸载