Hi Steve, responses inline below:

> On Apr 29, 2015, at 6:50 PM, Steven White <swhite4...@gmail.com> wrote:
> 
> Hi Everyone,
> 
> When I pass the following:
> http://localhost:8983/solr/db/schema/fieldtypes?wt=xml
> 
> I see this (as one example):
> 
>  <lst>
>    <str name="name">date</str>
>    <str name="class">solr.TrieDateField</str>
>    <str name="precisionStep">0</str>
>    <str name="positionIncrementGap">0</str>
>    <arr name="fields">
>      <str>last_modified</str>
>    </arr>
>    <arr name="dynamicFields">
>      <str>*_dts</str>
>      <str>*_dt</str>
>    </arr>
>  </lst>
> 
> See how there is "fields" and "dynamicfields"?  However, when I look in
> schema.xml, I see this:
> 
>  <fieldType name="date" class="solr.TrieDateField" precisionStep="0"
> positionIncrementGap="0"/>
> 
> See how there is nothing about "fields" and "dynamicfields".
> 
> Now, when I look further into the schema.xml, I see they are coming from:
> 
>  <field name="last_modified" type="date" indexed="true" stored="true"/>
>  <dynamicField name="*_dt"  type="date"    indexed="true"  stored="true"/>
>  <dynamicField name="*_dts" type="date"    indexed="true"  stored="true"
> multiValued="true"/>
> 
> So it all makes sense.
> 
> Does this means the response of "fieldtypes" includes "fields" and
> "dynamicfields" as syntactic-sugar to let me know of the relationship this
> field-type has or is there more to it?

It’s FYI: this is the full list of fields and dynamic fields that use the given 
fieldtype.

> The reason why I care about this question is because I'm using Solr's
> Schema API (see: https://cwiki.apache.org/confluence/display/solr/Schema+API)
> to make changes to my schema.  Per this link:
> https://cwiki.apache.org/confluence/display/solr/Schema+API#SchemaAPI-AddaNewFieldType
> it shows how to add a field-type via "add-field-type" but there is no
> mention of "fields" or "dynamicfields" in this API.  My assumption is
> "fields" and "dynamicfields" need not be part of this API, instead it is
> done via "add-field" and "add-dynamic-field", thus what I see in the XML of
> "fieldtypes" response is just syntactic-sugar.  Did I get all this right?
> 

Yes, as you say, to add (dynamic) fields after adding a field type, you must 
use the “add-field” and “add-dynamic-field” commands.  Note that you can do so 
in a single request if you like, as long as “add-field-type” is ordered before 
any referencing “add-field”/“add-dynamic-field” command.

To be clear, the “add-field-type” command does not support passing in a set of 
fields and/or dynamic fields to be added with the new field type.

Steve

Reply via email to