Reputation: 1562
When I have a copyfield directive like,
<field name="a" multiValued="false"...
<field name="b" multiValued="false"...
<copyField source="a" dest="b"...
And I send a document containing field named “b”, Solr tries to write 2 values into “b” field (one from the incoming doc and one from the copyfield) and gives error because “b” is not a multi valued field.
My document update requests sometimes contain field b, sometimes not. When they are absent I want to copy the value from "a" field.
Is it possible to activate copyField directive only when dest field is absent from the incoming document?
Upvotes: 2
Views: 99
Reputation: 1221
Solr provides an index-time hook for processing like this. Write and configure an update request processor script to check for the presence of that field, then fill it if it is missing.
https://lucene.apache.org/solr/guide/8_7/update-request-processors.html
Upvotes: 1