mirror of https://github.com/apache/lucene.git
SOLR-1695: Added an earlier check for multiple values being used in the uniqueKey field - prior to this the only check was done in the UpdateHandler (IndexSchema logs an erro if the field is declared multiValued=true, but it's not considered fatal since it will still work as long as clients only send one value)
git-svn-id: https://svn.apache.org/repos/asf/lucene/solr/trunk@911232 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
fb0ccdf724
commit
95480576eb
|
@ -242,8 +242,8 @@ Other Changes
|
|||
* SOLR-1771: Improved error message when StringIndex cannot be initialized
|
||||
for a function query (hossman)
|
||||
|
||||
* SOLR-1695: Improved error message when adding a document that does not
|
||||
contain a value for the uniqueKey field (hossman)
|
||||
* SOLR-1695: Improved error messages when adding a document that does not
|
||||
contain exactly one value for the uniqueKey field (hossman)
|
||||
|
||||
Build
|
||||
----------------------
|
||||
|
|
|
@ -232,9 +232,15 @@ public class DocumentBuilder {
|
|||
Collection<Object> keys = doc.getFieldValues(uniqueKeyField.getName());
|
||||
if (null == keys || keys.isEmpty()) {
|
||||
throw new SolrException(SolrException.ErrorCode.BAD_REQUEST,
|
||||
"Document missing value for uniqueKeyField: " +
|
||||
"Document missing a value for uniqueKey field: " +
|
||||
uniqueKeyField.getName());
|
||||
}
|
||||
if (1 < keys.size()) {
|
||||
throw new SolrException
|
||||
(SolrException.ErrorCode.BAD_REQUEST,
|
||||
"Document contains multiple values for uniqueKey field: " +
|
||||
uniqueKeyField.getName());
|
||||
}
|
||||
}
|
||||
|
||||
// Load fields from SolrDocument to Document
|
||||
|
|
Loading…
Reference in New Issue