2

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" /> 
Tania Marinova
  • 1,788
  • 8
  • 39
  • 67

1 Answers1

6

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.

lexk
  • 761
  • 3
  • 7
  • One last question - why when I write in the scehma.xml I see again only the name in the copy field – Tania Marinova Mar 24 '13 at 12:08
  • Please see here: http://stackoverflow.com/questions/11154656/how-can-copy-2-fields-data-to-one-field-on-solr - a very similar question. – lexk Mar 24 '13 at 12:24
  • yes i had seen this question long ago before I decided to post. But I saw that the person who asked the question also gets an error when indexing a multivalued field. ANd i got only value of the name; i don't understand why it doesn't add the value of lastname – Tania Marinova Mar 24 '13 at 12:43