mirror of https://github.com/apache/lucene.git
SOLR-6735: Make CloneFieldUpdateProcessorFactory null safe
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1649323 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
d251c71a97
commit
c0b2330827
|
@ -397,6 +397,8 @@ Bug Fixes
|
|||
* SOLR-6874: There is a race around SocketProxy binding to it's port the way we setup
|
||||
JettySolrRunner and SocketProxy. (Mark Miller, Timothy Potter)
|
||||
|
||||
* SOLR-6735: Make CloneFieldUpdateProcessorFactory null safe (Steve Davids via ehatcher)
|
||||
|
||||
|
||||
Optimizations
|
||||
----------------------
|
||||
|
|
|
@ -16,31 +16,25 @@
|
|||
*/
|
||||
package org.apache.solr.update.processor;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Collection;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.HashSet;
|
||||
|
||||
import org.apache.solr.core.SolrCore;
|
||||
import org.apache.solr.util.plugin.SolrCoreAware;
|
||||
|
||||
import org.apache.solr.common.util.NamedList;
|
||||
|
||||
import org.apache.solr.common.SolrInputField;
|
||||
import org.apache.solr.common.SolrInputDocument;
|
||||
|
||||
import org.apache.solr.common.SolrException;
|
||||
import static org.apache.solr.common.SolrException.ErrorCode.SERVER_ERROR;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.solr.common.SolrException;
|
||||
import org.apache.solr.common.SolrInputDocument;
|
||||
import org.apache.solr.common.SolrInputField;
|
||||
import org.apache.solr.common.util.NamedList;
|
||||
import org.apache.solr.core.SolrCore;
|
||||
import org.apache.solr.request.SolrQueryRequest;
|
||||
import org.apache.solr.response.SolrQueryResponse;
|
||||
|
||||
import org.apache.solr.update.AddUpdateCommand;
|
||||
|
||||
import org.apache.solr.update.processor.FieldMutatingUpdateProcessorFactory.SelectorParams;
|
||||
import org.apache.solr.update.processor.FieldMutatingUpdateProcessor.FieldNameSelector;
|
||||
|
||||
import org.apache.solr.update.processor.FieldMutatingUpdateProcessorFactory.SelectorParams;
|
||||
import org.apache.solr.util.plugin.SolrCoreAware;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
|
@ -221,8 +215,11 @@ public class CloneFieldUpdateProcessorFactory
|
|||
boolean modified = false;
|
||||
for (final String fname : doc.getFieldNames()) {
|
||||
if (! srcSelector.shouldMutate(fname)) continue;
|
||||
|
||||
Collection<Object> srcFieldValues = doc.getFieldValues(fname);
|
||||
if(srcFieldValues == null || srcFieldValues.isEmpty()) continue;
|
||||
|
||||
for (Object val : doc.getFieldValues(fname)) {
|
||||
for (Object val : srcFieldValues) {
|
||||
// preserve existing dest boost (multiplicitive), ignore src boost
|
||||
destField.addValue(val, 1.0f);
|
||||
}
|
||||
|
|
|
@ -823,6 +823,7 @@ public class FieldMutatingUpdateProcessorTest extends UpdateProcessorTestBase {
|
|||
f("editors", "John W. Campbell"),
|
||||
f("store1_price", 87),
|
||||
f("store2_price", 78),
|
||||
f("store3_price", (Object) null),
|
||||
f("list_price", 1000)));
|
||||
assertNotNull(d);
|
||||
assertEquals("misc",d.getFieldValue("category"));
|
||||
|
|
Loading…
Reference in New Issue