Merging Fields

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Merging Fields

Jae Joo
Is there any way to merge fields  during indexing time.

I have field1 and field2 and would like to combine these fields and make
field3.
In the document, there are field1 and field2, and I may build field3 using
CopyField.

Thanks,

Jae
Reply | Threaded
Open this post in threaded view
|

RE: Merging Fields

Keene, David
Jae,

The easiest way to do this is with CopyField.  

These entries in your schema will accomplish that:

<field name="field3" type="String" indexed="true" stored="false"
multiValued="true"/>

<copyField source="field1" dest="field3"/>
<copyField source="field2" dest="field3"/>


Field 3 will have the tokens from both field 1 and 2 in it.

If you want to merge those 2 fields for display, I would just concat
them at display time.

Dave



-----Original Message-----
From: Jae Joo [mailto:[hidden email]]
Sent: Friday, October 05, 2007 9:22 AM
To: solr-user
Subject: Merging Fields

Is there any way to merge fields  during indexing time.

I have field1 and field2 and would like to combine these fields and make
field3.
In the document, there are field1 and field2, and I may build field3
using
CopyField.

Thanks,

Jae
Reply | Threaded
Open this post in threaded view
|

RE: Merging Fields

Lance Norskog-2
A gotcha here is that <copyField> creates multiple values. Each field copied
in becomes a separate field. If you wanted a single-valued field this will
not work.

Lance Norskog

-----Original Message-----
From: Keene, David [mailto:[hidden email]]
Sent: Friday, October 05, 2007 10:50 AM
To: [hidden email]
Subject: RE: Merging Fields

Jae,

The easiest way to do this is with CopyField.  

These entries in your schema will accomplish that:

<field name="field3" type="String" indexed="true" stored="false"
multiValued="true"/>

<copyField source="field1" dest="field3"/> <copyField source="field2"
dest="field3"/>


Field 3 will have the tokens from both field 1 and 2 in it.

If you want to merge those 2 fields for display, I would just concat them at
display time.

Dave



-----Original Message-----
From: Jae Joo [mailto:[hidden email]]
Sent: Friday, October 05, 2007 9:22 AM
To: solr-user
Subject: Merging Fields

Is there any way to merge fields  during indexing time.

I have field1 and field2 and would like to combine these fields and make
field3.
In the document, there are field1 and field2, and I may build field3 using
CopyField.

Thanks,

Jae