Tania Marinova
Tania Marinova

Reputation: 1898

solr CopyField with source - two fields

I've got a field in solr - name (with values like Tanya ) and lastname (values like Marinova)

Is it possible to make another CopyField in solr that's a concatenation of these two field

(so it's value should be TanyaMarinova)

Here is my schema.xml file

 <field name="meta" type="string" indexed="true" stored="true" /> 
  <copyField source="name" dest="meta" /> 

can i just aadd

  <copyField source="lastname" dest="meta" /> 

Upvotes: 2

Views: 4903

Answers (1)

lexk
lexk

Reputation: 761

No, you can't achieve this. You should induce it outside of SOLR. You can route 2 fields into one copyField, but then you will just have a multivalue field with 2 values for your document (Tanya, Marinova). You cannot concatenate like this.

If you really insist on doing this in SOLR, you should look into IndexSchema and FieldType and implement your own field type. It's much more work than doing external concatenation though.

Upvotes: 6

Related Questions