lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Shawn Heisey <>
Subject Re: How to set multivalued false, using SolrJ
Date Mon, 11 Apr 2016 15:16:01 GMT
On 4/11/2016 7:40 AM, Charles Sanders wrote:
> Multivalued fields are controlled by the schema. You need to define your field in the
schema file as 'not' a multivalue field. Here are a couple of examples of field definitions,
one multivalued, the other not. 
> <field name="component" type="string" indexed="true" stored="false" multiValued="true"/>

> <field name="environment" type="text_general" indexed="true" stored="false" />

> If you do not explicitly define your field, then solr will use default definitions, which
are probably storing the field as multivalued. 

Also, make sure that the schema version (a parameter within the schema
itself, NOT the Solr version) is high enough.  If this parameter is set
to 1.0 *all* fields are multivalued.  If you do not include the version
parameter at all, it will default to 1.0.  (Devs: should we change this
to default to whatever the current highest version is?  Defaulting to
*ancient* tech seems like a bad thing.)

Here's the comment near the top of the techproducts example schema from
Solr 5.5.0:

  <!-- attribute "name" is the name of this schema and is only used for
display purposes.
       version="x.y" 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
       1.2: omitTermFreqAndPositions attribute introduced, true by default
            except for text fields.
       1.3: removed optional field compress feature
       1.4: autoGeneratePhraseQueries attribute introduced to drive
            behavior when a single string produces multiple tokens. 
            to off for version >= 1.4
       1.5: omitNorms defaults to true for primitive field types
            (int, float, boolean, string...)
       1.6: useDocValuesAsStored defaults to true.


View raw message