1 <?xml version="1.0" encoding="UTF-8" ?> 2 <!-- 3 Licensed to the Apache Software Foundation (ASF) under one or more 4 contributor license agreements. See the NOTICE file distributed with 5 this work for additional information regarding copyright ownership. 6 The ASF licenses this file to You under the Apache License, Version 2.0 7 (the "License"); you may not use this file except in compliance with 8 the License. You may obtain a copy of the License at 9 10 http://www.apache.org/licenses/LICENSE-2.0 11 12 Unless required by applicable law or agreed to in writing, software 13 distributed under the License is distributed on an "AS IS" BASIS, 14 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 See the License for the specific language governing permissions and 16 limitations under the License. 17 --> 18 19 <!-- 20 This is the Solr schema file. This file should be named "schema.xml" and 21 should be in the conf directory under the solr home 22 (i.e. ./solr/conf/schema.xml by default) 23 or located where the classloader for the Solr webapp can find it. 24 25 This example schema is the recommended starting point for users. 26 It should be kept correct and concise, usable out-of-the-box. 27 28 For more information, on how to customize this file, please see 29 http://wiki.apache.org/solr/SchemaXml 30 31 PERFORMANCE NOTE: this schema includes many optional features and should not 32 be used for benchmarking. To improve performance one could 33 - set stored="false" for all fields possible (esp large fields) when you 34 only need to search on the field but don't need to return the original 35 value. 36 - set indexed="false" if you don't need to search on the field, but only 37 return the field as a result of searching on other indexed fields. 38 - remove all unneeded copyField statements 39 - for best index size and searching performance, set "index" to false 40 for all general text fields, use copyField to copy them to the 41 catchall "text" field, and use that for searching. 42 - For maximum indexing performance, use the ConcurrentUpdateSolrServer 43 java client. 44 - Remember to run the JVM in server mode, and use a higher logging level 45 that avoids logging every request 46 --> 47 48 <schema name="example" version="1.5"> 49 <!-- attribute "name" is the name of this schema and is only used for display purposes. 50 version="x.y" is Solr's version number for the schema syntax and 51 semantics. It should not normally be changed by applications. 52 53 1.0: multiValued attribute did not exist, all fields are multiValued 54 by nature 55 1.1: multiValued attribute introduced, false by default 56 1.2: omitTermFreqAndPositions attribute introduced, true by default 57 except for text fields. 58 1.3: removed optional field compress feature 59 1.4: autoGeneratePhraseQueries attribute introduced to drive QueryParser 60 behavior when a single string produces multiple tokens. Defaults 61 to off for version >= 1.4 62 1.5: omitNorms defaults to true for primitive field types 63 (int, float, boolean, string...) 64 --> 65 66 67 <!-- Valid attributes for fields: 68 name: 必填-字段的名称 69 type: 必填- 字段的类型,来源于<fieldType>部分 70 indexed: 是否被索引,只有设置为true的字段才能进行搜索排序 71 stored: 是否存储内容,如果不需要存储字段值,尽量设置为false以提高效率 72 docValues: DocValues从Lucene4.2和Solr4.2开始加入,通过建立字段的正排索引(设置为true),提升sorting, faceting, grouping, function queries等性能。 73 虽然没有必要,doc values 将使得索引更快加载,更加友好,效率更高。然而,它们配备了一些限制, 74 它们目前仅支持StrField,UUIDField 和所有的Trie*Fields,并且根据字段类型,它们可能需要这个 75 字段是单值(single-value),必填或者有一个默认值(检查你感兴趣的字段类型的文档了解更多信息) 76 multiValued: 是否为多值类型,SOLR允许配置多个数据源字段存储到一个搜索字段中。多个值选项必须为true,否则有可能抛出异常。 77 termVectors: 默认为false,当设置true,会存储 term vector。当使用MoreLikeThis,用来作为相似词的field应该存储起来。 78 termPositions: 存储 term vector中的地址信息,会消耗存储开销 79 termOffsets: 存储 term vector 的偏移量,会消耗存储开销。 80 required: 必填,如果不填则会报错。 81 default: 默认值,如果没有属性需要修改,就可以用这个标识下。 82 --> 83 84 <!-- field names should consist of alphanumeric or underscore characters only and 85 not start with a digit. This is not currently strictly enforced, 86 but other field names will not have first class support from all components 87 and back compatibility is not guaranteed. Names with both leading and 88 trailing underscores (e.g. _version_) are reserved. 89 --> 90 91 <!-- If you remove this field, you must _also_ disable the update log in solrconfig.xml 92 or Solr won't start. _version_ and update log are required for SolrCloud 93 --> 94 <field name="_version_" type="long" indexed="true" stored="true"/> 95 96 <!-- points to the root document of a block of nested documents. Required for nested 97 document support, may be removed otherwise 98 --> 99 <field name="_root_" type="string" indexed="true" stored="false"/> 100 101 <!-- Only remove the "id" field if you have a very good reason to. While not strictly 102 required, it is highly recommended. A <uniqueKey> is present in almost all Solr 103 installations. See the <uniqueKey> declaration below where <uniqueKey> is set to "id". 104 --> 105 <field name="id" type="string" indexed="true" stored="true" required="true" multiValued="false" /> 106 107 <field name="sku" type="text_en_splitting_tight" indexed="true" stored="true" omitNorms="true"/> 108 <field name="name" type="text_general" indexed="true" stored="true"/> 109 <field name="manu" type="text_general" indexed="true" stored="true" omitNorms="true"/> 110 <field name="cat" type="string" indexed="true" stored="true" multiValued="true"/> 111 <field name="features" type="text_general" indexed="true" stored="true" multiValued="true"/> 112 <field name="includes" type="text_general" indexed="true" stored="true" termVectors="true" termPositions="true" termOffsets="true" /> 113 114 <field name="weight" type="float" indexed="true" stored="true"/> 115 <field name="price" type="float" indexed="true" stored="true"/> 116 <field name="popularity" type="int" indexed="true" stored="true" /> 117 <field name="inStock" type="boolean" indexed="true" stored="true" /> 118 119 <field name="store" type="location" indexed="true" stored="true"/> 120 121 <!-- Common metadata fields, named specifically to match up with 122 SolrCell metadata when parsing rich documents such as Word, PDF. 123 Some fields are multiValued only because Tika currently may return 124 multiple values for them. Some metadata is parsed from the documents, 125 but there are some which come from the client context: 126 "content_type": From the HTTP headers of incoming stream 127 "resourcename": From SolrCell request param resource.name 128 --> 129 <field name="title" type="text_general" indexed="true" stored="true" multiValued="true"/> 130 <field name="subject" type="text_general" indexed="true" stored="true"/> 131 <field name="description" type="text_general" indexed="true" stored="true"/> 132 <field name="comments" type="text_general" indexed="true" stored="true"/> 133 <field name="author" type="text_general" indexed="true" stored="true"/> 134 <field name="keywords" type="text_general" indexed="true" stored="true"/> 135 <field name="category" type="text_general" indexed="true" stored="true"/> 136 <field name="resourcename" type="text_general" indexed="true" stored="true"/> 137 <field name="url" type="text_general" indexed="true" stored="true"/> 138 <field name="content_type" type="string" indexed="true" stored="true" multiValued="true"/> 139 <field name="last_modified" type="date" indexed="true" stored="true"/> 140 <field name="links" type="string" indexed="true" stored="true" multiValued="true"/> 141 142 <!-- Main body of document extracted by SolrCell. 143 NOTE: This field is not indexed by default, since it is also copied to "text" 144 using copyField below. This is to save space. Use this field for returning and 145 highlighting document content. Use the "text" field to search the content. --> 146 <field name="content" type="text_general" indexed="false" stored="true" multiValued="true"/> 147 148 149 <!-- catchall field, containing all other searchable text fields (implemented 150 via copyField further on in this schema --> 151 <field name="text" type="text_ik" indexed="true" stored="false" multiValued="true"/> 152 153 154 155 <!-- catchall text field that indexes tokens both normally and in reverse for efficient 156 leading wildcard queries. --> 157 <field name="text_rev" type="text_general_rev" indexed="true" stored="false" multiValued="true"/> 158 159 <!-- non-tokenized version of manufacturer to make it easier to sort or group 160 results by manufacturer. copied from "manu" via copyField --> 161 <field name="manu_exact" type="string" indexed="true" stored="false"/> 162 163 <field name="payloads" type="payloads" indexed="true" stored="true"/> 164 165 166 <!-- 167 Some fields such as popularity and manu_exact could be modified to 168 leverage doc values: 169 <field name="popularity" type="int" indexed="true" stored="true" docValues="true" /> 170 <field name="manu_exact" type="string" indexed="false" stored="false" docValues="true" /> 171 <field name="cat" type="string" indexed="true" stored="true" docValues="true" multiValued="true"/> 172 173 174 Although it would make indexing slightly slower and the index bigger, it 175 would also make the index faster to load, more memory-efficient and more 176 NRT-friendly. 177 --> 178 179 <!-- Dynamic field definitions allow using convention over configuration 180 for fields via the specification of patterns to match field names. 181 EXAMPLE: name="*_i" will match any field ending in _i (like myid_i, z_i) 182 RESTRICTION: the glob-like pattern in the name attribute must have 183 a "*" only at the start or the end. --> 184 185 <dynamicField name="*_i" type="int" indexed="true" stored="true"/> 186 <dynamicField name="*_is" type="int" indexed="true" stored="true" multiValued="true"/> 187 <dynamicField name="*_s" type="string" indexed="true" stored="true" /> 188 <dynamicField name="*_ss" type="string" indexed="true" stored="true" multiValued="true"/> 189 <dynamicField name="*_l" type="long" indexed="true" stored="true"/> 190 <dynamicField name="*_ls" type="long" indexed="true" stored="true" multiValued="true"/> 191 <dynamicField name="*_t" type="text_general" indexed="true" stored="true"/> 192 <dynamicField name="*_txt" type="text_general" indexed="true" stored="true" multiValued="true"/> 193 <dynamicField name="*_en" type="text_en" indexed="true" stored="true" multiValued="true"/> 194 <dynamicField name="*_b" type="boolean" indexed="true" stored="true"/> 195 <dynamicField name="*_bs" type="boolean" indexed="true" stored="true" multiValued="true"/> 196 <dynamicField name="*_f" type="float" indexed="true" stored="true"/> 197 <dynamicField name="*_fs" type="float" indexed="true" stored="true" multiValued="true"/> 198 <dynamicField name="*_d" type="double" indexed="true" stored="true"/> 199 <dynamicField name="*_ds" type="double" indexed="true" stored="true" multiValued="true"/> 200 201 <!-- Type used to index the lat and lon components for the "location" FieldType --> 202 <dynamicField name="*_coordinate" type="tdouble" indexed="true" stored="false" /> 203 204 <dynamicField name="*_dt" type="date" indexed="true" stored="true"/> 205 <dynamicField name="*_dts" type="date" indexed="true" stored="true" multiValued="true"/> 206 <dynamicField name="*_p" type="location" indexed="true" stored="true"/> 207 208 <!-- some trie-coded dynamic fields for faster range queries --> 209 <dynamicField name="*_ti" type="tint" indexed="true" stored="true"/> 210 <dynamicField name="*_tl" type="tlong" indexed="true" stored="true"/> 211 <dynamicField name="*_tf" type="tfloat" indexed="true" stored="true"/> 212 <dynamicField name="*_td" type="tdouble" indexed="true" stored="true"/> 213 <dynamicField name="*_tdt" type="tdate" indexed="true" stored="true"/> 214 215 <dynamicField name="*_c" type="currency" indexed="true" stored="true"/> 216 217 <dynamicField name="ignored_*" type="ignored" multiValued="true"/> 218 <dynamicField name="attr_*" type="text_general" indexed="true" stored="true" multiValued="true"/> 219 220 <dynamicField name="random_*" type="random" /> 221 222 <!-- uncomment the following to ignore any fields that don't already match an existing 223 field name or dynamic field, rather than reporting them as an error. 224 alternately, change the type="ignored" to some other type e.g. "text" if you want 225 unknown fields indexed and/or stored by default --> 226 <!--dynamicField name="*" type="ignored" multiValued="true" /--> 227 228 229 230 231 <!-- Field to use to determine and enforce document uniqueness. 232 Unless this field is marked with required="false", it will be a required field 233 --> 234 <uniqueKey>id</uniqueKey> 235 236 <!-- DEPRECATED: The defaultSearchField is consulted by various query parsers when 237 parsing a query string that isn't explicit about the field. Machine (non-user) 238 generated queries are best made explicit, or they can use the "df" request parameter 239 which takes precedence over this. 240 Note: Un-commenting defaultSearchField will be insufficient if your request handler 241 in solrconfig.xml defines "df", which takes precedence. That would need to be removed. 242 <defaultSearchField>text</defaultSearchField> --> 243 244 <!-- DEPRECATED: The defaultOperator (AND|OR) is consulted by various query parsers 245 when parsing a query string to determine if a clause of the query should be marked as 246 required or optional, assuming the clause isn't already marked by some operator. 247 The default is OR, which is generally assumed so it is not a good idea to change it 248 globally here. The "q.op" request parameter takes precedence over this. 249 <solrQueryParser defaultOperator="OR"/> --> 250 251 <!-- copyField commands copy one field to another at the time a document 252 is added to the index. It's used either to index the same field differently, 253 or to add multiple fields to the same field for easier/faster searching. --> 254 255 <copyField source="cat" dest="text"/> 256 <copyField source="name" dest="text"/> 257 <copyField source="manu" dest="text"/> 258 <copyField source="features" dest="text"/> 259 <copyField source="includes" dest="text"/> 260 <copyField source="manu" dest="manu_exact"/> 261 262 <!-- Copy the price into a currency enabled field (default USD) --> 263 <copyField source="price" dest="price_c"/> 264 265 <!-- Text fields from SolrCell to search by default in our catch-all field --> 266 <copyField source="title" dest="text"/> 267 <copyField source="author" dest="text"/> 268 <copyField source="description" dest="text"/> 269 <copyField source="keywords" dest="text"/> 270 <copyField source="content" dest="text"/> 271 <copyField source="content_type" dest="text"/> 272 <copyField source="resourcename" dest="text"/> 273 <copyField source="url" dest="text"/> 274 275 <!-- Create a string version of author for faceting --> 276 <copyField source="author" dest="author_s"/> 277 278 <!-- Above, multiple source fields are copied to the [text] field. 279 Another way to map multiple source fields to the same 280 destination field is to use the dynamic field syntax. 281 copyField also supports a maxChars to copy setting. --> 282 283 <!-- <copyField source="*_t" dest="text" maxChars="3000"/> --> 284 285 <!-- copy name to alphaNameSort, a field designed for sorting by name --> 286 <!-- <copyField source="name" dest="alphaNameSort"/> --> 287 288 289 <!-- field type definitions. The "name" attribute is 290 just a label to be used by field definitions. The "class" 291 attribute and any other attributes determine the real 292 behavior of the fieldType. 293 Class names starting with "solr" refer to java classes in a 294 standard package such as org.apache.solr.analysis 295 --> 296 297 <!-- The StrField type is not analyzed, but indexed/stored verbatim. 298 It supports doc values but in that case the field needs to be 299 single-valued and either required or have a default value. 300 --> 301 <fieldType name="string" class="solr.StrField" sortMissingLast="true" /> 302 303 <!-- boolean type: "true" or "false" --> 304 <fieldType name="boolean" class="solr.BoolField" sortMissingLast="true"/> 305 306 307 <fieldType name="text_ik" class="solr.TextField"> 308 <!--索引时候的分词器--> 309 <analyzer type="index" isMaxWordLength="false" class="org.wltea.analyzer.lucene.IKAnalyzer"/> 310 <!--查询时候的分词器--> 311 <analyzer type="query" isMaxWordLength="true" class="org.wltea.analyzer.lucene.IKAnalyzer"/> 312 </fieldType> 313 314 <!-- 315 sortMissingLast 和 sortMissingFirst对<field>的属性之一。只在对该<field>进行排序时,才起作用。 316 sortMissingLast = true时,那些在该<field>上没有值的documents将被排在那些在该<field>上有值的documents之后。 317 sortMissingFirst = true时的情况正好相反。 318 319 如果两者都设为false,则使用Lucene的排序。 320 321 322 sortMissingLast and sortMissingFirst attributes are optional attributes are 323 currently supported on types that are sorted internally as strings 324 and on numeric types. 325 This includes "string","boolean", and, as of 3.5 (and 4.x), 326 int, float, long, date, double, including the "Trie" variants. 327 - If sortMissingLast="true", then a sort on this field will cause documents 328 without the field to come after documents with the field, 329 regardless of the requested sort order (asc or desc). 330 - If sortMissingFirst="true", then a sort on this field will cause documents 331 without the field to come before documents with the field, 332 regardless of the requested sort order. 333 - If sortMissingLast="false" and sortMissingFirst="false" (the default), 334 then default lucene sorting will be used which places docs without the 335 field first in an ascending sort and last in a descending sort. 336 --> 337 338 <!-- 339 precisionStep:这个复杂了,只能简单说说,precisionStep是在做range search的起作用的,默认值是4; 340 数值类型(int float double)在Lucene里都是以string形式存储的,当然这个string是经过编码的, 341 经过编码后的string保证是顺序的,也就是说num1>num2,那么strNum1>strNum2。precisionStep用来 342 分解编码后的string,例如有一个precisionStep,默认是4,也就是隔4位索引一个前缀, 343 比如0100,0011,0001,1010会被分成下列的二进制位“0100,0011,0001,1010“,”0100,0011,0001“,0100,0011“,”0100“。 344 这个值越大,那么索引就越小,那么范围查询的性能(尤其是细粒度的范围查询)也越差;这个值越小,索引就越大, 345 那么性能越差。就讲这么多了,如果希望进一步了解, 346 参见:http://ecm-kit.15604.n6.nabble.com/solr-precisionStep-positionIncrementGap-td5000919.html#a5000920 347 348 positionIncrementGap:用在多值字段的匹配规则上。例如有一个多值字段有2个值A和B。 349 如果positionIncrementGap=0;那么A和B对应的位置0,1,那么查询“A B”你是可以命中的。 350 假如你不希望命中,你可以将positionIncrementGap设置为100,这时,A和B对应的位置0,101, 351 那么此时查询“A B”将无结果。 352 353 354 355 Default numeric field types. For faster range queries, consider the tint/tfloat/tlong/tdouble types. 356 357 These fields support doc values, but they require the field to be 358 single-valued and either be required or have a default value. 359 360 --> 361 <fieldType name="int" class="solr.TrieIntField" precisionStep="0" positionIncrementGap="0"/> 362 <fieldType name="float" class="solr.TrieFloatField" precisionStep="0" positionIncrementGap="0"/> 363 <fieldType name="long" class="solr.TrieLongField" precisionStep="0" positionIncrementGap="0"/> 364 <fieldType name="double" class="solr.TrieDoubleField" precisionStep="0" positionIncrementGap="0"/> 365 366 <!-- 367 Numeric field types that index each value at various levels of precision 368 to accelerate range queries when the number of values between the range 369 endpoints is large. See the javadoc for NumericRangeQuery for internal 370 implementation details. 371 372 Smaller precisionStep values (specified in bits) will lead to more tokens 373 indexed per value, slightly larger index size, and faster range queries. 374 A precisionStep of 0 disables indexing at different precision levels. 375 --> 376 <fieldType name="tint" class="solr.TrieIntField" precisionStep="8" positionIncrementGap="0"/> 377 <fieldType name="tfloat" class="solr.TrieFloatField" precisionStep="8" positionIncrementGap="0"/> 378 <fieldType name="tlong" class="solr.TrieLongField" precisionStep="8" positionIncrementGap="0"/> 379 <fieldType name="tdouble" class="solr.TrieDoubleField" precisionStep="8" positionIncrementGap="0"/> 380 381 <!-- The format for this date field is of the form 1995-12-31T23:59:59Z, and 382 is a more restricted form of the canonical representation of dateTime 383 http://www.w3.org/TR/xmlschema-2/#dateTime 384 The trailing "Z" designates UTC time and is mandatory. 385 Optional fractional seconds are allowed: 1995-12-31T23:59:59.999Z 386 All other components are mandatory. 387 388 Expressions can also be used to denote calculations that should be 389 performed relative to "NOW" to determine the value, ie... 390 391 NOW/HOUR 392 ... Round to the start of the current hour 393 NOW-1DAY 394 ... Exactly 1 day prior to now 395 NOW/DAY+6MONTHS+3DAYS 396 ... 6 months and 3 days in the future from the start of 397 the current day 398 399 Consult the DateField javadocs for more information. 400 401 Note: For faster range queries, consider the tdate type 402 --> 403 <fieldType name="date" class="solr.TrieDateField" precisionStep="0" positionIncrementGap="0"/> 404 405 <!-- A Trie based date field for faster date range queries and date faceting. --> 406 <fieldType name="tdate" class="solr.TrieDateField" precisionStep="6" positionIncrementGap="0"/> 407 408 409 <!--Binary data type. The data should be sent/retrieved in as Base64 encoded Strings --> 410 <fieldtype name="binary" class="solr.BinaryField"/> 411 412 <!-- 413 Note: 414 These should only be used for compatibility with existing indexes (created with lucene or older Solr versions). 415 Use Trie based fields instead. As of Solr 3.5 and 4.x, Trie based fields support sortMissingFirst/Last 416 417 Plain numeric field types that store and index the text 418 value verbatim (and hence don't correctly support range queries, since the 419 lexicographic ordering isn't equal to the numeric ordering) 420 421 NOTE: These field types are deprecated will be completely removed in Solr 5.0! 422 --> 423 <!-- 424 <fieldType name="pint" class="solr.IntField"/> 425 <fieldType name="plong" class="solr.LongField"/> 426 <fieldType name="pfloat" class="solr.FloatField"/> 427 <fieldType name="pdouble" class="solr.DoubleField"/> 428 <fieldType name="pdate" class="solr.DateField" sortMissingLast="true"/> 429 --> 430 431 <!-- The "RandomSortField" is not used to store or search any 432 data. You can declare fields of this type it in your schema 433 to generate pseudo-random orderings of your docs for sorting 434 or function purposes. The ordering is generated based on the field 435 name and the version of the index. As long as the index version 436 remains unchanged, and the same field name is reused, 437 the ordering of the docs will be consistent. 438 If you want different psuedo-random orderings of documents, 439 for the same version of the index, use a dynamicField and 440 change the field name in the request. 441 --> 442 <fieldType name="random" class="solr.RandomSortField" indexed="true" /> 443 444 <!-- solr.TextField allows the specification of custom text analyzers 445 specified as a tokenizer and a list of token filters. Different 446 analyzers may be specified for indexing and querying. 447 448 The optional positionIncrementGap puts space between multiple fields of 449 this type on the same document, with the purpose of preventing false phrase 450 matching across fields. 451 452 For more info on customizing your analyzer chain, please see 453 http://wiki.apache.org/solr/AnalyzersTokenizersTokenFilters 454 --> 455 456 <!-- One can also specify an existing Analyzer class that has a 457 default constructor via the class attribute on the analyzer element. 458 Example: 459 <fieldType name="text_greek" class="solr.TextField"> 460 <analyzer class="org.apache.lucene.analysis.el.GreekAnalyzer"/> 461 </fieldType> 462 --> 463 464 <!-- 465 文本字段只按空白进行分割单词的精确匹配 466 A text field that only splits on whitespace for exact matching of words --> 467 <fieldType name="text_ws" class="solr.TextField" positionIncrementGap="100"> 468 <analyzer> 469 <tokenizer class="solr.WhitespaceTokenizerFactory"/> 470 </analyzer> 471 </fieldType> 472 473 <!-- 474 其中,禁用词和同义词使用REST API管理的英文文本的文本类型 475 A text type for English text where stopwords and synonyms are managed using the REST API --> 476 <fieldType name="managed_en" class="solr.TextField" positionIncrementGap="100"> 477 <analyzer> 478 <tokenizer class="solr.StandardTokenizerFactory"/> 479 <filter class="solr.ManagedStopFilterFactory" managed="english" /> 480 <filter class="solr.ManagedSynonymFilterFactory" managed="english" /> 481 </analyzer> 482 </fieldType> 483 484 <!-- A general text field that has reasonable, generic 485 cross-language defaults: it tokenizes with StandardTokenizer, 486 removes stop words from case-insensitive "stopwords.txt" 487 (empty by default), and down cases. At query time only, it 488 also applies synonyms. --> 489 <fieldType name="text_general" class="solr.TextField" positionIncrementGap="100"> 490 <analyzer type="index"> 491 <tokenizer class="solr.StandardTokenizerFactory"/> 492 <filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords.txt" /> 493 <!-- in this example, we will only use synonyms at query time 494 在这个例子中,我们将只在查询的时候使用同义词过滤器 495 <filter class="solr.SynonymFilterFactory" synonyms="index_synonyms.txt" ignoreCase="true" expand="false"/> 496 --> 497 <filter class="solr.LowerCaseFilterFactory"/> 498 </analyzer> 499 <analyzer type="query"> 500 <tokenizer class="solr.StandardTokenizerFactory"/> 501 <filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords.txt" /> 502 <filter class="solr.SynonymFilterFactory" synonyms="synonyms.txt" ignoreCase="true" expand="true"/> 503 <filter class="solr.LowerCaseFilterFactory"/> 504 </analyzer> 505 </fieldType> 506 507 <!-- A text field with defaults appropriate for English: it 508 tokenizes with StandardTokenizer, removes English stop words 509 (lang/stopwords_en.txt), down cases, protects words from protwords.txt, and 510 finally applies Porter's stemming. The query time analyzer 511 also applies synonyms from synonyms.txt. --> 512 <fieldType name="text_en" class="solr.TextField" positionIncrementGap="100"> 513 <analyzer type="index"> 514 <tokenizer class="solr.StandardTokenizerFactory"/> 515 <!-- in this example, we will only use synonyms at query time 516 <filter class="solr.SynonymFilterFactory" synonyms="index_synonyms.txt" ignoreCase="true" expand="false"/> 517 --> 518 <!-- Case insensitive stop word removal. 519 --> 520 <filter class="solr.StopFilterFactory" 521 ignoreCase="true" 522 words="lang/stopwords_en.txt" 523 /> 524 <filter class="solr.LowerCaseFilterFactory"/> 525 <filter class="solr.EnglishPossessiveFilterFactory"/> 526 <filter class="solr.KeywordMarkerFilterFactory" protected="protwords.txt"/> 527 <!-- Optionally you may want to use this less aggressive stemmer instead of PorterStemFilterFactory: 528 <filter class="solr.EnglishMinimalStemFilterFactory"/> 529 --> 530 <filter class="solr.PorterStemFilterFactory"/> 531 </analyzer> 532 <analyzer type="query"> 533 <tokenizer class="solr.StandardTokenizerFactory"/> 534 <filter class="solr.SynonymFilterFactory" synonyms="synonyms.txt" ignoreCase="true" expand="true"/> 535 <filter class="solr.StopFilterFactory" 536 ignoreCase="true" 537 words="lang/stopwords_en.txt" 538 /> 539 <filter class="solr.LowerCaseFilterFactory"/> 540 <filter class="solr.EnglishPossessiveFilterFactory"/> 541 <filter class="solr.KeywordMarkerFilterFactory" protected="protwords.txt"/> 542 <!-- Optionally you may want to use this less aggressive stemmer instead of PorterStemFilterFactory: 543 <filter class="solr.EnglishMinimalStemFilterFactory"/> 544 --> 545 <filter class="solr.PorterStemFilterFactory"/> 546 </analyzer> 547 </fieldType> 548 549 <!-- A text field with defaults appropriate for English, plus 550 aggressive word-splitting and autophrase features enabled. 551 This field is just like text_en, except it adds 552 WordDelimiterFilter to enable splitting and matching of 553 words on case-change, alpha numeric boundaries, and 554 non-alphanumeric chars. This means certain compound word 555 cases will work, for example query "wi fi" will match 556 document "WiFi" or "wi-fi". 557 --> 558 <fieldType name="text_en_splitting" class="solr.TextField" positionIncrementGap="100" autoGeneratePhraseQueries="true"> 559 <analyzer type="index"> 560 <tokenizer class="solr.WhitespaceTokenizerFactory"/> 561 <!-- in this example, we will only use synonyms at query time 562 <filter class="solr.SynonymFilterFactory" synonyms="index_synonyms.txt" ignoreCase="true" expand="false"/> 563 --> 564 <!-- Case insensitive stop word removal. 565 --> 566 <filter class="solr.StopFilterFactory" 567 ignoreCase="true" 568 words="lang/stopwords_en.txt" 569 /> 570 <filter class="solr.WordDelimiterFilterFactory" generateWordParts="1" generateNumberParts="1" catenateWords="1" catenateNumbers="1" catenateAll="0" splitOnCaseChange="1"/> 571 <filter class="solr.LowerCaseFilterFactory"/> 572 <filter class="solr.KeywordMarkerFilterFactory" protected="protwords.txt"/> 573 <filter class="solr.PorterStemFilterFactory"/> 574 </analyzer> 575 <analyzer type="query"> 576 <tokenizer class="solr.WhitespaceTokenizerFactory"/> 577 <filter class="solr.SynonymFilterFactory" synonyms="synonyms.txt" ignoreCase="true" expand="true"/> 578 <filter class="solr.StopFilterFactory" 579 ignoreCase="true" 580 words="lang/stopwords_en.txt" 581 /> 582 <filter class="solr.WordDelimiterFilterFactory" generateWordParts="1" generateNumberParts="1" catenateWords="0" catenateNumbers="0" catenateAll="0" splitOnCaseChange="1"/> 583 <filter class="solr.LowerCaseFilterFactory"/> 584 <filter class="solr.KeywordMarkerFilterFactory" protected="protwords.txt"/> 585 <filter class="solr.PorterStemFilterFactory"/> 586 </analyzer> 587 </fieldType> 588 589 <!-- Less flexible matching, but less false matches. Probably not ideal for product names, 590 but may be good for SKUs. Can insert dashes in the wrong place and still match. --> 591 <fieldType name="text_en_splitting_tight" class="solr.TextField" positionIncrementGap="100" autoGeneratePhraseQueries="true"> 592 <analyzer> 593 <tokenizer class="solr.WhitespaceTokenizerFactory"/> 594 <filter class="solr.SynonymFilterFactory" synonyms="synonyms.txt" ignoreCase="true" expand="false"/> 595 <filter class="solr.StopFilterFactory" ignoreCase="true" words="lang/stopwords_en.txt"/> 596 <filter class="solr.WordDelimiterFilterFactory" generateWordParts="0" generateNumberParts="0" catenateWords="1" catenateNumbers="1" catenateAll="0"/> 597 <filter class="solr.LowerCaseFilterFactory"/> 598 <filter class="solr.KeywordMarkerFilterFactory" protected="protwords.txt"/> 599 <filter class="solr.EnglishMinimalStemFilterFactory"/> 600 <!-- this filter can remove any duplicate tokens that appear at the same position - sometimes 601 possible with WordDelimiterFilter in conjuncton with stemming. --> 602 <filter class="solr.RemoveDuplicatesTokenFilterFactory"/> 603 </analyzer> 604 </fieldType> 605 606 <!-- Just like text_general except it reverses the characters of 607 each token, to enable more efficient leading wildcard queries. --> 608 <fieldType name="text_general_rev" class="solr.TextField" positionIncrementGap="100"> 609 <analyzer type="index"> 610 <tokenizer class="solr.StandardTokenizerFactory"/> 611 <filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords.txt" /> 612 <filter class="solr.LowerCaseFilterFactory"/> 613 <filter class="solr.ReversedWildcardFilterFactory" withOriginal="true" 614 maxPosAsterisk="3" maxPosQuestion="2" maxFractionAsterisk="0.33"/> 615 </analyzer> 616 <analyzer type="query"> 617 <tokenizer class="solr.StandardTokenizerFactory"/> 618 <filter class="solr.SynonymFilterFactory" synonyms="synonyms.txt" ignoreCase="true" expand="true"/> 619 <filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords.txt" /> 620 <filter class="solr.LowerCaseFilterFactory"/> 621 </analyzer> 622 </fieldType> 623 624 <!-- charFilter + WhitespaceTokenizer --> 625 <!-- 626 <fieldType name="text_char_norm" class="solr.TextField" positionIncrementGap="100" > 627 <analyzer> 628 <charFilter class="solr.MappingCharFilterFactory" mapping="mapping-ISOLatin1Accent.txt"/> 629 <tokenizer class="solr.WhitespaceTokenizerFactory"/> 630 </analyzer> 631 </fieldType> 632 --> 633 634 <!-- This is an example of using the KeywordTokenizer along 635 With various TokenFilterFactories to produce a sortable field 636 that does not include some properties of the source text 637 --> 638 <fieldType name="alphaOnlySort" class="solr.TextField" sortMissingLast="true" omitNorms="true"> 639 <analyzer> 640 <!-- KeywordTokenizer does no actual tokenizing, so the entire 641 input string is preserved as a single token 642 --> 643 <tokenizer class="solr.KeywordTokenizerFactory"/> 644 <!-- The LowerCase TokenFilter does what you expect, which can be 645 when you want your sorting to be case insensitive 646 --> 647 <filter class="solr.LowerCaseFilterFactory" /> 648 <!-- The TrimFilter removes any leading or trailing whitespace --> 649 <filter class="solr.TrimFilterFactory" /> 650 <!-- The PatternReplaceFilter gives you the flexibility to use 651 Java Regular expression to replace any sequence of characters 652 matching a pattern with an arbitrary replacement string, 653 which may include back references to portions of the original 654 string matched by the pattern. 655 656 See the Java Regular Expression documentation for more 657 information on pattern and replacement string syntax. 658 659 http://docs.oracle.com/javase/7/docs/api/java/util/regex/package-summary.html 660 --> 661 <filter class="solr.PatternReplaceFilterFactory" 662 pattern="([^a-z])" replacement="" replace="all" 663 /> 664 </analyzer> 665 </fieldType> 666 667 <fieldtype name="phonetic" stored="false" indexed="true" class="solr.TextField" > 668 <analyzer> 669 <tokenizer class="solr.StandardTokenizerFactory"/> 670 <filter class="solr.DoubleMetaphoneFilterFactory" inject="false"/> 671 </analyzer> 672 </fieldtype> 673 674 <fieldtype name="payloads" stored="false" indexed="true" class="solr.TextField" > 675 <analyzer> 676 <tokenizer class="solr.WhitespaceTokenizerFactory"/> 677 <!-- 678 The DelimitedPayloadTokenFilter can put payloads on tokens... for example, 679 a token of "foo|1.4" would be indexed as "foo" with a payload of 1.4f 680 Attributes of the DelimitedPayloadTokenFilterFactory : 681 "delimiter" - a one character delimiter. Default is | (pipe) 682 "encoder" - how to encode the following value into a playload 683 float -> org.apache.lucene.analysis.payloads.FloatEncoder, 684 integer -> o.a.l.a.p.IntegerEncoder 685 identity -> o.a.l.a.p.IdentityEncoder 686 Fully Qualified class name implementing PayloadEncoder, Encoder must have a no arg constructor. 687 --> 688 <filter class="solr.DelimitedPayloadTokenFilterFactory" encoder="float"/> 689 </analyzer> 690 </fieldtype> 691 692 <!-- lowercases the entire field value, keeping it as a single token. --> 693 <fieldType name="lowercase" class="solr.TextField" positionIncrementGap="100"> 694 <analyzer> 695 <tokenizer class="solr.KeywordTokenizerFactory"/> 696 <filter class="solr.LowerCaseFilterFactory" /> 697 </analyzer> 698 </fieldType> 699 700 <!-- 701 Example of using PathHierarchyTokenizerFactory at index time, so 702 queries for paths match documents at that path, or in descendent paths 703 --> 704 <fieldType name="descendent_path" class="solr.TextField"> 705 <analyzer type="index"> 706 <tokenizer class="solr.PathHierarchyTokenizerFactory" delimiter="/" /> 707 </analyzer> 708 <analyzer type="query"> 709 <tokenizer class="solr.KeywordTokenizerFactory" /> 710 </analyzer> 711 </fieldType> 712 <!-- 713 Example of using PathHierarchyTokenizerFactory at query time, so 714 queries for paths match documents at that path, or in ancestor paths 715 --> 716 <fieldType name="ancestor_path" class="solr.TextField"> 717 <analyzer type="index"> 718 <tokenizer class="solr.KeywordTokenizerFactory" /> 719 </analyzer> 720 <analyzer type="query"> 721 <tokenizer class="solr.PathHierarchyTokenizerFactory" delimiter="/" /> 722 </analyzer> 723 </fieldType> 724 725 <!-- since fields of this type are by default not stored or indexed, 726 any data added to them will be ignored outright. --> 727 <fieldtype name="ignored" stored="false" indexed="false" multiValued="true" class="solr.StrField" /> 728 729 <!-- This point type indexes the coordinates as separate fields (subFields) 730 If subFieldType is defined, it references a type, and a dynamic field 731 definition is created matching *___<typename>. Alternately, if 732 subFieldSuffix is defined, that is used to create the subFields. 733 Example: if subFieldType="double", then the coordinates would be 734 indexed in fields myloc_0___double,myloc_1___double. 735 Example: if subFieldSuffix="_d" then the coordinates would be indexed 736 in fields myloc_0_d,myloc_1_d 737 The subFields are an implementation detail of the fieldType, and end 738 users normally should not need to know about them. 739 --> 740 <fieldType name="point" class="solr.PointType" dimension="2" subFieldSuffix="_d"/> 741 742 <!-- A specialized field for geospatial search. If indexed, this fieldType must not be multivalued. --> 743 <fieldType name="location" class="solr.LatLonType" subFieldSuffix="_coordinate"/> 744 745 <!-- An alternative geospatial field type new to Solr 4. It supports multiValued and polygon shapes. 746 For more information about this and other Spatial fields new to Solr 4, see: 747 http://wiki.apache.org/solr/SolrAdaptersForLuceneSpatial4 748 --> 749 <fieldType name="location_rpt" class="solr.SpatialRecursivePrefixTreeFieldType" 750 geo="true" distErrPct="0.025" maxDistErr="0.000009" units="degrees" /> 751 752 <!-- Spatial rectangle (bounding box) field. It supports most spatial predicates, and has 753 special relevancy modes: score=overlapRatio|area|area2D (local-param to the query). DocValues is required for 754 relevancy. --> 755 <fieldType name="bbox" class="solr.BBoxField" 756 geo="true" units="degrees" numberType="_bbox_coord" /> 757 <fieldType name="_bbox_coord" class="solr.TrieDoubleField" precisionStep="8" docValues="true" stored="false"/> 758 759 <!-- Money/currency field type. See http://wiki.apache.org/solr/MoneyFieldType 760 Parameters: 761 defaultCurrency: Specifies the default currency if none specified. Defaults to "USD" 762 precisionStep: Specifies the precisionStep for the TrieLong field used for the amount 763 providerClass: Lets you plug in other exchange provider backend: 764 solr.FileExchangeRateProvider is the default and takes one parameter: 765 currencyConfig: name of an xml file holding exchange rates 766 solr.OpenExchangeRatesOrgProvider uses rates from openexchangerates.org: 767 ratesFileLocation: URL or path to rates JSON file (default latest.json on the web) 768 refreshInterval: Number of minutes between each rates fetch (default: 1440, min: 60) 769 --> 770 <fieldType name="currency" class="solr.CurrencyField" precisionStep="8" defaultCurrency="USD" currencyConfig="currency.xml" /> 771 772 773 774 <!-- 775 不同语言的例子 776 some examples for different languages (generally ordered by ISO code) --> 777 778 <!-- Arabic --> 779 <fieldType name="text_ar" class="solr.TextField" positionIncrementGap="100"> 780 <analyzer> 781 <tokenizer class="solr.StandardTokenizerFactory"/> 782 <!-- for any non-arabic --> 783 <filter class="solr.LowerCaseFilterFactory"/> 784 <filter class="solr.StopFilterFactory" ignoreCase="true" words="lang/stopwords_ar.txt" /> 785 <!-- normalizes ﻯ to ﻱ, etc --> 786 <filter class="solr.ArabicNormalizationFilterFactory"/> 787 <filter class="solr.ArabicStemFilterFactory"/> 788 </analyzer> 789 </fieldType> 790 791 <!-- Bulgarian --> 792 <fieldType name="text_bg" class="solr.TextField" positionIncrementGap="100"> 793 <analyzer> 794 <tokenizer class="solr.StandardTokenizerFactory"/> 795 <filter class="solr.LowerCaseFilterFactory"/> 796 <filter class="solr.StopFilterFactory" ignoreCase="true" words="lang/stopwords_bg.txt" /> 797 <filter class="solr.BulgarianStemFilterFactory"/> 798 </analyzer> 799 </fieldType> 800 801 <!-- Catalan --> 802 <fieldType name="text_ca" class="solr.TextField" positionIncrementGap="100"> 803 <analyzer> 804 <tokenizer class="solr.StandardTokenizerFactory"/> 805 <!-- removes l', etc --> 806 <filter class="solr.ElisionFilterFactory" ignoreCase="true" articles="lang/contractions_ca.txt"/> 807 <filter class="solr.LowerCaseFilterFactory"/> 808 <filter class="solr.StopFilterFactory" ignoreCase="true" words="lang/stopwords_ca.txt" /> 809 <filter class="solr.SnowballPorterFilterFactory" language="Catalan"/> 810 </analyzer> 811 </fieldType> 812 813 <!-- CJK bigram (see text_ja for a Japanese configuration using morphological analysis) --> 814 <fieldType name="text_cjk" class="solr.TextField" positionIncrementGap="100"> 815 <analyzer> 816 <tokenizer class="solr.StandardTokenizerFactory"/> 817 <!-- normalize width before bigram, as e.g. half-width dakuten combine --> 818 <filter class="solr.CJKWidthFilterFactory"/> 819 <!-- for any non-CJK --> 820 <filter class="solr.LowerCaseFilterFactory"/> 821 <filter class="solr.CJKBigramFilterFactory"/> 822 </analyzer> 823 </fieldType> 824 825 <!-- Kurdish --> 826 <fieldType name="text_ckb" class="solr.TextField" positionIncrementGap="100"> 827 <analyzer> 828 <tokenizer class="solr.StandardTokenizerFactory"/> 829 <filter class="solr.SoraniNormalizationFilterFactory"/> 830 <!-- for any latin text --> 831 <filter class="solr.LowerCaseFilterFactory"/> 832 <filter class="solr.StopFilterFactory" ignoreCase="true" words="lang/stopwords_ckb.txt"/> 833 <filter class="solr.SoraniStemFilterFactory"/> 834 </analyzer> 835 </fieldType> 836 837 <!-- Czech --> 838 <fieldType name="text_cz" class="solr.TextField" positionIncrementGap="100"> 839 <analyzer> 840 <tokenizer class="solr.StandardTokenizerFactory"/> 841 <filter class="solr.LowerCaseFilterFactory"/> 842 <filter class="solr.StopFilterFactory" ignoreCase="true" words="lang/stopwords_cz.txt" /> 843 <filter class="solr.CzechStemFilterFactory"/> 844 </analyzer> 845 </fieldType> 846 847 <!-- Danish --> 848 <fieldType name="text_da" class="solr.TextField" positionIncrementGap="100"> 849 <analyzer> 850 <tokenizer class="solr.StandardTokenizerFactory"/> 851 <filter class="solr.LowerCaseFilterFactory"/> 852 <filter class="solr.StopFilterFactory" ignoreCase="true" words="lang/stopwords_da.txt" format="snowball" /> 853 <filter class="solr.SnowballPorterFilterFactory" language="Danish"/> 854 </analyzer> 855 </fieldType> 856 857 <!-- German --> 858 <fieldType name="text_de" class="solr.TextField" positionIncrementGap="100"> 859 <analyzer> 860 <tokenizer class="solr.StandardTokenizerFactory"/> 861 <filter class="solr.LowerCaseFilterFactory"/> 862 <filter class="solr.StopFilterFactory" ignoreCase="true" words="lang/stopwords_de.txt" format="snowball" /> 863 <filter class="solr.GermanNormalizationFilterFactory"/> 864 <filter class="solr.GermanLightStemFilterFactory"/> 865 <!-- less aggressive: <filter class="solr.GermanMinimalStemFilterFactory"/> --> 866 <!-- more aggressive: <filter class="solr.SnowballPorterFilterFactory" language="German2"/> --> 867 </analyzer> 868 </fieldType> 869 870 <!-- Greek --> 871 <fieldType name="text_el" class="solr.TextField" positionIncrementGap="100"> 872 <analyzer> 873 <tokenizer class="solr.StandardTokenizerFactory"/> 874 <!-- greek specific lowercase for sigma --> 875 <filter class="solr.GreekLowerCaseFilterFactory"/> 876 <filter class="solr.StopFilterFactory" ignoreCase="false" words="lang/stopwords_el.txt" /> 877 <filter class="solr.GreekStemFilterFactory"/> 878 </analyzer> 879 </fieldType> 880 881 <!-- Spanish --> 882 <fieldType name="text_es" class="solr.TextField" positionIncrementGap="100"> 883 <analyzer> 884 <tokenizer class="solr.StandardTokenizerFactory"/> 885 <filter class="solr.LowerCaseFilterFactory"/> 886 <filter class="solr.StopFilterFactory" ignoreCase="true" words="lang/stopwords_es.txt" format="snowball" /> 887 <filter class="solr.SpanishLightStemFilterFactory"/> 888 <!-- more aggressive: <filter class="solr.SnowballPorterFilterFactory" language="Spanish"/> --> 889 </analyzer> 890 </fieldType> 891 892 <!-- Basque --> 893 <fieldType name="text_eu" class="solr.TextField" positionIncrementGap="100"> 894 <analyzer> 895 <tokenizer class="solr.StandardTokenizerFactory"/> 896 <filter class="solr.LowerCaseFilterFactory"/> 897 <filter class="solr.StopFilterFactory" ignoreCase="true" words="lang/stopwords_eu.txt" /> 898 <filter class="solr.SnowballPorterFilterFactory" language="Basque"/> 899 </analyzer> 900 </fieldType> 901 902 <!-- Persian --> 903 <fieldType name="text_fa" class="solr.TextField" positionIncrementGap="100"> 904 <analyzer> 905 <!-- for ZWNJ --> 906 <charFilter class="solr.PersianCharFilterFactory"/> 907 <tokenizer class="solr.StandardTokenizerFactory"/> 908 <filter class="solr.LowerCaseFilterFactory"/> 909 <filter class="solr.ArabicNormalizationFilterFactory"/> 910 <filter class="solr.PersianNormalizationFilterFactory"/> 911 <filter class="solr.StopFilterFactory" ignoreCase="true" words="lang/stopwords_fa.txt" /> 912 </analyzer> 913 </fieldType> 914 915 <!-- Finnish --> 916 <fieldType name="text_fi" class="solr.TextField" positionIncrementGap="100"> 917 <analyzer> 918 <tokenizer class="solr.StandardTokenizerFactory"/> 919 <filter class="solr.LowerCaseFilterFactory"/> 920 <filter class="solr.StopFilterFactory" ignoreCase="true" words="lang/stopwords_fi.txt" format="snowball" /> 921 <filter class="solr.SnowballPorterFilterFactory" language="Finnish"/> 922 <!-- less aggressive: <filter class="solr.FinnishLightStemFilterFactory"/> --> 923 </analyzer> 924 </fieldType> 925 926 <!-- French --> 927 <fieldType name="text_fr" class="solr.TextField" positionIncrementGap="100"> 928 <analyzer> 929 <tokenizer class="solr.StandardTokenizerFactory"/> 930 <!-- removes l', etc --> 931 <filter class="solr.ElisionFilterFactory" ignoreCase="true" articles="lang/contractions_fr.txt"/> 932 <filter class="solr.LowerCaseFilterFactory"/> 933 <filter class="solr.StopFilterFactory" ignoreCase="true" words="lang/stopwords_fr.txt" format="snowball" /> 934 <filter class="solr.FrenchLightStemFilterFactory"/> 935 <!-- less aggressive: <filter class="solr.FrenchMinimalStemFilterFactory"/> --> 936 <!-- more aggressive: <filter class="solr.SnowballPorterFilterFactory" language="French"/> --> 937 </analyzer> 938 </fieldType> 939 940 <!-- Irish --> 941 <fieldType name="text_ga" class="solr.TextField" positionIncrementGap="100"> 942 <analyzer> 943 <tokenizer class="solr.StandardTokenizerFactory"/> 944 <!-- removes d', etc --> 945 <filter class="solr.ElisionFilterFactory" ignoreCase="true" articles="lang/contractions_ga.txt"/> 946 <!-- removes n-, etc. position increments is intentionally false! --> 947 <filter class="solr.StopFilterFactory" ignoreCase="true" words="lang/hyphenations_ga.txt"/> 948 <filter class="solr.IrishLowerCaseFilterFactory"/> 949 <filter class="solr.StopFilterFactory" ignoreCase="true" words="lang/stopwords_ga.txt"/> 950 <filter class="solr.SnowballPorterFilterFactory" language="Irish"/> 951 </analyzer> 952 </fieldType> 953 954 <!-- Galician --> 955 <fieldType name="text_gl" class="solr.TextField" positionIncrementGap="100"> 956 <analyzer> 957 <tokenizer class="solr.StandardTokenizerFactory"/> 958 <filter class="solr.LowerCaseFilterFactory"/> 959 <filter class="solr.StopFilterFactory" ignoreCase="true" words="lang/stopwords_gl.txt" /> 960 <filter class="solr.GalicianStemFilterFactory"/> 961 <!-- less aggressive: <filter class="solr.GalicianMinimalStemFilterFactory"/> --> 962 </analyzer> 963 </fieldType> 964 965 <!-- Hindi --> 966 <fieldType name="text_hi" class="solr.TextField" positionIncrementGap="100"> 967 <analyzer> 968 <tokenizer class="solr.StandardTokenizerFactory"/> 969 <filter class="solr.LowerCaseFilterFactory"/> 970 <!-- normalizes unicode representation --> 971 <filter class="solr.IndicNormalizationFilterFactory"/> 972 <!-- normalizes variation in spelling --> 973 <filter class="solr.HindiNormalizationFilterFactory"/> 974 <filter class="solr.StopFilterFactory" ignoreCase="true" words="lang/stopwords_hi.txt" /> 975 <filter class="solr.HindiStemFilterFactory"/> 976 </analyzer> 977 </fieldType> 978 979 <!-- Hungarian --> 980 <fieldType name="text_hu" class="solr.TextField" positionIncrementGap="100"> 981 <analyzer> 982 <tokenizer class="solr.StandardTokenizerFactory"/> 983 <filter class="solr.LowerCaseFilterFactory"/> 984 <filter class="solr.StopFilterFactory" ignoreCase="true" words="lang/stopwords_hu.txt" format="snowball" /> 985 <filter class="solr.SnowballPorterFilterFactory" language="Hungarian"/> 986 <!-- less aggressive: <filter class="solr.HungarianLightStemFilterFactory"/> --> 987 </analyzer> 988 </fieldType> 989 990 <!-- Armenian --> 991 <fieldType name="text_hy" class="solr.TextField" positionIncrementGap="100"> 992 <analyzer> 993 <tokenizer class="solr.StandardTokenizerFactory"/> 994 <filter class="solr.LowerCaseFilterFactory"/> 995 <filter class="solr.StopFilterFactory" ignoreCase="true" words="lang/stopwords_hy.txt" /> 996 <filter class="solr.SnowballPorterFilterFactory" language="Armenian"/> 997 </analyzer> 998 </fieldType> 999 1000 <!-- Indonesian --> 1001 <fieldType name="text_id" class="solr.TextField" positionIncrementGap="100"> 1002 <analyzer> 1003 <tokenizer class="solr.StandardTokenizerFactory"/> 1004 <filter class="solr.LowerCaseFilterFactory"/> 1005 <filter class="solr.StopFilterFactory" ignoreCase="true" words="lang/stopwords_id.txt" /> 1006 <!-- for a less aggressive approach (only inflectional suffixes), set stemDerivational to false --> 1007 <filter class="solr.IndonesianStemFilterFactory" stemDerivational="true"/> 1008 </analyzer> 1009 </fieldType> 1010 1011 <!-- Italian --> 1012 <fieldType name="text_it" class="solr.TextField" positionIncrementGap="100"> 1013 <analyzer> 1014 <tokenizer class="solr.StandardTokenizerFactory"/> 1015 <!-- removes l', etc --> 1016 <filter class="solr.ElisionFilterFactory" ignoreCase="true" articles="lang/contractions_it.txt"/> 1017 <filter class="solr.LowerCaseFilterFactory"/> 1018 <filter class="solr.StopFilterFactory" ignoreCase="true" words="lang/stopwords_it.txt" format="snowball" /> 1019 <filter class="solr.ItalianLightStemFilterFactory"/> 1020 <!-- more aggressive: <filter class="solr.SnowballPorterFilterFactory" language="Italian"/> --> 1021 </analyzer> 1022 </fieldType> 1023 1024 <!-- Japanese using morphological analysis (see text_cjk for a configuration using bigramming) 1025 1026 NOTE: If you want to optimize search for precision, use default operator AND in your query 1027 parser config with <solrQueryParser defaultOperator="AND"/> further down in this file. Use 1028 OR if you would like to optimize for recall (default). 1029 --> 1030 <fieldType name="text_ja" class="solr.TextField" positionIncrementGap="100" autoGeneratePhraseQueries="false"> 1031 <analyzer> 1032 <!-- Kuromoji Japanese morphological analyzer/tokenizer (JapaneseTokenizer) 1033 1034 Kuromoji has a search mode (default) that does segmentation useful for search. A heuristic 1035 is used to segment compounds into its parts and the compound itself is kept as synonym. 1036 1037 Valid values for attribute mode are: 1038 normal: regular segmentation 1039 search: segmentation useful for search with synonyms compounds (default) 1040 extended: same as search mode, but unigrams unknown words (experimental) 1041 1042 For some applications it might be good to use search mode for indexing and normal mode for 1043 queries to reduce recall and prevent parts of compounds from being matched and highlighted. 1044 Use <analyzer type="index"> and <analyzer type="query"> for this and mode normal in query. 1045 1046 Kuromoji also has a convenient user dictionary feature that allows overriding the statistical 1047 model with your own entries for segmentation, part-of-speech tags and readings without a need 1048 to specify weights. Notice that user dictionaries have not been subject to extensive testing. 1049 1050 User dictionary attributes are: 1051 userDictionary: user dictionary filename 1052 userDictionaryEncoding: user dictionary encoding (default is UTF-8) 1053 1054 See lang/userdict_ja.txt for a sample user dictionary file. 1055 1056 Punctuation characters are discarded by default. Use discardPunctuation="false" to keep them. 1057 1058 See http://wiki.apache.org/solr/JapaneseLanguageSupport for more on Japanese language support. 1059 --> 1060 <tokenizer class="solr.JapaneseTokenizerFactory" mode="search"/> 1061 <!--<tokenizer class="solr.JapaneseTokenizerFactory" mode="search" userDictionary="lang/userdict_ja.txt"/>--> 1062 <!-- Reduces inflected verbs and adjectives to their base/dictionary forms (辞書形) --> 1063 <filter class="solr.JapaneseBaseFormFilterFactory"/> 1064 <!-- Removes tokens with certain part-of-speech tags --> 1065 <filter class="solr.JapanesePartOfSpeechStopFilterFactory" tags="lang/stoptags_ja.txt" /> 1066 <!-- Normalizes full-width romaji to half-width and half-width kana to full-width (Unicode NFKC subset) --> 1067 <filter class="solr.CJKWidthFilterFactory"/> 1068 <!-- Removes common tokens typically not useful for search, but have a negative effect on ranking --> 1069 <filter class="solr.StopFilterFactory" ignoreCase="true" words="lang/stopwords_ja.txt" /> 1070 <!-- Normalizes common katakana spelling variations by removing any last long sound character (U+30FC) --> 1071 <filter class="solr.JapaneseKatakanaStemFilterFactory" minimumLength="4"/> 1072 <!-- Lower-cases romaji characters --> 1073 <filter class="solr.LowerCaseFilterFactory"/> 1074 </analyzer> 1075 </fieldType> 1076 1077 <!-- Latvian --> 1078 <fieldType name="text_lv" class="solr.TextField" positionIncrementGap="100"> 1079 <analyzer> 1080 <tokenizer class="solr.StandardTokenizerFactory"/> 1081 <filter class="solr.LowerCaseFilterFactory"/> 1082 <filter class="solr.StopFilterFactory" ignoreCase="true" words="lang/stopwords_lv.txt" /> 1083 <filter class="solr.LatvianStemFilterFactory"/> 1084 </analyzer> 1085 </fieldType> 1086 1087 <!-- Dutch --> 1088 <fieldType name="text_nl" class="solr.TextField" positionIncrementGap="100"> 1089 <analyzer> 1090 <tokenizer class="solr.StandardTokenizerFactory"/> 1091 <filter class="solr.LowerCaseFilterFactory"/> 1092 <filter class="solr.StopFilterFactory" ignoreCase="true" words="lang/stopwords_nl.txt" format="snowball" /> 1093 <filter class="solr.StemmerOverrideFilterFactory" dictionary="lang/stemdict_nl.txt" ignoreCase="false"/> 1094 <filter class="solr.SnowballPorterFilterFactory" language="Dutch"/> 1095 </analyzer> 1096 </fieldType> 1097 1098 <!-- Norwegian --> 1099 <fieldType name="text_no" class="solr.TextField" positionIncrementGap="100"> 1100 <analyzer> 1101 <tokenizer class="solr.StandardTokenizerFactory"/> 1102 <filter class="solr.LowerCaseFilterFactory"/> 1103 <filter class="solr.StopFilterFactory" ignoreCase="true" words="lang/stopwords_no.txt" format="snowball" /> 1104 <filter class="solr.SnowballPorterFilterFactory" language="Norwegian"/> 1105 <!-- less aggressive: <filter class="solr.NorwegianLightStemFilterFactory" variant="nb"/> --> 1106 <!-- singular/plural: <filter class="solr.NorwegianMinimalStemFilterFactory" variant="nb"/> --> 1107 <!-- The "light" and "minimal" stemmers support variants: nb=Bokmål, nn=Nynorsk, no=Both --> 1108 </analyzer> 1109 </fieldType> 1110 1111 <!-- Portuguese --> 1112 <fieldType name="text_pt" class="solr.TextField" positionIncrementGap="100"> 1113 <analyzer> 1114 <tokenizer class="solr.StandardTokenizerFactory"/> 1115 <filter class="solr.LowerCaseFilterFactory"/> 1116 <filter class="solr.StopFilterFactory" ignoreCase="true" words="lang/stopwords_pt.txt" format="snowball" /> 1117 <filter class="solr.PortugueseLightStemFilterFactory"/> 1118 <!-- less aggressive: <filter class="solr.PortugueseMinimalStemFilterFactory"/> --> 1119 <!-- more aggressive: <filter class="solr.SnowballPorterFilterFactory" language="Portuguese"/> --> 1120 <!-- most aggressive: <filter class="solr.PortugueseStemFilterFactory"/> --> 1121 </analyzer> 1122 </fieldType> 1123 1124 <!-- Romanian --> 1125 <fieldType name="text_ro" class="solr.TextField" positionIncrementGap="100"> 1126 <analyzer> 1127 <tokenizer class="solr.StandardTokenizerFactory"/> 1128 <filter class="solr.LowerCaseFilterFactory"/> 1129 <filter class="solr.StopFilterFactory" ignoreCase="true" words="lang/stopwords_ro.txt" /> 1130 <filter class="solr.SnowballPorterFilterFactory" language="Romanian"/> 1131 </analyzer> 1132 </fieldType> 1133 1134 <!-- Russian --> 1135 <fieldType name="text_ru" class="solr.TextField" positionIncrementGap="100"> 1136 <analyzer> 1137 <tokenizer class="solr.StandardTokenizerFactory"/> 1138 <filter class="solr.LowerCaseFilterFactory"/> 1139 <filter class="solr.StopFilterFactory" ignoreCase="true" words="lang/stopwords_ru.txt" format="snowball" /> 1140 <filter class="solr.SnowballPorterFilterFactory" language="Russian"/> 1141 <!-- less aggressive: <filter class="solr.RussianLightStemFilterFactory"/> --> 1142 </analyzer> 1143 </fieldType> 1144 1145 <!-- Swedish --> 1146 <fieldType name="text_sv" class="solr.TextField" positionIncrementGap="100"> 1147 <analyzer> 1148 <tokenizer class="solr.StandardTokenizerFactory"/> 1149 <filter class="solr.LowerCaseFilterFactory"/> 1150 <filter class="solr.StopFilterFactory" ignoreCase="true" words="lang/stopwords_sv.txt" format="snowball" /> 1151 <filter class="solr.SnowballPorterFilterFactory" language="Swedish"/> 1152 <!-- less aggressive: <filter class="solr.SwedishLightStemFilterFactory"/> --> 1153 </analyzer> 1154 </fieldType> 1155 1156 <!-- Thai --> 1157 <fieldType name="text_th" class="solr.TextField" positionIncrementGap="100"> 1158 <analyzer> 1159 <tokenizer class="solr.ThaiTokenizerFactory"/> 1160 <filter class="solr.LowerCaseFilterFactory"/> 1161 <filter class="solr.StopFilterFactory" ignoreCase="true" words="lang/stopwords_th.txt" /> 1162 </analyzer> 1163 </fieldType> 1164 1165 <!-- Turkish --> 1166 <fieldType name="text_tr" class="solr.TextField" positionIncrementGap="100"> 1167 <analyzer> 1168 <tokenizer class="solr.StandardTokenizerFactory"/> 1169 <filter class="solr.ApostropheFilterFactory"/> 1170 <filter class="solr.TurkishLowerCaseFilterFactory"/> 1171 <filter class="solr.StopFilterFactory" ignoreCase="false" words="lang/stopwords_tr.txt" /> 1172 <filter class="solr.SnowballPorterFilterFactory" language="Turkish"/> 1173 </analyzer> 1174 </fieldType> 1175 1176 <!-- Similarity is the scoring routine for each document vs. a query. 1177 A custom Similarity or SimilarityFactory may be specified here, but 1178 the default is fine for most applications. 1179 For more info: http://wiki.apache.org/solr/SchemaXml#Similarity 1180 --> 1181 <!-- 1182 <similarity class="com.example.solr.CustomSimilarityFactory"> 1183 <str name="paramkey">param value</str> 1184 </similarity> 1185 --> 1186 1187 </schema>
本文转自SummerChill博客园博客,原文链接:http://www.cnblogs.com/DreamDrive/p/5768454.html,如需转载请自行联系原作者