Reputation: 173
I currently have documents in Solr with the following tag
FirstName:Some name LastName:Some name
I would like to add to all the documents another tag Full Name that will concat FirstName + " " + Last Name
Is there some way to do this (I do not want to use a copy field since in the future I will insert values into Full name directly
Thanks,
Shimon
Upvotes: 0
Views: 1030
Reputation: 1235
Not sure why you don't want to use copyfield as this is what exactly it's for. You could do via your schema.xml file as follows:
<field name="FullName" type="text" indexed="true" stored="true" multiValued="true"/>
<copyField source="FirstName" dest="FullName"/>
<copyField source="LastName" dest="FullName"/>
Then simply remove the copyfield from the schema when no longer needed and re-index your collection.
Another alternative if you are using DIH would be to join the first and last name together into a string seperated with teh space and then insert that into your FullName field:
Schema.xml:
<field name="FullName" type="text" indexed="true" stored="true" multiValued="true"/>
db-data-config.xml
select table.FirstName + " " + table.LastName as 'dbFullName'
...
<field column="dbFullName" name="FullName" />
Upvotes: 1