Adding the document id to error message when you send multiple values for a single valued field.

git-svn-id: https://svn.apache.org/repos/asf/lucene/solr/trunk@583320 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Ryan McKinley 2007-10-09 23:22:53 +00:00
parent 3de84b4857
commit e9c5d47cf3
1 changed files with 6 additions and 1 deletions

View File

@ -179,8 +179,13 @@ public class DocumentBuilder {
// Make sure it has the correct number
if( sfield!=null && !sfield.multiValued() && field.getValueCount() > 1 ) {
String id = "";
SchemaField sf = schema.getUniqueKeyField();
if( sf != null ) {
id = "["+doc.getFieldValue( sf.getName() )+"] ";
}
throw new SolrException( SolrException.ErrorCode.BAD_REQUEST,
"ERROR: multiple values encountered for non multiValued field " +
"ERROR: "+id+"multiple values encountered for non multiValued field " +
sfield.getName() + ": " +field.getValue() );
}