FAQ
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

Search Discussions

  • Koji Sekiguchi at Jan 10, 2011 at 3:15 pm

    (11/01/10 23:26), Bernd Fehling wrote:
    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
    Bernd,

    Seems like same problem of SOLR-1973 that I've recently fixed
    in trunk and 3x, but I'm not sure. Which version are you using?
    Can you try trunk or 3x? If you still get same error with trunk/3x,
    please open a jira issue.

    Koji
  • Bernd Fehling at Jan 10, 2011 at 3:48 pm
    Hi Koji,

    I'm using apache-solr-4.0-2010-11-24_09-25-17 from trunk.

    A grep for "SOLR-1973" in CHANGES.txt says that it should have been fixed.
    Strange...

    Regards,
    Bernd



    Am 10.01.2011 16:14, schrieb Koji Sekiguchi:
    (11/01/10 23:26), Bernd Fehling wrote:
    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
    Bernd,

    Seems like same problem of SOLR-1973 that I've recently fixed
    in trunk and 3x, but I'm not sure. Which version are you using?
    Can you try trunk or 3x? If you still get same error with trunk/3x,
    please open a jira issue.

    Koji

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupsolr-user @
categorieslucene
postedJan 10, '11 at 2:27p
activeJan 10, '11 at 3:48p
posts3
users2
websitelucene.apache.org...

2 users in discussion

Bernd Fehling: 2 posts Koji Sekiguchi: 1 post

People

Translate

site design / logo © 2021 Grokbase