Class CountFieldValuesUpdateProcessorFactory
- All Implemented Interfaces:
NamedListInitializedPlugin,SolrCoreAware
By default, this processor matches no fields.
The typical use case for this processor would be in combination with the CloneFieldUpdateProcessorFactory so that it's possible to query by the quantity of values in the
source field.
For example, in the configuration below, the end result will be that the category_count
field can be used to search for documents based on how many values they contain in the
category field.
<processor class="solr.CloneFieldUpdateProcessorFactory"> <str name="source">category</str> <str name="dest">category_count</str> </processor> <processor class="solr.CountFieldValuesUpdateProcessorFactory"> <str name="fieldName">category_count</str> </processor> <processor class="solr.DefaultValueUpdateProcessorFactory"> <str name="fieldName">category_count</str> <int name="value">0</int> </processor>
NOTE: The use of DefaultValueUpdateProcessorFactory is important in this
example to ensure that all documents have a value for the category_count field,
because CountFieldValuesUpdateProcessorFactory only replaces the list of
values with the size of that list. If DefaultValueUpdateProcessorFactory was not
used, then any document that had no values for the category field, would also have
no value in the category_count field.
- Since:
- 4.0.0
-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.solr.update.processor.FieldMutatingUpdateProcessorFactory
FieldMutatingUpdateProcessorFactory.SelectorParamsNested classes/interfaces inherited from class org.apache.solr.update.processor.UpdateRequestProcessorFactory
UpdateRequestProcessorFactory.RunAlways -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetInstance(SolrQueryRequest req, SolrQueryResponse rsp, UpdateRequestProcessor next) Methods inherited from class org.apache.solr.update.processor.FieldMutatingUpdateProcessorFactory
getDefaultSelector, getSelector, inform, init, parseSelectorExclusionParams, parseSelectorParams
-
Constructor Details
-
CountFieldValuesUpdateProcessorFactory
public CountFieldValuesUpdateProcessorFactory()
-
-
Method Details
-
getInstance
public UpdateRequestProcessor getInstance(SolrQueryRequest req, SolrQueryResponse rsp, UpdateRequestProcessor next) - Specified by:
getInstancein classUpdateRequestProcessorFactory
-