org.apache.solr.update.processor.MinFieldValueUpdateProcessorFactory Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of solr-core Show documentation
Show all versions of solr-core Show documentation
Apache Solr (module: core)
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.solr.update.processor;
import java.util.Collection;
import java.util.Collections;
import org.apache.solr.common.SolrException;
import org.apache.solr.core.SolrCore;
import org.apache.solr.update.processor.FieldMutatingUpdateProcessor.FieldNameSelector;
import static org.apache.solr.common.SolrException.ErrorCode.BAD_REQUEST;
import static org.apache.solr.update.processor.FieldMutatingUpdateProcessor.SELECT_NO_FIELDS;
/**
* An update processor that keeps only the the minimum value from any selected
* fields where multiple values are found. Correct behavior requires tha all
* of the values in the SolrInputFields being mutated are mutually comparable;
* If this is not the case, then a SolrException will br thrown.
*
* By default, this processor matches no fields.
*
*
*
* In the example configuration below, if a document contains multiple integer
* values (ie: 64, 128, 1024
) in the field
* smallestFileSize
then only the smallest value
* (ie: 64
) will be kept in that field.
*
*
*
* <processor class="solr.MinFieldValueUpdateProcessorFactory">
* <str name="fieldName">smallestFileSize</str>
* </processor>
*
*
* @see MaxFieldValueUpdateProcessorFactory
* @see Collections#min
* @since 4.0.0
*/
public final class MinFieldValueUpdateProcessorFactory extends FieldValueSubsetUpdateProcessorFactory {
@Override
@SuppressWarnings({"unchecked"})
public Collection