You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-commits@lucene.apache.org by Apache Wiki <wi...@apache.org> on 2012/10/18 13:02:19 UTC

[Solr Wiki] Trivial Update of "SchemaXml" by ErickErickson

Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Solr Wiki" for change notification.

The "SchemaXml" page has been changed by ErickErickson:
http://wiki.apache.org/solr/SchemaXml?action=diff&rev1=64&rev2=65

Comment:
Added comments about _version_ and keeping id as-is.

  
  == Fields ==
  The `<fields>` section is where you list the individual `<field>` declarations you wish to use in your documents.  Each `<field>` has a `name` that you will use to reference it when adding documents or executing searches, and an associated `type` which identifies the name of the fieldtype you wish to use for this field. There are various field options that apply to a field. These can be set in the field type declarations, and can also be overridden at an individual field's declaration.
+ 
+ === Recommended fields ===
+ While these fields aren't strictly mandatory (Solr will run if you remove them fully), Bad Things happen in some situations if they aren't defined. We recommend that you leave these fields alone. If you don't use them, there's no appreciable penalty.
+  * id - Almost all Solr installations have this field defined as the <uniqueKey> (see below). 
+  * _version_ <!> [[Solr4]] - This field is used for optimistic locking in [[http://wiki.apache.org/solr/SolrCloud|SolrCloud]] and it enables [[http://wiki.apache.org/solr/RealTimeGet|Real Time Get]]. If you remove it you must also remove the transaction logging from solrconfig.xml, see [[http://wiki.apache.org/solr/RealTimeGet|Real Time Get]].
  
  === Common field options ===
  Common options that fields can have are...
@@ -115, +120 @@

  === The Unique Key Field ===
  The `<uniqueKey>` declaration can be used to inform Solr that there is a field in your index which should be unique for all documents.  If a document is added that contains the same value for this field as an existing document, the old document will be deleted.
  
- It is not mandatory for a schema to have a uniqueKey field.
+ It is not mandatory for a schema to have a uniqueKey field, but an overwhelming majority of them do.  It ''shouldn't'' matter whether you rename this to something else (and change the <uniqueKey> value), but occasionally it has in the past. We recommend that you just leave this definition alone.
  
  Note that if you have enabled the QueryElevationComponent in solrconfig.xml it requires the schema to have a uniqueKey of type StrField.  It cannot be, for example, an int field.