先把文件的代码贴上来:

  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!--
  3. 版权说明。。.
  4. -->
  5. <!--
    这是solr的chema 文件,这个文件应该被重命名为"schema.xml",而且他应该放在solrhome/core/conf文件下面。
  6. 获取你也能在solr webapp 的classload下面找到他.
  7. 更多的信息可以查看
  8. http://wiki.apache.org/solr/SchemaXml
  9.  
  10. 性能说明:可以如下来提高性能。
  11. - 设置 stored="false" 对那些只需要搜索,无需返回的字段.
  12. - 设置 indexed="false" 对于那些只用于返回无需进行搜索的字段.
  13. - 删除所有不需要 copyfiled字段的声明
    - 为了最好的索引大小与索引性能,设置所有一般的文本字段index=false,使用copyfile将他们copy到一个字段上,然后使用它进行搜索。
    - 运行jvm服务器模式,并使用较高的日志级别,避免记录每一个请求。
  1. -->
  2.  
  3. <schema name="example-data-driven-schema" version="1.6">
  4. <!-- 该配置名称与版本说明.
  5. -->
  6. <!-- 字段的有效属性:
  1. name:属性的名称,这里有个特殊的属性“_version_”是必须添加的。
  2. type:字段的数据结构类型,所用到的类型需要在fieldType中设置。
  3. default:默认值。
  4. indexed:是否创建索引
  5. stored:是否存储原始数据(如果不需要存储相应字段值,尽量设为false)
  6. docValues:表示此域是否需要添加一个 docValues 域,这对 facet 查询, group 分组,排序, function 查询有好处,尽管这个属性不是必须的,但他能加快索引数据加载,对 NRT 近实时搜索比较友好,且更节省内存,但它也有一些限制,比如当前docValues 域只支持 strField,UUIDField,Trie*Field 等域,且要求域的域值是单值不能是多值域
  7. solrMissingFirst/solrMissingLast:查询结果排序的过程中,如果发现这个字段的值不存在,则排在前面/后面,忽略排序的条件
  8. multValued:是否有多个值,比如说一个用户的所有好友id。(对可能存在多值的字段尽量设置为true,避免建索引时抛出错误)
  9. omitNorms:此属性若设置为 true ,即表示将忽略域值的长度标准化,忽略在索引过程中对当前域的权重设置,且会节省内存。只有全文本域或者你需要在索引创建过程中设置域的权重时才需要把这个值设为 false, 对于基本数据类型且不分词的域如intFeild,longField,Stre, 否则默认就是 false.
  10. required:添加文档时,该字段必须存在,类似mysql的not null
  11. termVectors: 设置为 true 即表示需要为该 field 存储项向量信息,当你需要MoreLikeThis 功能时,则需要将此属性值设为 true ,这样会带来一些性能提升。
  12. termPositions: 是否存储 Term 的起始位置信息,这会增大索引的体积,但高亮功能需要依赖此项设置,否则无法高亮
  13. termOffsets: 表示是否存储索引的位置偏移量,高亮功能需要此项配置,当你使用SpanQuery 时,此项配置会影响匹配的结果集
  1. -->
  2.  
  3. <!--字段名称应该包含字母数字或下划线字符,不以一个数字开始。这是目前没有严格执行,但其他字段名称将不会有来自所有组件的第一类支持和背部的兼容性没有保证。领导和的名字下划线(如_version_)保留-->
  1. <!--

在这data_driven_schema_configs configset,下面三个字段是必须的:
id、_version_,和_text_。所有其他字段都是可以删除修改的,并根据需要手动添加
在xml。
请注意,许多动态字段也被定义-您可以使用它们来指定一个
字段的类型通过字段命名约定-见下文。
警告:本_text_catch所字段将会显著地提高索引的大小。
如果你不需要,考虑删除它和相应的copyfield指令。-->

  1. <field name="id" type="long" indexed="true" stored="true" required="true"/>
    <!-- 常规字段->
  2. <field name="informer_id" type="long" indexed="true" stored="false"/>
  3. <field name="phone_number" type="string" indexed="true" stored="false"/>
  4. <field name="title" type="string" indexed="true" stored="true" />
  5. <field name="content" type="string" indexed="true" stored="true" />
  6. <field name="latitude" type="string" indexed="true" stored="true" />
  7. <field name="longitude" type="string" indexed="true" stored="true" />
  8. <field name="attachment" type="string" indexed="true" stored="true" />
  9. <field name="clue_status" type="int" indexed="true" stored="true" />
  10. <field name="del_flag" type="int" indexed="true" stored="true" />
  11. <field name="gmt_create" type="date" indexed="true" stored="true" />
  12. <field name="create_uid" type="long" indexed="true" stored="true" />
  13. <field name="gmt_modified" type="date" indexed="true" stored="true" />
  14. <field name="modified_uid" type="long" indexed="true" stored="true" />
  15. <!--预留字段 -->
  16. <!--<field name="id" type="string" indexed="true" stored="true" multiValued="false" />-->
  17. <field name="_version_" type="long" indexed="true" stored="false"/>
  18. <field name="_root_" type="string" indexed="true" stored="false" docValues="false" />
  19. <field name="_text_" type="text_general" indexed="true" stored="false" multiValued="true"/>

  20. <!--复制字段-->
  21. <!--建议建立一个拷贝字段,将所有的 全文本 字段复制到一个字段中,以便进行统一的检索
    要注意的是,如果你只是复制单个域,那么如果你被复制域本身就是多值域,那么目标域也是多值域,这毋庸置疑,那如果你复制的是多个域,只要其中有一个域是多值域,那么目标域就一定是多值域,这点一定要谨记
    -->
  22. <copyField source="*" dest="_text_"/>

  23. <!--动态字段-->
  24. <!-- 动态字段 属性配置上与常规字段没啥区别,最大的区别是name的属性上可以进行通配,比如说name="*_i",那么只要是后面带i的字段都是符合的。这样就不怕一些字段无法匹配无法写入 -->
  25. <dynamicField name="*_i" type="int" indexed="true" stored="true"/>
  26. <dynamicField name="*_is" type="ints" indexed="true" stored="true"/>
  27. <dynamicField name="*_s" type="string" indexed="true" stored="true" />
  28. <dynamicField name="*_ss" type="strings" indexed="true" stored="true"/>
  29. <dynamicField name="*_l" type="long" indexed="true" stored="true"/>
  30. <dynamicField name="*_ls" type="longs" indexed="true" stored="true"/>
  31. <dynamicField name="*_t" type="text_general" indexed="true" stored="true"/>
  32. <dynamicField name="*_txt" type="text_general" indexed="true" stored="true"/>
  33. <dynamicField name="*_b" type="boolean" indexed="true" stored="true"/>
  34. <dynamicField name="*_bs" type="booleans" indexed="true" stored="true"/>
  35. <dynamicField name="*_f" type="float" indexed="true" stored="true"/>
  36. <dynamicField name="*_fs" type="floats" indexed="true" stored="true"/>
  37. <dynamicField name="*_d" type="double" indexed="true" stored="true"/>
  38. <dynamicField name="*_ds" type="doubles" indexed="true" stored="true"/>
  39. <!-- 字段类型 -->
  40. <!--
    1. StrField: 这是一个不分词的字符串域,它支持 docValues 域,但当为其添加了docValues 域,则要求只能是单值域且该域必须存在或者该域有默认值
    2. BoolField : boolean 域,对应 true/false
    3. TrieIntField, TrieFloatField, TrieLongField, TrieDoubleField 这几个都是默认的数字域, precisionStep 属性一般用于数字范围查询, precisionStep 值越小,则索引时该域的域值分出的 token 个数越多,会增大硬盘上索引的体积,但它会加快数字范围检索的响应速度, positionIncrementGap 属性表示如果当前域是多值域时,多个值之间的间距,单值域,设置此项无意义。
    4. TrieDateField :显然这是一个日期域类型,不过遗憾的是它支持 1995-12-31T23:59:59Z 这种格式的日期,比较坑爹,为此我自定义了一个 TrieCNDateField 域类型,用于支持国人比较喜欢的 yyyy-MM-dd HH:mm:ss 格式的日期。源码请参见我的上一篇博客。
    5. BinaryField :经过 base64 编码的字符串域类型,即你需要把 binary 数据进行base64 编码才能被 solr 进行索引。
    6. RandomSortField :随机排序域类型,当你需要实现伪随机排序时,请使用此域类型。
    7. TextField :是用的最多的一种域类型,它需要进行分词,所以它一般需要配置分词器。至于具体它如何配置 IK 分词器,这里就不展开了-->
  1. <fieldType name="string" class="solr.StrField" sortMissingLast="true" docValues="true" />
  2. <fieldType name="strings" class="solr.StrField" sortMissingLast="true" multiValued="true" docValues="true" />
  3. <fieldType name="boolean" class="solr.BoolField" sortMissingLast="true"/>
  4. <fieldType name="booleans" class="solr.BoolField" sortMissingLast="true" multiValued="true"/>
  5. <!-- sortMissingLast and sortMissingFirst attributes are optional attributes are
  6. currently supported on types that are sorted internally as strings
  7. and on numeric types.
  8. This includes "string","boolean", and, as of 3.5 (and 4.x),
  9. int, float, long, date, double, including the "Trie" variants.
  10. - If sortMissingLast="true", then a sort on this field will cause documents
  11. without the field to come after documents with the field,
  12. regardless of the requested sort order (asc or desc).
  13. - If sortMissingFirst="true", then a sort on this field will cause documents
  14. without the field to come before documents with the field,
  15. regardless of the requested sort order.
  16. - If sortMissingLast="false" and sortMissingFirst="false" (the default),
  17. then default lucene sorting will be used which places docs without the
  18. field first in an ascending sort and last in a descending sort.
  19. -->
  20. <!--
  21. 默认数值类型,用于范围类的查找, consider the tint/tfloat/tlong/tdouble types.
  22. 这些字段支持文档的值,但应该是单值字段.
  23. -->
  24. <fieldType name="int" class="solr.TrieIntField" docValues="true" precisionStep="0" positionIncrementGap="0"/>
  25. <fieldType name="float" class="solr.TrieFloatField" docValues="true" precisionStep="0" positionIncrementGap="0"/>
  26. <fieldType name="long" class="solr.TrieLongField" docValues="true" precisionStep="0" positionIncrementGap="0"/>
  27. <fieldType name="double" class="solr.TrieDoubleField" docValues="true" precisionStep="0" positionIncrementGap="0"/>
  28. <fieldType name="ints" class="solr.TrieIntField" docValues="true" precisionStep="0" positionIncrementGap="0" multiValued="true"/>
  29. <fieldType name="floats" class="solr.TrieFloatField" docValues="true" precisionStep="0" positionIncrementGap="0" multiValued="true"/>
  30. <fieldType name="longs" class="solr.TrieLongField" docValues="true" precisionStep="0" positionIncrementGap="0" multiValued="true"/>
  31. <fieldType name="doubles" class="solr.TrieDoubleField" docValues="true" precisionStep="0" positionIncrementGap="0" multiValued="true"/>
  32. <!--
  33. 各个精度值
  34. -->
  35. <fieldType name="tint" class="solr.TrieIntField" docValues="true" precisionStep="8" positionIncrementGap="0"/>
  36. <fieldType name="tfloat" class="solr.TrieFloatField" docValues="true" precisionStep="8" positionIncrementGap="0"/>
  37. <fieldType name="tlong" class="solr.TrieLongField" docValues="true" precisionStep="8" positionIncrementGap="0"/>
  38. <fieldType name="tdouble" class="solr.TrieDoubleField" docValues="true" precisionStep="8" positionIncrementGap="0"/>
  39. <fieldType name="tints" class="solr.TrieIntField" docValues="true" precisionStep="8" positionIncrementGap="0" multiValued="true"/>
  40. <fieldType name="tfloats" class="solr.TrieFloatField" docValues="true" precisionStep="8" positionIncrementGap="0" multiValued="true"/>
  41. <fieldType name="tlongs" class="solr.TrieLongField" docValues="true" precisionStep="8" positionIncrementGap="0" multiValued="true"/>
  42. <fieldType name="tdoubles" class="solr.TrieDoubleField" docValues="true" precisionStep="8" positionIncrementGap="0" multiValued="true"/>
  43. <!-- 日期格式
  44. Note: -->
  45. <fieldType name="date" class="solr.TrieDateField" docValues="true" precisionStep="0" positionIncrementGap="0"/>
  46. <fieldType name="dates" class="solr.TrieDateField" docValues="true" precisionStep="0" positionIncrementGap="0" multiValued="true"/>
  47.  
  48. <!-- 一种基于树结构的日期字段,日期范围查询与数据分类-->
  49. <fieldType name="tdate" class="solr.TrieDateField" docValues="true" precisionStep="6" positionIncrementGap="0"/>
  50.  
  51. <fieldType name="tdates" class="solr.TrieDateField" docValues="true" precisionStep="6" positionIncrementGap="0" multiValued="true"/>
  52.  
  53. -->
  54. <fieldType name="binary" class="solr.BinaryField"/>
  55.  
  56. <!-- The "RandomSortField" is not used to store or search any
  57. data. You can declare fields of this type it in your schema
  58. to generate pseudo-random orderings of your docs for sorting
  59. or function purposes. The ordering is generated based on the field
  60. name and the version of the index. As long as the index version
  61. remains unchanged, and the same field name is reused,
  62. the ordering of the docs will be consistent.
  63. If you want different psuedo-random orderings of documents,
  64. for the same version of the index, use a dynamicField and
  65. change the field name in the request.
  66. -->
  67. <fieldType name="random" class="solr.RandomSortField" indexed="true" />
  68.  
  69. <!-- solr.TextField allows the specification of custom text analyzers
  70. specified as a tokenizer and a list of token filters. Different
  71. analyzers may be specified for indexing and querying.
  72.  
  73. The optional positionIncrementGap puts space between multiple fields of
  74. this type on the same document, with the purpose of preventing false phrase
  75. matching across fields.
  76.  
  77. For more info on customizing your analyzer chain, please see
  78. http://wiki.apache.org/solr/AnalyzersTokenizersTokenFilters
  79. -->
  80.  
  81. <!-- One can also specify an existing Analyzer class that has a
  82. default constructor via the class attribute on the analyzer element.
  83. Example:
  84. <fieldType name="text_greek" class="solr.TextField">
  85. <analyzer class="org.apache.lucene.analysis.el.GreekAnalyzer"/>
  86. </fieldType>
  87. -->
  88.  
  89. <!-- A text field that only splits on whitespace for exact matching of words -->
  90. <dynamicField name="*_ws" type="text_ws" indexed="true" stored="true"/>
  91. <fieldType name="text_ws" class="solr.TextField" positionIncrementGap="100">
  92. <analyzer>
  93. <tokenizer class="solr.WhitespaceTokenizerFactory"/>
  94. </analyzer>
  95. </fieldType>
  96.  
  97. <!-- A general text field that has reasonable, generic
  98. cross-language defaults: it tokenizes with StandardTokenizer,
  99. removes stop words from case-insensitive "stopwords.txt"
  100. (empty by default), and down cases. At query time only, it
  101. also applies synonyms.
  102. -->
  103. <fieldType name="text_general" class="solr.TextField" positionIncrementGap="100" multiValued="true">
  104. <analyzer type="index">
  105. <tokenizer class="solr.StandardTokenizerFactory"/>
  106. <filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords.txt" />
  107. <!-- in this example, we will only use synonyms at query time
  108. <filter class="solr.SynonymFilterFactory" synonyms="index_synonyms.txt" ignoreCase="true" expand="false"/>
  109. -->
  110. <filter class="solr.LowerCaseFilterFactory"/>
  111. </analyzer>
  112. <analyzer type="query">
  113. <tokenizer class="solr.StandardTokenizerFactory"/>
  114. <filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords.txt" />
  115. <filter class="solr.SynonymFilterFactory" synonyms="synonyms.txt" ignoreCase="true" expand="true"/>
  116. <filter class="solr.LowerCaseFilterFactory"/>
  117. </analyzer>
  118. </fieldType>
  119.  
  120. <!-- A text field with defaults appropriate for English: it
  121. tokenizes with StandardTokenizer, removes English stop words
  122. (lang/stopwords_en.txt), down cases, protects words from protwords.txt, and
  123. finally applies Porter's stemming. The query time analyzer
  124. also applies synonyms from synonyms.txt. -->
  125. <dynamicField name="*_txt_en" type="text_en" indexed="true" stored="true"/>
  126. <fieldType name="text_en" class="solr.TextField" positionIncrementGap="100">
  127. <analyzer type="index">
  128. <tokenizer class="solr.StandardTokenizerFactory"/>
  129. <!-- in this example, we will only use synonyms at query time
  130. <filter class="solr.SynonymFilterFactory" synonyms="index_synonyms.txt" ignoreCase="true" expand="false"/>
  131. -->
  132. <!-- Case insensitive stop word removal.
  133. -->
  134. <filter class="solr.StopFilterFactory"
  135. ignoreCase="true"
  136. words="lang/stopwords_en.txt"
  137. />
  138. <filter class="solr.LowerCaseFilterFactory"/>
  139. <filter class="solr.EnglishPossessiveFilterFactory"/>
  140. <filter class="solr.KeywordMarkerFilterFactory" protected="protwords.txt"/>
  141. <!-- Optionally you may want to use this less aggressive stemmer instead of PorterStemFilterFactory:
  142. <filter class="solr.EnglishMinimalStemFilterFactory"/>
  143. -->
  144. <filter class="solr.PorterStemFilterFactory"/>
  145. </analyzer>
  146. <analyzer type="query">
  147. <tokenizer class="solr.StandardTokenizerFactory"/>
  148. <filter class="solr.SynonymFilterFactory" synonyms="synonyms.txt" ignoreCase="true" expand="true"/>
  149. <filter class="solr.StopFilterFactory"
  150. ignoreCase="true"
  151. words="lang/stopwords_en.txt"
  152. />
  153. <filter class="solr.LowerCaseFilterFactory"/>
  154. <filter class="solr.EnglishPossessiveFilterFactory"/>
  155. <filter class="solr.KeywordMarkerFilterFactory" protected="protwords.txt"/>
  156. <!-- Optionally you may want to use this less aggressive stemmer instead of PorterStemFilterFactory:
  157. <filter class="solr.EnglishMinimalStemFilterFactory"/>
  158. -->
  159. <filter class="solr.PorterStemFilterFactory"/>
  160. </analyzer>
  161. </fieldType>
  162.  
  163. <!-- A text field with defaults appropriate for English, plus
  164. aggressive word-splitting and autophrase features enabled.
  165. This field is just like text_en, except it adds
  166. WordDelimiterFilter to enable splitting and matching of
  167. words on case-change, alpha numeric boundaries, and
  168. non-alphanumeric chars. This means certain compound word
  169. cases will work, for example query "wi fi" will match
  170. document "WiFi" or "wi-fi".
  171. -->
  172. <dynamicField name="*_txt_en_split" type="text_en_splitting" indexed="true" stored="true"/>
  173. <fieldType name="text_en_splitting" class="solr.TextField" positionIncrementGap="100" autoGeneratePhraseQueries="true">
  174. <analyzer type="index">
  175. <tokenizer class="solr.WhitespaceTokenizerFactory"/>
  176. <!-- in this example, we will only use synonyms at query time
  177. <filter class="solr.SynonymFilterFactory" synonyms="index_synonyms.txt" ignoreCase="true" expand="false"/>
  178. -->
  179. <!-- Case insensitive stop word removal.
  180. -->
  181. <filter class="solr.StopFilterFactory"
  182. ignoreCase="true"
  183. words="lang/stopwords_en.txt"
  184. />
  185. <filter class="solr.WordDelimiterFilterFactory" generateWordParts="1" generateNumberParts="1" catenateWords="1" catenateNumbers="1" catenateAll="0" splitOnCaseChange="1"/>
  186. <filter class="solr.LowerCaseFilterFactory"/>
  187. <filter class="solr.KeywordMarkerFilterFactory" protected="protwords.txt"/>
  188. <filter class="solr.PorterStemFilterFactory"/>
  189. </analyzer>
  190. <analyzer type="query">
  191. <tokenizer class="solr.WhitespaceTokenizerFactory"/>
  192. <filter class="solr.SynonymFilterFactory" synonyms="synonyms.txt" ignoreCase="true" expand="true"/>
  193. <filter class="solr.StopFilterFactory"
  194. ignoreCase="true"
  195. words="lang/stopwords_en.txt"
  196. />
  197. <filter class="solr.WordDelimiterFilterFactory" generateWordParts="1" generateNumberParts="1" catenateWords="0" catenateNumbers="0" catenateAll="0" splitOnCaseChange="1"/>
  198. <filter class="solr.LowerCaseFilterFactory"/>
  199. <filter class="solr.KeywordMarkerFilterFactory" protected="protwords.txt"/>
  200. <filter class="solr.PorterStemFilterFactory"/>
  201. </analyzer>
  202. </fieldType>
  203.  
  204. <!-- Less flexible matching, but less false matches. Probably not ideal for product names,
  205. but may be good for SKUs. Can insert dashes in the wrong place and still match. -->
  206. <dynamicField name="*_txt_en_split_tight" type="text_en_splitting_tight" indexed="true" stored="true"/>
  207. <fieldType name="text_en_splitting_tight" class="solr.TextField" positionIncrementGap="100" autoGeneratePhraseQueries="true">
  208. <analyzer>
  209. <tokenizer class="solr.WhitespaceTokenizerFactory"/>
  210. <filter class="solr.SynonymFilterFactory" synonyms="synonyms.txt" ignoreCase="true" expand="false"/>
  211. <filter class="solr.StopFilterFactory" ignoreCase="true" words="lang/stopwords_en.txt"/>
  212. <filter class="solr.WordDelimiterFilterFactory" generateWordParts="0" generateNumberParts="0" catenateWords="1" catenateNumbers="1" catenateAll="0"/>
  213. <filter class="solr.LowerCaseFilterFactory"/>
  214. <filter class="solr.KeywordMarkerFilterFactory" protected="protwords.txt"/>
  215. <filter class="solr.EnglishMinimalStemFilterFactory"/>
  216. <!-- this filter can remove any duplicate tokens that appear at the same position - sometimes
  217. possible with WordDelimiterFilter in conjuncton with stemming. -->
  218. <filter class="solr.RemoveDuplicatesTokenFilterFactory"/>
  219. </analyzer>
  220. </fieldType>
  221.  
  222. <!-- Just like text_general except it reverses the characters of
  223. each token, to enable more efficient leading wildcard queries.
  224. -->
  225. <dynamicField name="*_txt_rev" type="text_general_rev" indexed="true" stored="true"/>
  226. <fieldType name="text_general_rev" class="solr.TextField" positionIncrementGap="100">
  227. <analyzer type="index">
  228. <tokenizer class="solr.StandardTokenizerFactory"/>
  229. <filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords.txt" />
  230. <filter class="solr.LowerCaseFilterFactory"/>
  231. <filter class="solr.ReversedWildcardFilterFactory" withOriginal="true"
  232. maxPosAsterisk="3" maxPosQuestion="2" maxFractionAsterisk="0.33"/>
  233. </analyzer>
  234. <analyzer type="query">
  235. <tokenizer class="solr.StandardTokenizerFactory"/>
  236. <filter class="solr.SynonymFilterFactory" synonyms="synonyms.txt" ignoreCase="true" expand="true"/>
  237. <filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords.txt" />
  238. <filter class="solr.LowerCaseFilterFactory"/>
  239. </analyzer>
  240. </fieldType>
  241.  
  242. <dynamicField name="*_phon_en" type="phonetic_en" indexed="true" stored="true"/>
  243. <fieldType name="phonetic_en" stored="false" indexed="true" class="solr.TextField" >
  244. <analyzer>
  245. <tokenizer class="solr.StandardTokenizerFactory"/>
  246. <filter class="solr.DoubleMetaphoneFilterFactory" inject="false"/>
  247. </analyzer>
  248. </fieldType>
  249.  
  250. <!-- lowercases the entire field value, keeping it as a single token. -->
  251. <dynamicField name="*_s_lower" type="lowercase" indexed="true" stored="true"/>
  252. <fieldType name="lowercase" class="solr.TextField" positionIncrementGap="100">
  253. <analyzer>
  254. <tokenizer class="solr.KeywordTokenizerFactory"/>
  255. <filter class="solr.LowerCaseFilterFactory" />
  256. </analyzer>
  257. </fieldType>
  258.  
  259. <!--
  260. Example of using PathHierarchyTokenizerFactory at index time, so
  261. queries for paths match documents at that path, or in descendent paths
  262. -->
  263. <dynamicField name="*_descendent_path" type="descendent_path" indexed="true" stored="true"/>
  264. <fieldType name="descendent_path" class="solr.TextField">
  265. <analyzer type="index">
  266. <tokenizer class="solr.PathHierarchyTokenizerFactory" delimiter="/" />
  267. </analyzer>
  268. <analyzer type="query">
  269. <tokenizer class="solr.KeywordTokenizerFactory" />
  270. </analyzer>
  271. </fieldType>
  272.  
  273. <!--
  274. Example of using PathHierarchyTokenizerFactory at query time, so
  275. queries for paths match documents at that path, or in ancestor paths
  276. -->
  277. <dynamicField name="*_ancestor_path" type="ancestor_path" indexed="true" stored="true"/>
  278. <fieldType name="ancestor_path" class="solr.TextField">
  279. <analyzer type="index">
  280. <tokenizer class="solr.KeywordTokenizerFactory" />
  281. </analyzer>
  282. <analyzer type="query">
  283. <tokenizer class="solr.PathHierarchyTokenizerFactory" delimiter="/" />
  284. </analyzer>
  285. </fieldType>
  286.  
  287. <!-- since fields of this type are by default not stored or indexed,
  288. any data added to them will be ignored outright. -->
  289. <fieldType name="ignored" stored="false" indexed="false" docValues="false" multiValued="true" class="solr.StrField" />
  290.  
  291. <!-- This point type indexes the coordinates as separate fields (subFields)
  292. If subFieldType is defined, it references a type, and a dynamic field
  293. definition is created matching *___<typename>. Alternately, if
  294. subFieldSuffix is defined, that is used to create the subFields.
  295. Example: if subFieldType="double", then the coordinates would be
  296. indexed in fields myloc_0___double,myloc_1___double.
  297. Example: if subFieldSuffix="_d" then the coordinates would be indexed
  298. in fields myloc_0_d,myloc_1_d
  299. The subFields are an implementation detail of the fieldType, and end
  300. users normally should not need to know about them.
  301. -->
  302. <dynamicField name="*_point" type="point" indexed="true" stored="true"/>
  303. <fieldType name="point" class="solr.PointType" dimension="2" subFieldSuffix="_d"/>
  304.  
  305. <!-- A specialized field for geospatial search. If indexed, this fieldType must not be multivalued. -->
  306. <fieldType name="location" class="solr.LatLonType" subFieldSuffix="_coordinate"/>
  307.  
  308. <!-- An alternative geospatial field type new to Solr 4. It supports multiValued and polygon shapes.
  309. For more information about this and other Spatial fields new to Solr 4, see:
  310. http://wiki.apache.org/solr/SolrAdaptersForLuceneSpatial4
  311. -->
  312. <fieldType name="location_rpt" class="solr.SpatialRecursivePrefixTreeFieldType"
  313. geo="true" distErrPct="0.025" maxDistErr="0.001" distanceUnits="kilometers" />
  314.  
  315. <!-- Money/currency field type. See http://wiki.apache.org/solr/MoneyFieldType
  316. Parameters:
  317. defaultCurrency: Specifies the default currency if none specified. Defaults to "USD"
  318. precisionStep: Specifies the precisionStep for the TrieLong field used for the amount
  319. providerClass: Lets you plug in other exchange provider backend:
  320. solr.FileExchangeRateProvider is the default and takes one parameter:
  321. currencyConfig: name of an xml file holding exchange rates
  322. solr.OpenExchangeRatesOrgProvider uses rates from openexchangerates.org:
  323. ratesFileLocation: URL or path to rates JSON file (default latest.json on the web)
  324. refreshInterval: Number of minutes between each rates fetch (default: 1440, min: 60)
  325. -->
  326. <fieldType name="currency" class="solr.CurrencyField" precisionStep="8" defaultCurrency="USD" currencyConfig="currency.xml" />
  327.  
  328. <!-- some examples for different languages (generally ordered by ISO code) -->
  329. <!-- Armenian -->
  330. <dynamicField name="*_txt_hy" type="text_hy" indexed="true" stored="true"/>
  331. <fieldType name="text_hy" class="solr.TextField" positionIncrementGap="100">
  332. <analyzer>
  333. <tokenizer class="solr.StandardTokenizerFactory"/>
  334. <filter class="solr.LowerCaseFilterFactory"/>
  335. <filter class="solr.StopFilterFactory" ignoreCase="true" words="lang/stopwords_hy.txt" />
  336. <filter class="solr.SnowballPorterFilterFactory" language="Armenian"/>
  337. </analyzer>
  338. </fieldType>
  339.  
  340. </schema>

我与solr(五)--关于schema.xml中的相关配置的详解的更多相关文章

  1. nginx.conf中关于nginx-rtmp-module配置指令详解

    译序:截至 Jul 8th,2013 官方公布的最新 Nginx RTMP 模块 nginx-rtmp-module 指令详解.指令Corertmp语法:rtmp { ... }上下文:根描述:保存所 ...

  2. 并发编程(六)Object类中线程相关的方法详解

    一.notify() 作用:唤醒一个正在等待该线程的锁的线程 PS : 唤醒的线程不会立即执行,它会与其他线程一起,争夺资源 /** * Object类的notify()和notifyAll()方法详 ...

  3. 【Struts】strust.xml中<result type="">所有类型详解

    在默认时,<result>标签的type属性值是“dispatcher”(实际上就是转发,forward).开发人员可以根据自己的需要指定不同的类型,如redirect.stream等.如 ...

  4. web.xml中的<jsp-config>的用法详解

    <jsp-config> 包括<taglib> 和<jsp-property-group> 两个子元素. 其中<taglib>元素在JSP 1.2时就已 ...

  5. Solr schema.xml中修改id的类型为int

    使用solr6的版本的时候(solr5不存在这个问题),在修改schema.xml的field时,想使用int做为id的数据类型,修改后重新加载配置的时候报错.原来schema.xml中field i ...

  6. solr schema.xml文档节点配置

    首先,讲解一下/usr/local/solr/collection1/conf/schema.xml的配置,此文档功能类似于配置索引数据库. Field:类似于数据库字段的属性(此文统一使用用“字段” ...

  7. Android中全局搜索(QuickSearchBox)详解

    http://blog.csdn.net/mayingcai1987/article/details/6268732 1. 标题: 应用程序如何全面支持搜索 2. 引言: 如果想让某个应用程序支持全局 ...

  8. Spring中@Value标签的使用详解

    1.@Value标签 由于Spring对通过IOC的方式对对象进行统一管理,所以对任何对象而言,其生成方法均由Spring管理.传统的方法是通过XML配置每一个Bean,并对这个Bean的所有Fiel ...

  9. Nmap在实战中的高级用法(详解)

    @ 目录 Nmap在实战中的高级用法(详解) Nmap简单的扫描方式: 一.Nmap高级选项 1.查看本地路由与接口 2.指定网口与IP地址 3.定制探测包 二.Nmap扫描防火墙 1.SYN扫描 2 ...

随机推荐

  1. AngulaJS路由 ui-router 传递多个参数

    定义路由: .state('txnresult', { url: '/txnresult/:originAmount/:finalAmount/:currentPoint/:txnId/:discou ...

  2. Ubuntu 16.10下的eclipse

    下载后解压,放到文件下,打开此文件左边齿轮状的东西,即可指引安装:

  3. 形象的讲解angular中的$q与promise(转)

    以下内容摘自http://www.ngnice.com/posts/126ee9cf6ddb68 promise不是angular首创的,作为一种编程模式,它出现在……1976年,比js还要古老得多. ...

  4. [转]保护眼睛的Windows和IE、Firefox、谷歌等浏览器颜色设置

    保护眼睛的Windows和IE.Firefox.谷歌等浏览器颜色设置  长时间在电脑前工作,窗口和网页上的白色十分刺眼,眼睛很容易疲劳,也容易引起头痛,其实我们可以通过设置Windows窗口和软件的颜 ...

  5. 通过RGB灯输出七色

    本文由博主原创,如有不对之处请指明,转载请说明出处. /********************************* 代码功能:输出模拟信号,控制RGB灯的颜色 使用函数: pinMode(引脚 ...

  6. Singleton in C++11 style

    #include <iostream> #include <memory> #include <mutex> class SingletonOld { static ...

  7. 【转】oracle 监听静态注册举例解析

    网上有很多关于oracle 监听静态注册的文章,但大多都是简单说说,并没有详细的例子,这里,将结合linux as3 下的oracle 10gR2.0.1 举一个具体的例子 1.在 $ORACLE_H ...

  8. Android开发工具全面转向Android Studio(2)——AS project/module的CRUD

    本文有些地方可能需要衔接Android开发工具全面转向Android Studio(1)——准备开发环境,读起来效果会更好. 这个世界很奇妙,所有的东西离不开CRUD,即增删改查.即使人本身也遵循这个 ...

  9. lightoj 1427 - Substring Frequency (II) AC自动机

    模板题,找来测代码. 注意有相同单词 //#pragma comment(linker, "/STACK:1024000000,1024000000") #include<c ...

  10. Android框架之AndroidAnnotations详细讲解

    一: (1)一个activity如过使用AndroidAnnotions注入时, 那么它在 AndroidManifest.xml注册时,应该加入_ 比如: MainActivity的注册时 < ...