On Mon, Sep 14, 2009 at 5:12 PM, Rahul R <rahul.s...@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.

Reply via email to