How to use Solr copyfield to copy a value and modify it before storing it



First let me begin by saying that I am a total noob when it comes to configuring Solr (I am using version 3.6.2 by the way). I would like to do is create a new field by copying a value from another field and then modifying it before it gets stored. In this particular case I would like to copy the year field (which contains a year as a string ie 2014) and then convert that into a proper date value compatible with Solr's DateField.


I thought of using copyfield as a method to accomplish this but I am not sure how to do the conversion part of it. This is what I have so far:



<field name="dc.date" type="text_en" indexed="true" stored="true" multiValued="true"/>
<copyField source="dc.date" dest="dc.date_dt"/>
<field name="dc.date_dt" type="date" multiValued="false" indexed="true" stored="true"/>


How would one go about accomplishing this?


No comments:

Post a Comment