lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dingding Ye" <>
Subject Questions about UUID type
Date Mon, 05 Jan 2009 18:46:21 GMT

I'm confused by the UUID type comment. It's said that

   * Generates a UUID if val is either null, empty or "NEW".
   * Otherwise it behaves much like a StrField but checks that the value
   * is indeed a valid UUID.
   * @param val The value of the field
   * @see org.apache.solr.schema.FieldType#toInternal(java.lang.String)

However´╝î i found that if i don't specify the field and it will report the

org.apache.solr.common.SolrException: Document [test] missing required
field: id

Surely when i set it to "NEW", it will work as expected.

I want to know that is this a expected way or should be possible a bug?

The related codes should be:

   for (SchemaField field : schema.getRequiredFields()) {
      if (out.getField(field.getName() ) == null) {
*        if (field.getDefaultValue() != null) {            //  Here because
the default value is null.  I think we should judge whether it's a UUID
          out.add( field.createField( field.getDefaultValue(), 1.0f ) );
        } *
        else {
          String id = schema.printableUniqueKey( out );
          String msg = "Document ["+id+"] missing required field: " +
          throw new SolrException( SolrException.ErrorCode.BAD_REQUEST, msg

Thanks for help.

Best regards.


  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message