Advertisement
Guest User

schema.xml

a guest
May 7th, 2015
360
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
XML 18.38 KB | None | 0 0
  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. <schema name="survey" version="1.1">
  32.   <!-- attribute "name" is the name of this schema and is only used for display purposes.
  33.       Applications should change this to reflect the nature of the search collection.
  34.       version="1.1" is Solr's version number for the schema syntax and semantics.  It should
  35.       not normally be changed by applications.
  36.       1.0: multiValued attribute did not exist, all fields are multiValued by nature
  37.       1.1: multiValued attribute introduced, false by default -->
  38.  
  39.   <types>
  40.     <!-- field type definitions. The "name" attribute is
  41.       just a label to be used by field definitions.  The "class"
  42.       attribute and any other attributes determine the real
  43.       behavior of the fieldType.
  44.         Class names starting with "solr" refer to java classes in the
  45.       org.apache.solr.analysis package.
  46.    -->
  47.  
  48.     <!-- The StrField type is not analyzed, but indexed/stored verbatim.  
  49.       - StrField and TextField support an optional compressThreshold which
  50.       limits compression (if enabled in the derived fields) to values which
  51.       exceed a certain size (in characters).
  52.    -->
  53.     <fieldType name="string" class="solr.StrField" sortMissingLast="true" omitNorms="true"/>
  54.  
  55.     <!-- boolean type: "true" or "false" -->
  56.     <fieldType name="boolean" class="solr.BoolField" sortMissingLast="true" omitNorms="true"/>
  57.  
  58.     <!-- The optional sortMissingLast and sortMissingFirst attributes are
  59.         currently supported on types that are sorted internally as strings.
  60.       - If sortMissingLast="true", then a sort on this field will cause documents
  61.         without the field to come after documents with the field,
  62.         regardless of the requested sort order (asc or desc).
  63.       - If sortMissingFirst="true", then a sort on this field will cause documents
  64.         without the field to come before documents with the field,
  65.         regardless of the requested sort order.
  66.       - If sortMissingLast="false" and sortMissingFirst="false" (the default),
  67.         then default lucene sorting will be used which places docs without the
  68.         field first in an ascending sort and last in a descending sort.
  69.    -->    
  70.  
  71.  
  72.     <!-- numeric field types that store and index the text
  73.         value verbatim (and hence don't support range queries, since the
  74.         lexicographic ordering isn't equal to the numeric ordering) -->
  75.     <fieldType name="integer" class="solr.IntField" omitNorms="true"/>
  76.     <fieldType name="long" class="solr.LongField" omitNorms="true"/>
  77.     <fieldType name="float" class="solr.FloatField" omitNorms="true"/>
  78.     <fieldType name="double" class="solr.DoubleField" omitNorms="true"/>
  79.  
  80.  
  81.     <!-- Numeric field types that manipulate the value into
  82.         a string value that isn't human-readable in its internal form,
  83.         but with a lexicographic ordering the same as the numeric ordering,
  84.         so that range queries work correctly. -->
  85.     <fieldType name="sint" class="solr.SortableIntField" sortMissingLast="true" omitNorms="true"/>
  86.     <fieldType name="slong" class="solr.SortableLongField" sortMissingLast="true" omitNorms="true"/>
  87.     <fieldType name="sfloat" class="solr.SortableFloatField" sortMissingLast="true" omitNorms="true"/>
  88.     <fieldType name="sdouble" class="solr.SortableDoubleField" sortMissingLast="true" omitNorms="true"/>
  89.  
  90.  
  91.     <!-- The format for this date field is of the form 1995-12-31T23:59:59Z, and
  92.         is a more restricted form of the canonical representation of dateTime
  93.         http://www.w3.org/TR/xmlschema-2/#dateTime    
  94.         The trailing "Z" designates UTC time and is mandatory.
  95.         Optional fractional seconds are allowed: 1995-12-31T23:59:59.999Z
  96.         All other components are mandatory.
  97.  
  98.         Expressions can also be used to denote calculations that should be
  99.         performed relative to "NOW" to determine the value, ie...
  100.  
  101.               NOW/HOUR
  102.                  ... Round to the start of the current hour
  103.               NOW-1DAY
  104.                  ... Exactly 1 day prior to now
  105.               NOW/DAY+6MONTHS+3DAYS
  106.                  ... 6 months and 3 days in the future from the start of
  107.                      the current day
  108.                      
  109.         Consult the DateField javadocs for more information.
  110.      -->
  111.     <fieldType name="date" class="solr.DateField" sortMissingLast="true" omitNorms="true"/>
  112.  
  113.  
  114.     <!-- The "RandomSortField" is not used to store or search any
  115.         data.  You can declare fields of this type it in your schema
  116.         to generate psuedo-random orderings of your docs for sorting
  117.         purposes.  The ordering is generated based on the field name
  118.         and the version of the index, As long as the index version
  119.         remains unchanged, and the same field name is reused,
  120.         the ordering of the docs will be consistent.  
  121.         If you want differend psuedo-random orderings of documents,
  122.         for the same version of the index, use a dynamicField and
  123.         change the name
  124.     -->
  125.     <fieldType name="random" class="solr.RandomSortField" indexed="true" />
  126.  
  127.     <!-- solr.TextField allows the specification of custom text analyzers
  128.         specified as a tokenizer and a list of token filters. Different
  129.         analyzers may be specified for indexing and querying.
  130.  
  131.         The optional positionIncrementGap puts space between multiple fields of
  132.         this type on the same document, with the purpose of preventing false phrase
  133.         matching across fields.
  134.  
  135.         For more info on customizing your analyzer chain, please see
  136.         http://wiki.apache.org/solr/AnalyzersTokenizersTokenFilters
  137.     -->
  138.  
  139.     <!-- One can also specify an existing Analyzer class that has a
  140.         default constructor via the class attribute on the analyzer element
  141.    <fieldType name="text_greek" class="solr.TextField">
  142.      <analyzer class="org.apache.lucene.analysis.el.GreekAnalyzer"/>
  143.    </fieldType>
  144.    -->
  145.  
  146.     <!-- A text field that only splits on whitespace for exact matching of words -->
  147.     <fieldType name="text_ws" class="solr.TextField" positionIncrementGap="100">
  148.       <analyzer>
  149.         <tokenizer class="solr.WhitespaceTokenizerFactory"/>
  150.       </analyzer>
  151.     </fieldType>
  152.  
  153.     <!-- A text field that uses WordDelimiterFilter to enable splitting and matching of
  154.        words on case-change, alpha numeric boundaries, and non-alphanumeric chars,
  155.        so that a query of "wifi" or "wi fi" could match a document containing "Wi-Fi".
  156.        Synonyms and stopwords are customized by external files, and stemming is enabled.
  157.        Duplicate tokens at the same position (which may result from Stemmed Synonyms or
  158.        WordDelim parts) are removed.
  159.        -->
  160.     <fieldType name="text" class="solr.TextField" positionIncrementGap="100">
  161.       <analyzer type="index">
  162.         <tokenizer class="solr.WhitespaceTokenizerFactory"/>
  163.  
  164.         <filter class="solr.SynonymFilterFactory" synonyms="synonyms.txt" ignoreCase="true" expand="true"/>
  165.        
  166.         <!-- Case insensitive stop word removal removed
  167.        -->
  168.        
  169.         <filter class="solr.WordDelimiterFilterFactory" generateWordParts="1" generateNumberParts="1" catenateWords="1" catenateNumbers="1" catenateAll="0" splitOnCaseChange="1"/>
  170.         <filter class="solr.LowerCaseFilterFactory"/>
  171.         <filter class="solr.EnglishPorterFilterFactory" protected="protwords.txt"/>
  172.         <filter class="solr.RemoveDuplicatesTokenFilterFactory"/>
  173.       </analyzer>
  174.       <analyzer type="query">
  175.         <tokenizer class="solr.WhitespaceTokenizerFactory"/>
  176.         <filter class="solr.SynonymFilterFactory" synonyms="synonyms.txt" ignoreCase="true" expand="true"/>
  177.        
  178.         <!-- stop words removed -->
  179.         <filter class="solr.WordDelimiterFilterFactory" generateWordParts="1" generateNumberParts="1" catenateWords="0" catenateNumbers="0" catenateAll="0" splitOnCaseChange="1"/>
  180.         <filter class="solr.LowerCaseFilterFactory"/>
  181.         <filter class="solr.EnglishPorterFilterFactory" protected="protwords.txt"/>
  182.         <filter class="solr.RemoveDuplicatesTokenFilterFactory"/>
  183.       </analyzer>
  184.     </fieldType>
  185.  
  186.  
  187.     <!-- Less flexible matching, but less false matches.  Probably not ideal for product names,
  188.         but may be good for SKUs.  Can insert dashes in the wrong place and still match. -->
  189.     <fieldType name="textTight" class="solr.TextField" positionIncrementGap="100" >
  190.       <analyzer>
  191.         <tokenizer class="solr.WhitespaceTokenizerFactory"/>
  192.         <filter class="solr.SynonymFilterFactory" synonyms="synonyms.txt" ignoreCase="true" expand="true"/>
  193.         <filter class="solr.WordDelimiterFilterFactory" generateWordParts="0" generateNumberParts="0" catenateWords="1" catenateNumbers="1" catenateAll="0"/>
  194.         <filter class="solr.LowerCaseFilterFactory"/>
  195.         <filter class="solr.EnglishPorterFilterFactory" protected="protwords.txt"/>
  196.         <filter class="solr.RemoveDuplicatesTokenFilterFactory"/>
  197.       </analyzer>
  198.     </fieldType>
  199.  
  200.     <!--
  201.     Setup simple analysis for spell checking
  202.     -->
  203.     <fieldType name="textSpell" class="solr.TextField" positionIncrementGap="100" >
  204.       <analyzer>
  205.         <tokenizer class="solr.StandardTokenizerFactory"/>
  206.         <filter class="solr.LowerCaseFilterFactory"/>
  207.         <filter class="solr.RemoveDuplicatesTokenFilterFactory"/>
  208.       </analyzer>
  209.     </fieldType>
  210.  
  211.     <!-- This is an example of using the KeywordTokenizer along
  212.         With various TokenFilterFactories to produce a sortable field
  213.         that does not include some properties of the source text
  214.      -->
  215.     <fieldType name="alphaOnlySort" class="solr.TextField" sortMissingLast="true" omitNorms="true">
  216.       <analyzer>
  217.         <!-- KeywordTokenizer does no actual tokenizing, so the entire
  218.             input string is preserved as a single token
  219.          -->
  220.         <tokenizer class="solr.KeywordTokenizerFactory"/>
  221.         <!-- The LowerCase TokenFilter does what you expect, which can be
  222.             when you want your sorting to be case insensitive
  223.          -->
  224.         <filter class="solr.LowerCaseFilterFactory" />
  225.         <!-- The TrimFilter removes any leading or trailing whitespace -->
  226.         <filter class="solr.TrimFilterFactory" />
  227.         <!-- The PatternReplaceFilter gives you the flexibility to use
  228.             Java Regular expression to replace any sequence of characters
  229.             matching a pattern with an arbitrary replacement string,
  230.             which may include back refrences to portions of the orriginal
  231.             string matched by the pattern.
  232.            
  233.             See the Java Regular Expression documentation for more
  234.             infomation on pattern and replacement string syntax.
  235.            
  236.             http://java.sun.com/j2se/1.5.0/docs/api/java/util/regex/package-summary.html
  237.          -->
  238.         <filter class="solr.PatternReplaceFilterFactory"
  239.                pattern="([^a-z])" replacement="" replace="all"
  240.        />
  241.       </analyzer>
  242.     </fieldType>
  243.  
  244.     <!-- since fields of this type are by default not stored or indexed, any data added to
  245.         them will be ignored outright
  246.     -->
  247.     <fieldtype name="ignored" stored="false" indexed="false" class="solr.StrField" />
  248.  
  249.  </types>
  250.  
  251.  
  252.  <fields>
  253.    <!-- Valid attributes for fields:
  254.     name: mandatory - the name for the field
  255.     type: mandatory - the name of a previously defined type from the <types> section
  256.     indexed: true if this field should be indexed (searchable or sortable)
  257.     stored: true if this field should be retrievable
  258.     compressed: [false] if this field should be stored using gzip compression
  259.       (this will only apply if the field type is compressable; among
  260.       the standard field types, only TextField and StrField are)
  261.     multiValued: true if this field may contain multiple values per document
  262.     omitNorms: (expert) set to true to omit the norms associated with
  263.       this field (this disables length normalization and index-time
  264.       boosting for the field, and saves some memory).  Only full-text
  265.       fields or fields that need an index-time boost need norms.
  266.     termVectors: [false] set to true to store the term vector for a given field.
  267.       When using MoreLikeThis, fields used for similarity should be stored for
  268.       best performance.
  269.   -->
  270.    <field name="suid" type="integer" indexed="true" stored="true" required="true" />
  271.    <field name="user_id" type="integer" indexed="true" stored="true" required="true" />
  272.    <field name="survey_resource_id" type="integer" indexed="true" stored="true" required="true" />  
  273.    <field name="company_id" type="integer" indexed="true" stored="true" required="true" />  
  274.    <field name="user_id_origin" type="integer" indexed="true" stored="true" required="true" /><!-- the physician id most probably -->
  275.    <field name="survey_user_date_added" type="date" indexed="true" stored="true" required="true" />
  276.    <field name="survey_user_date_completed" type="date" indexed="true" stored="true" required="true" />
  277.    <field name="original_date_added" type="date" indexed="true" stored="true" required="false" />
  278.    <field name="submitter_id" type="integer" indexed="true" stored="true" required="true" />  
  279.    <field name="survey_user_workflow_state" type="string" indexed="true" stored="true" required="false" />  
  280. <!-- the date values in the form were rendered from human flesh
  281. - if form entered retrospectively then the completed date
  282. is actually whatever was written on the form - the date it was
  283. completed on paper. original_date_added is when was initially put in vtoc. -->
  284.  
  285.  
  286.    <!-- Here, default is used to create a "timestamp" field indicating
  287.        When each document was indexed.
  288.     -->
  289.    <field name="timestamp" type="date" indexed="true" stored="true" default="NOW" multiValued="false"/>
  290.    
  291.    
  292.    <!-- Dynamic field definitions.  If a field name is not found, dynamicFields
  293.        will be used if the name matches any of the patterns.
  294.        RESTRICTION: the glob-like pattern in the name attribute must have
  295.        a "*" only at the start or the end.
  296.        EXAMPLE:  name="*_i" will match any field ending in _i (like myid_i, z_i)
  297.        Longer patterns will be matched first.  if equal size patterns
  298.        both match, the first appearing in the schema will be used.  -->
  299.    <dynamicField name="*_i"  type="sint"    indexed="true"  stored="true"/>
  300.    <dynamicField name="*_s"  type="string"  indexed="true"  stored="true"/>
  301.    <dynamicField name="*_l"  type="slong"   indexed="true"  stored="true"/>
  302.    <dynamicField name="*_t"  type="text"    indexed="true"  stored="true"/>
  303.    <dynamicField name="*_b"  type="boolean" indexed="true"  stored="true"/>
  304.    <dynamicField name="*_f"  type="sfloat"  indexed="true"  stored="true"/>
  305.    <dynamicField name="*_d"  type="sdouble" indexed="true"  stored="true"/>
  306.    <dynamicField name="*_dt" type="date"    indexed="true"  stored="true"/>
  307.  
  308.    <dynamicField name="random*" type="random" />
  309.  
  310.    <!-- uncomment the following to ignore any fields that don't already match an existing
  311.        field name or dynamic field, rather than reporting them as an error.
  312.        alternately, change the type="ignored" to some other type e.g. "text" if you want
  313.        unknown fields indexed and/or stored by default -->
  314.    <!--dynamicField name="*" type="ignored" /-->
  315.    
  316.  </fields>
  317.  
  318.  <!-- Field to use to determine and enforce document uniqueness.
  319.      Unless this field is marked with required="false", it will be a required field
  320.   -->
  321.  <uniqueKey>suid</uniqueKey>
  322.  
  323.  <!-- field for the QueryParser to use when an explicit fieldname is absent -->
  324.  <defaultSearchField>suid</defaultSearchField>
  325.  
  326.  <!-- SolrQueryParser configuration: defaultOperator="AND|OR" -->
  327.  <solrQueryParser defaultOperator="OR"/>
  328.  
  329.   <!-- copyField commands copy one field to another at the time a document
  330.        is added to the index.  It's used either to index the same field differently,
  331.        or to add multiple fields to the same field for easier/faster searching.  -->
  332. <!--   <copyField source="brief_title" dest="text"/>
  333.   <copyField source="official_title" dest="text"/>
  334.   <copyField source="brief_summary" dest="text"/>
  335.   <copyField source="detailed_description" dest="text"/>
  336.   <copyField source="eligibility_text" dest="text"/>
  337.   <copyField source="nct_id" dest="text"/>
  338.  
  339.   <copyField source="location_facility_name" dest="location"/>
  340.   <copyField source="location_facility_address_city" dest="location"/>
  341.   <copyField source="location_facility_address_state" dest="location"/>
  342.   <copyField source="location_facility_address_country" dest="location"/>
  343. -->
  344.    
  345.  <!-- Similarity is the scoring routine for each document vs. a query.
  346.      A custom similarity may be specified here, but the default is fine
  347.      for most applications.  -->
  348.  <!-- <similarity class="org.apache.lucene.search.DefaultSimilarity"/> -->
  349.  <!-- ... OR ...
  350.      Specify a SimilarityFactory class name implementation
  351.      allowing parameters to be used.
  352. -->
  353.  <!--
  354. <similarity class="com.example.solr.CustomSimilarityFactory">
  355.   <str name="paramkey">param value</str>
  356. </similarity>
  357. -->
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement