Dear list,
while trying different options with DIH and SciptTransformer I also
tried using the "required=true" option for a field.
I have 3 records:
<documents>
<document>
<title>first title</title>
<id>identifier_01</id>
<link>http://www.foo.com/path/bar.html</link>
</document>
<document>
<title>second title</title>
<id>identifier_02</id>
<link></link>
</document>
<document>
<title>thierd title</title>
<id>identifier_03</id>
</document>
</documents>
schema.xml snippet:
<field name="title" type="string" indexed="true" stored="true" />
<field name="id" type="string" indexed="true" stored="true required="true" />
<field name="link" type="string" indexed="true" stored="true" required="true" />
After loading I have 2 records in the index.
<str name="title">first title</str>
<str name="id">identifier_01</str>
<str name="link">http://www.foo.com/path/bar.html</link>
<str name="title">second title</str>
<str name="id">identifier_02</str>
<str name="link"/>
Sure, I get an SolrException in the logs saying "missing required field: link"
but this is for the third record whereas the second record gets loaded even if
link is empty.
So I guess this is a "feature" of Solr?
And the required attribute means the presense of the tag and not
the presense of content for the tag, right?
Regards
Bernd