You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Ashish P <as...@gmail.com> on 2009/03/06 03:10:17 UTC

index multi valued field into multiple fields

I have a multi valued field as follows:
<field
name="condition"><![CDATA[content:data1,tsdatetime:2001-01-01T00\:00\:00.000Z]]></field>

I want to index the data from this field into following fields
<field name="content" type="string" indexed="true" stored="true"/>
<field name="tsdatetime" type="date" indexed="true" stored="true"/>

How can this be done?? Any ideas...
-- 
View this message in context: http://www.nabble.com/index-multi-valued-field-into-multiple-fields-tp22364915p22364915.html
Sent from the Solr - User mailing list archive at Nabble.com.


Re: index multi valued field into multiple fields

Posted by Ashish P <as...@gmail.com>.
hmm. I think I will just do that. 
Thanks for clearing my doubt...
-Ashish


Shalin Shekhar Mangar wrote:
> 
> On Fri, Mar 6, 2009 at 10:53 AM, Ashish P <as...@gmail.com>
> wrote:
> 
>>
>> OK. so basically what you are saying is when you use copyField, it will
>> copy
>> the whole data from one field to other many fields but it can not copy
>> part
>> of data to other field.
> 
> 
> Yes, it will try to copy all the data.
> 
> 
>>
>> Because within same tokenizing ( when I am tokenizing "condition" field )
>> I
>> want part of data to go into content field and part of data to go into
>> tsdatetime field. But that looks like not possible.
>> The field "condition" is actually mix of multiple data values.
>>
> 
> Why not send both values to different fields at index time explicitly?
> 
> -- 
> Regards,
> Shalin Shekhar Mangar.
> 
> 

-- 
View this message in context: http://www.nabble.com/index-multi-valued-field-into-multiple-fields-tp22364915p22366918.html
Sent from the Solr - User mailing list archive at Nabble.com.


Re: index multi valued field into multiple fields

Posted by Shalin Shekhar Mangar <sh...@gmail.com>.
On Fri, Mar 6, 2009 at 10:53 AM, Ashish P <as...@gmail.com> wrote:

>
> OK. so basically what you are saying is when you use copyField, it will
> copy
> the whole data from one field to other many fields but it can not copy part
> of data to other field.


Yes, it will try to copy all the data.


>
> Because within same tokenizing ( when I am tokenizing "condition" field ) I
> want part of data to go into content field and part of data to go into
> tsdatetime field. But that looks like not possible.
> The field "condition" is actually mix of multiple data values.
>

Why not send both values to different fields at index time explicitly?

-- 
Regards,
Shalin Shekhar Mangar.

Re: index multi valued field into multiple fields

Posted by Ashish P <as...@gmail.com>.
OK. so basically what you are saying is when you use copyField, it will copy
the whole data from one field to other many fields but it can not copy part
of data to other field.
Because within same tokenizing ( when I am tokenizing "condition" field ) I
want part of data to go into content field and part of data to go into
tsdatetime field. But that looks like not possible.
The field "condition" is actually mix of multiple data values.


Shalin Shekhar Mangar wrote:
> 
> On Fri, Mar 6, 2009 at 7:40 AM, Ashish P <as...@gmail.com> wrote:
> 
>>
>> I have a multi valued field as follows:
>> <field
>>
>> name="condition"><![CDATA[content:data1,tsdatetime:2001-01-01T00\:00\:00.000Z]]></field>
>>
>> I want to index the data from this field into following fields
>> <field name="content" type="string" indexed="true" stored="true"/>
>> <field name="tsdatetime" type="date" indexed="true" stored="true"/>
>>
>> How can this be done?? Any ideas...
> 
> 
> Use a copyField (look at the schema shipped with solr for an example).
> 
> However, you can copy individual values from a multi-valued field into two
> different fields. The copyField of a multi-valued field should also be
> multi-valued otherwise it will retain only the last value.
> 
> -- 
> Regards,
> Shalin Shekhar Mangar.
> 
> 

-- 
View this message in context: http://www.nabble.com/index-multi-valued-field-into-multiple-fields-tp22364915p22366393.html
Sent from the Solr - User mailing list archive at Nabble.com.


Re: index multi valued field into multiple fields

Posted by Shalin Shekhar Mangar <sh...@gmail.com>.
On Fri, Mar 6, 2009 at 7:40 AM, Ashish P <as...@gmail.com> wrote:

>
> I have a multi valued field as follows:
> <field
>
> name="condition"><![CDATA[content:data1,tsdatetime:2001-01-01T00\:00\:00.000Z]]></field>
>
> I want to index the data from this field into following fields
> <field name="content" type="string" indexed="true" stored="true"/>
> <field name="tsdatetime" type="date" indexed="true" stored="true"/>
>
> How can this be done?? Any ideas...


Use a copyField (look at the schema shipped with solr for an example).

However, you can copy individual values from a multi-valued field into two
different fields. The copyField of a multi-valued field should also be
multi-valued otherwise it will retain only the last value.

-- 
Regards,
Shalin Shekhar Mangar.