首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > XML SOAP >

solr1.4应用(2)-schema.xml说明

2012-11-14 
solr1.4使用(2)-schema.xml说明?xml version1.0 encodingUTF-8 ?!-- Licensed to the Apache Sof

solr1.4使用(2)-schema.xml说明

<?xml version="1.0" encoding="UTF-8" ?><!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements.  See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License.  You may obtain a copy of the License at     http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.--><!--   This is the Solr schema file. This file should be named "schema.xml" and should be in the conf directory under the solr home (i.e. ./solr/conf/schema.xml by default)  or located where the classloader for the Solr webapp can find it. This example schema is the recommended starting point for users. It should be kept correct and concise, usable out-of-the-box. For more information, on how to customize this file, please see http://wiki.apache.org/solr/SchemaXml--><schema name="musicbrainz" version="1.1">  <!-- attribute "name" is the name of this schema and is only used for display purposes.       Applications should change this to reflect the nature of the search collection.       version="1.1" is Solr's version number for the schema syntax and semantics.  It should       not normally be changed by applications.       1.0: multiValued attribute did not exist, all fields are multiValued by nature       1.1: multiValued attribute introduced, false by default -->  <types>    <!-- field type definitions. The "name" attribute is       just a label to be used by field definitions.  The "class"       attribute and any other attributes determine the real       behavior of the fieldType.         Class names starting with "solr" refer to java classes in the       org.apache.solr.analysis package.    -->    <!-- The StrField type is not analyzed, but indexed/stored verbatim.         - StrField and TextField support an optional compressThreshold which       limits compression (if enabled in the derived fields) to values which       exceed a certain size (in characters).   name: 字段类型名   class: java类名   indexed:缺省true。 说明这个数据应被搜索和排序,如果数据没有indexed,则stored应是true。   stored: 缺省true。说明这个字段被包含在搜索结果中是合适的。如果数据没有stored,则indexed应是true。   sortMissingLast:指没有该指定字段数据的document排在有该指定字段数据的document的后面   sortMissingFirst:指没有该指定字段数据的document排在有该指定字段数据的document的前面   omitNorms:字段的长度不影响得分和在索引时不做boost时,设置它为true。一般文本字段不设置为true。   termVectors:如果字段被用来做more like this 和highlight的特性时应设置为true。   compressed:字段是压缩的。这可能导致索引和搜索变慢,但会减少存储空间,只有StrField和TextField是可以压缩,这通常适合字段的长度超过200个字符。   multiValued:字段多于一个值的时候,可设置为true。   positionIncrementGap:和multiValued一起使用,设置多个值之间的虚拟空白的数量    -->    <fieldType name="string" sortMissingLast="true" omitNorms="true"/>    <!-- boolean type: "true" or "false" -->    <fieldType name="boolean" sortMissingLast="true" omitNorms="true"/>    <!-- The optional sortMissingLast and sortMissingFirst attributes are         currently supported on types that are sorted internally as strings.       - If sortMissingLast="true", then a sort on this field will cause documents         without the field to come after documents with the field,         regardless of the requested sort order (asc or desc).       - If sortMissingFirst="true", then a sort on this field will cause documents         without the field to come before documents with the field,         regardless of the requested sort order.       - If sortMissingLast="false" and sortMissingFirst="false" (the default),         then default lucene sorting will be used which places docs without the         field first in an ascending sort and last in a descending sort.    -->        <!-- numeric field types that store and index the text         value verbatim (and hence don't support range queries, since the         lexicographic ordering isn't equal to the numeric ordering) -->    <fieldType name="integer" omitNorms="true"/>    <fieldType name="long" omitNorms="true"/>    <fieldType name="float" omitNorms="true"/>    <fieldType name="double" omitNorms="true"/>    <!-- Numeric field types that manipulate the value into         a string value that isn't human-readable in its internal form,         but with a lexicographic ordering the same as the numeric ordering,         so that range queries work correctly. -->    <fieldType name="sint" sortMissingLast="true" omitNorms="true"/>    <fieldType name="slong" sortMissingLast="true" omitNorms="true"/>    <fieldType name="sfloat" sortMissingLast="true" omitNorms="true"/>    <fieldType name="sdouble" sortMissingLast="true" omitNorms="true"/>    <!-- The format for this date field is of the form 1995-12-31T23:59:59Z, and         is a more restricted form of the canonical representation of dateTime         http://www.w3.org/TR/xmlschema-2/#dateTime             The trailing "Z" designates UTC time and is mandatory.         Optional fractional seconds are allowed: 1995-12-31T23:59:59.999Z         All other components are mandatory.         Expressions can also be used to denote calculations that should be         performed relative to "NOW" to determine the value, ie...               NOW/HOUR                  ... Round to the start of the current hour               NOW-1DAY                  ... Exactly 1 day prior to now               NOW/DAY+6MONTHS+3DAYS                  ... 6 months and 3 days in the future from the start of                      the current day                               Consult the DateField javadocs for more information.      -->    <fieldType name="date" sortMissingLast="true" omitNorms="true"/>    <!-- The "RandomSortField" is not used to store or search any         data.  You can declare fields of this type it in your schema         to generate psuedo-random orderings of your docs for sorting          purposes.  The ordering is generated based on the field name          and the version of the index, As long as the index version         remains unchanged, and the same field name is reused,         the ordering of the docs will be consistent.           If you want differend psuedo-random orderings of documents,         for the same version of the index, use a dynamicField and         change the name     -->    <fieldType name="random" indexed="true" />    <!-- solr.TextField allows the specification of custom text analyzers         specified as a tokenizer and a list of token filters. Different         analyzers may be specified for indexing and querying.         The optional positionIncrementGap puts space between multiple fields of         this type on the same document, with the purpose of preventing false phrase         matching across fields.         For more info on customizing your analyzer chain, please see         http://wiki.apache.org/solr/AnalyzersTokenizersTokenFilters     -->    <!-- One can also specify an existing Analyzer class that has a         default constructor via the class attribute on the analyzer element    <fieldType name="text_greek" positionIncrementGap="100">      <analyzer>        <tokenizer or "wi fi" could match a document containing "Wi-Fi".        Synonyms and stopwords are customized by external files, and stemming is enabled.        Duplicate tokens at the same position (which may result from Stemmed Synonyms or        WordDelim parts) are removed.        -->    <fieldType name="text" positionIncrementGap="100">      <analyzer type="index">        <tokenizer synonyms="index_synonyms.txt" ignoreCase="true" expand="false"/>        -->        <!-- Case insensitive stop word removal.             enablePositionIncrements=true ensures that a 'gap' is left to             allow for accurate phrase queries.        -->        <filter generateWordParts="1" generateNumberParts="1" catenateWords="1" catenateNumbers="1" catenateAll="0" splitOnCaseChange="1"/>        <filter protected="protwords.txt"/>        <filter synonyms="synonyms.txt" ignoreCase="true" expand="true"/>        <filter ignoreCase="true" words="stopwords.txt"/>        <filter generateWordParts="1" generateNumberParts="1" catenateWords="0" catenateNumbers="0" catenateAll="0" splitOnCaseChange="1"/>        <filter protected="protwords.txt"/>        <filter positionIncrementGap="100" >      <analyzer>        <tokenizer synonyms="synonyms.txt" ignoreCase="true" expand="false"/>        <filter ignoreCase="true" words="stopwords.txt"/>        <filter generateWordParts="0" generateNumberParts="0" catenateWords="1" catenateNumbers="1" catenateAll="0"/>        <filter protected="protwords.txt"/>        <filter positionIncrementGap="100" >      <analyzer>        <tokenizer synonyms="synonyms.txt" ignoreCase="true" expand="false"/> -->        <filter generateWordParts="0" generateNumberParts="0" catenateWords="1" catenateNumbers="1" catenateAll="0"/>        <filter protected="protwords.txt"/> -->        <filter positionIncrementGap="100" stored="false" >      <analyzer>        <tokenizer positionIncrementGap="100" stored="false" multiValued="true">  <analyzer type="index">    <tokenizer synonyms="synonyms.txt" ignoreCase="true" expand="true"/>    <filter ignoreCase="true" words="stopwords.txt"/>    <filter ignoreCase="true" words="stopwords.txt"/>    <filter positionIncrementGap="100" stored="false" multiValued="true">  <analyzer>    <tokenizer sortMissingLast="true" omitNorms="true">      <analyzer>        <!-- KeywordTokenizer does no actual tokenizing, so the entire             input string is preserved as a single token          -->        <tokenizer />        <!-- The TrimFilter removes any leading or trailing whitespace -->        <filter />        <!-- The PatternReplaceFilter gives you the flexibility to use             Java Regular expression to replace any sequence of characters             matching a pattern with an arbitrary replacement string,              which may include back refrences to portions of the orriginal             string matched by the pattern.                          See the Java Regular Expression documentation for more             infomation on pattern and replacement string syntax.                          http://java.sun.com/j2se/1.5.0/docs/api/java/util/regex/package-summary.html          -->        <filter replacement="" replace="all"        />      </analyzer>    </fieldType>    <fieldType name="rType" sortMissingLast="true" omitNorms="true">       <analyzer>         <tokenizer replacement="" replace="first" />         <filter min="1" max="100" />         <filter synonyms="mb_attributes.txt" ignoreCase="false" expand="false"/>       </analyzer>     </fieldType>          <fieldType name="rOfficial" sortMissingLast="true" omitNorms="true">        <analyzer>          <tokenizer replacement="" replace="first" />          <filter min="1" max="100" />          <filter synonyms="mb_attributes.txt" ignoreCase="false" expand="false"/>        </analyzer>      </fieldType>            <fieldType name="bucketFirstLetter" sortMissingLast="true" omitNorms="true">         <analyzer type="index">           <tokenizer pattern="^([a-zA-Z]).*" group="1" />           <filter synonyms="mb_letterBuckets.txt" ignoreCase="true" expand="false"/>         </analyzer>         <analyzer type="query">             <tokenizer stored="false" indexed="false" />  </types> <fields>   <!-- Valid attributes for fields:     name: mandatory - the name for the field     type: mandatory - the name of a previously defined type from the <types> section     indexed: true if this field should be indexed (searchable or sortable)     stored: true if this field should be retrievable     compressed: [false] if this field should be stored using gzip compression       (this will only apply if the field type is compressable; among       the standard field types, only TextField and StrField are)     multiValued: true if this field may contain multiple values per document     omitNorms: (expert) set to true to omit the norms associated with       this field (this disables length normalization and index-time       boosting for the field, and saves some memory).  Only full-text       fields or fields that need an index-time boost need norms.     termVectors: [false] set to true to store the term vector for a given field.       When using MoreLikeThis, fields used for similarity should be stored for        best performance.   name:字段的名字。   type:字段的类型。   default:一般用来记录索引的时间。   required:设置为true时,当字段没有值,则solr会索引文档失败。   -->   <field name="id" type="string" required="true" /><!-- Artist:11650 -->   <field name="type" type="string" required="true" /><!-- Artist | Release | Label --><!-- artist -->   <field name="a_name" type="title" /><!-- The Smashing Pumpkins -->   <field name="a_name_sort" type="string" stored="false" /><!-- Smashing Pumpkins, The -->   <field name="a_alias" type="title" stored="false" multiValued="true" />      <field name="a_type" type="string" /><!-- group | person -->   <field name="a_begin_date" type="date" />   <field name="a_end_date" type="date" />   <field name="a_member_name" type="title" multiValued="true" /><!-- Billy Corgan -->   <field name="a_member_id" type="title" multiValued="true" /><!-- 102693 -->   <field name="a_release_date_latest" type="date" />   <!--note: for spell correction; populated via copyFields -->   <field name="a_spell" type="textSpell" /><field name="a_spellPhrase" type="textSpellPhrase" />   <!-- release -->   <field name="r_name" type="title" /><!-- Siamese Dream -->   <field name="r_name_sort" type="alphaOnlySort" stored="false"/><!-- Siamese Dream -->   <field name="r_name_facetLetter" type="bucketFirstLetter" stored="false" />      <field name="r_a_name" type="title" /><!-- The Smashing Pumpkins -->   <field name="r_a_id" type="string" /><!-- 11650 -->   <!-- Attributes 1-11: Album | Single | EP |... etc. -->   <!-- Attributes 100+: Official | Bootleg | Promotional -->   <field name="r_attributes" type="integer" multiValued="true" indexed="false" /><!-- ex: 0, 1, 100 -->   <field name="r_type" type="rType" multiValued="true" stored="false"/><!-- Album | Single | EP |... etc. -->   <field name="r_official" type="rOfficial" multiValued="true" stored="false"/><!-- Official | Bootleg | Promotional -->            <field name="r_lang" type="string" indexed="false" /> <!-- eng / latn -->   <field name="r_tracks" type="sint" indexed="false" />   <field name="r_event_country" type="string" multiValued="true" /><!-- us -->   <field name="r_event_date" type="date" multiValued="true" /><field name="r_event_date_earliest" type="date" multiValued="false" />   <!-- label -->   <field name="l_name" type="title" /><!-- Virgin Records America -->   <field name="l_name_sort" type="string" stored="false" />   <field name="l_type" type="string" /><!-- Distributor, Orig. Prod., Production -->   <field name="l_begin_date" type="date" />   <field name="l_end_date" type="date" />   <!-- track -->   <field name="t_name" type="title" /><!-- Cherub Rock -->   <field name="t_duration" type="sint"/><!-- 298 (seconds) -->   <field name="t_a_id" type="string" /><!-- 11650 -->   <field name="t_a_name" type="title" /><!-- The Smashing Pumpkins -->   <field name="t_num" type="integer" indexed="false" /><!-- 1 -->   <field name="t_r_id" type="string" /><!-- 22429 -->   <field name="t_r_name" type="title" /><!-- Siamese Dream -->   <field name="t_r_attributes"  multiValued="true" type="integer" /><!-- album | single | compilation -->   <field name="t_r_tracks" type="sint" /><!-- 13 -->   <field name="t_trm_lookups" type="sint" /><!-- 250 -->      <!-- TODO -->   <field name="word" type="ignored" />   <field name="includes" type="ignored" />    </fields> <!-- Field to use to determine and enforce document uniqueness.       Unless this field is marked with required="false", it will be a required field  唯一标识文档的字段   -->   <uniqueKey>id</uniqueKey>    <!--field for the QueryParser to use when an explicit fieldname is absent 默认搜索字段-->    <defaultSearchField>a_name</defaultSearchField>    <!-- SolrQueryParser configuration: defaultOperator="AND|OR" -->    <!-- <solrQueryParser defaultOperator="AND"/> -->     <!-- copyField commands copy one field to another at the time a document           is added to the index.  It's used either to index the same field differently,           or to add multiple fields to the same field for easier/faster searching.  -->     <copyField source="a_name" dest="a_spell" />     <copyField source="a_alias" dest="a_spell" />     <copyField source="a_name" dest="a_spellPhrase" />     <copyField source="a_alias" dest="a_spellPhrase" />     <copyField source="r_name" dest="r_name_sort" />     <copyField source="r_name" dest="r_name_facetLetter" />     <copyField source="r_attributes" dest="r_type" />     <copyField source="r_attributes" dest="r_official" />              <!-- Similarity is the scoring routine for each document vs. a query.         A custom similarity may be specified here, but the default is fine         for most applications.  -->    <!-- <similarity class="org.apache.lucene.search.DefaultSimilarity"/> -->    <!-- ... OR ...         Specify a SimilarityFactory class name implementation         allowing parameters to be used.    -->    <!--    <similarity class="com.example.solr.CustomSimilarityFactory">      <str name="paramkey">param value</str>    </similarity>    --> </schema>

热点排行