[ http://issues.apache.org/jira/browse/SOLR-82?page=all ]

Ryan McKinley updated SOLR-82:
------------------------------

    Attachment: defaultValuesPatch2.patch

This is a revised version that stores a list of fieldsWithDefaultValue in the 
schema and only cycles through them (rather then every field)

The important bit is in: DocumentBuilder.java

 public Document getDoc() {
          
        // Check for default fields in our schema...
        for( SchemaField field : schema.getFieldsWithDefaultValue() ) {
          if( doc.getField( field.getName() ) == null ) {
            doc.add( field.createField( field.getDefaultValue(), 1.0f ) );
          }
        }
          
    Document ret = doc; doc=null;
    return ret;
  }



> specify default values in the schema
> ------------------------------------
>
>                 Key: SOLR-82
>                 URL: http://issues.apache.org/jira/browse/SOLR-82
>             Project: Solr
>          Issue Type: Improvement
>          Components: update
>            Reporter: Ryan McKinley
>            Priority: Minor
>         Attachments: defaultValuesPatch.patch, defaultValuesPatch2.patch
>
>
> It would be nice to specify a default value for a given field in the schema.  
> Chris Hostetter suggested this in:
> http://www.mail-archive.com/solr-user@lucene.apache.org/msg01564.html

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to