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 Rahul R <ra...@gmail.com> on 2009/09/14 13:42:35 UTC

Questions on copyField

Hello,
I have a few questions regarding the copyField directive in schema.xml

1. Does the destination field store a reference or the actual data ?
If I have soemthing like this
<copyField source="name" dest="text"/>
then will the values in the 'name' field get copied into the 'text' field or
will the 'text' field only store a reference to the 'name' field ? To put it
more simply, if I later delete the 'name' field from the index will I lose
the corresponding data in the 'text' field ?

2. Is there any inbuilt API which I can use to do the copyField action
programmatically ?

3. Can I do a copyfield from the schema as well as programmatically for the
same destination field
Suppose I want the 'text' field to contain values for name, age and
location. In my index only 'name' and 'age' are defined as fields. So I can
add directives like
<copyField source="name" dest="text"/>
<copyField source="age" dest="text"/>
The location however, I want to add it to the 'text' field programmatically.
I don't want to store the location as a separate field in the index. Can I
do this ?

Thank you.

Regards
Rahul

Re: Questions on copyField

Posted by Rahul R <ra...@gmail.com>.
Would appreciate any help on this. Thanks

Rahul
On Mon, Sep 14, 2009 at 5:12 PM, Rahul R <ra...@gmail.com> wrote:

> Hello,
> I have a few questions regarding the copyField directive in schema.xml
>
> 1. Does the destination field store a reference or the actual data ?
> If I have soemthing like this
> <copyField source="name" dest="text"/>
> then will the values in the 'name' field get copied into the 'text' field
> or will the 'text' field only store a reference to the 'name' field ? To put
> it more simply, if I later delete the 'name' field from the index will I
> lose the corresponding data in the 'text' field ?
>
> 2. Is there any inbuilt API which I can use to do the copyField action
> programmatically ?
>
> 3. Can I do a copyfield from the schema as well as programmatically for the
> same destination field
> Suppose I want the 'text' field to contain values for name, age and
> location. In my index only 'name' and 'age' are defined as fields. So I can
> add directives like
> <copyField source="name" dest="text"/>
> <copyField source="age" dest="text"/>
> The location however, I want to add it to the 'text' field
> programmatically. I don't want to store the location as a separate field in
> the index. Can I do this ?
>
> Thank you.
>
> Regards
> Rahul
>

Re: Questions on copyField

Posted by Rahul R <ra...@gmail.com>.
Thank you Shalin.

Regards
Rahul

On Thu, Sep 17, 2009 at 11:49 AM, Shalin Shekhar Mangar <
shalinmangar@gmail.com> wrote:

> On Thu, Sep 17, 2009 at 11:19 AM, Rahul R <ra...@gmail.com> wrote:
>
> > Shalin,
> > Can you please elaborate a little more on the third response
> > *You can send the location's value directly as the value of the text
> > field.*
> > I dont follow. I am adding 'name' and 'age' to the 'text' field through
> the
> > schema. If I add the 'location' from the program, will either one copy
> > (schema or program) not over-write the other ?
> >
>
> No, it will not overwrite, it will just append values of name and age to
> the
> values already sent as the text field.
> --
> Regards,
> Shalin Shekhar Mangar.
>

Re: Questions on copyField

Posted by Shalin Shekhar Mangar <sh...@gmail.com>.
On Thu, Sep 17, 2009 at 11:19 AM, Rahul R <ra...@gmail.com> wrote:

> Shalin,
> Can you please elaborate a little more on the third response
> *You can send the location's value directly as the value of the text
> field.*
> I dont follow. I am adding 'name' and 'age' to the 'text' field through the
> schema. If I add the 'location' from the program, will either one copy
> (schema or program) not over-write the other ?
>

No, it will not overwrite, it will just append values of name and age to the
values already sent as the text field.
-- 
Regards,
Shalin Shekhar Mangar.

Re: Questions on copyField

Posted by Rahul R <ra...@gmail.com>.
Shalin,
Can you please elaborate a little more on the third response
*You can send the location's value directly as the value of the text field.*
I dont follow. I am adding 'name' and 'age' to the 'text' field through the
schema. If I add the 'location' from the program, will either one copy
(schema or program) not over-write the other ?
*Also note, that you don't really need to index/store the source field. You
can make the location field's type as ignored in the schema.*
Understood

Thank you for your response.

Regards
Rahul
On Wed, Sep 16, 2009 at 1:56 PM, Shalin Shekhar Mangar <
shalinmangar@gmail.com> wrote:

> On Mon, Sep 14, 2009 at 5:12 PM, Rahul R <ra...@gmail.com> wrote:
>
> > Hello,
> > I have a few questions regarding the copyField directive in schema.xml
> >
> > 1. Does the destination field store a reference or the actual data ?
> >
>
> It makes a copy. Storing or indexing of the field depends on the field
> configuration.
>
>
> > If I have soemthing like this
> > <copyField source="name" dest="text"/>
> > then will the values in the 'name' field get copied into the 'text' field
> > or
> > will the 'text' field only store a reference to the 'name' field ? To put
> > it
> > more simply, if I later delete the 'name' field from the index will I
> lose
> > the corresponding data in the 'text' field ?
> >
> >
> The values will get copied. If you delete all values from the 'name' field
> from the index, the data in "text" field remain as-is.
>
>
>
> > 2. Is there any inbuilt API which I can use to do the copyField action
> > programmatically ?
> >
> >
> No. But you can always copy explicitly before sending or you can use a
> custom UpdateRequestProcessor to copy values from one field to another
> during indexing.
>
>
> > 3. Can I do a copyfield from the schema as well as programmatically for
> the
> > same destination field
> > Suppose I want the 'text' field to contain values for name, age and
> > location. In my index only 'name' and 'age' are defined as fields. So I
> can
> > add directives like
> > <copyField source="name" dest="text"/>
> > <copyField source="age" dest="text"/>
> > The location however, I want to add it to the 'text' field
> > programmatically.
> > I don't want to store the location as a separate field in the index. Can
> I
> > do this ?
> >
> >
> You can send the location's value directly as the value of the text field.
> Also note, that you don't really need to index/store the source field. You
> can make the location field's type as ignored in the schema.
>
> --
> Regards,
> Shalin Shekhar Mangar.
>

Re: Questions on copyField

Posted by Shalin Shekhar Mangar <sh...@gmail.com>.
On Mon, Sep 14, 2009 at 5:12 PM, Rahul R <ra...@gmail.com> wrote:

> Hello,
> I have a few questions regarding the copyField directive in schema.xml
>
> 1. Does the destination field store a reference or the actual data ?
>

It makes a copy. Storing or indexing of the field depends on the field
configuration.


> If I have soemthing like this
> <copyField source="name" dest="text"/>
> then will the values in the 'name' field get copied into the 'text' field
> or
> will the 'text' field only store a reference to the 'name' field ? To put
> it
> more simply, if I later delete the 'name' field from the index will I lose
> the corresponding data in the 'text' field ?
>
>
The values will get copied. If you delete all values from the 'name' field
from the index, the data in "text" field remain as-is.



> 2. Is there any inbuilt API which I can use to do the copyField action
> programmatically ?
>
>
No. But you can always copy explicitly before sending or you can use a
custom UpdateRequestProcessor to copy values from one field to another
during indexing.


> 3. Can I do a copyfield from the schema as well as programmatically for the
> same destination field
> Suppose I want the 'text' field to contain values for name, age and
> location. In my index only 'name' and 'age' are defined as fields. So I can
> add directives like
> <copyField source="name" dest="text"/>
> <copyField source="age" dest="text"/>
> The location however, I want to add it to the 'text' field
> programmatically.
> I don't want to store the location as a separate field in the index. Can I
> do this ?
>
>
You can send the location's value directly as the value of the text field.
Also note, that you don't really need to index/store the source field. You
can make the location field's type as ignored in the schema.

-- 
Regards,
Shalin Shekhar Mangar.