Forgot to mention that delete works fine with TemplateTransformer when
you are using it to create unique values for uniqueid field in solr
and that same field is defined as pk in data config.


schema.xml

<field name="uuid" type="string" indexed="true" stored="true" required="true" />
......
<uniqueKey>uuid</uniqueKey>


data-config.xml

<entity name="blog" pk="uuid"....
<field column="uuid" name="uuid" template="blog-${blog.blog_id}" />
......
<entity name="entry" pk="uuid"......
<field column="uuid" name="uuid" template="blog-${entry.entry_id}" />


DIH performs delete by getting value from field defined as pk in
data-config and tries to delete document from index using this value
to match to the field defined as uniqueId in schema. So if uniqueId
and pk fields are different then DIH would probably fail to delete
anything or it will delete something that is not supposed to be
deleted.


2011/1/7 Matti Oinas <matti.oi...@gmail.com>:
> Concat doesn't work as expected.
>
> Doing SELECT concat('blog-',id) as uuid.... instead of template
> transformer the uuid in the index would be something like
>
> <str name="uuid">[...@d760bb</str>
>
> instead of
>
> <str name="uuid">blog-1</str>
>
> I haven't tested if DIH can perform delete when using concat but at
> least you can not delete by uuid from anywhere else when using concat.
>
> 2011/1/5 Ephraim Ofir <ephra...@icq.com>:
>> You could get around that by doing the concatenation at the SQL level, that 
>> way deletes would work as well.
>>
>> Ephraim Ofir
>>
>> -----Original Message-----
>> From: Matti Oinas [mailto:matti.oi...@gmail.com]
>> Sent: Tuesday, January 04, 2011 3:57 PM
>> To: solr-user@lucene.apache.org
>> Subject: Re: DataImportHanlder - Multiple entities will step into each other
>>
>> I managed to do that by using TemplateTransformer
>>
>> <document>
>>  <entity name="company"..... transformer="TemplateTransformer">
>>     <field column="id" name="id" template="company-${company.id}" />
>> ...
>>  <entity name="item"..... transformer="TemplateTransformer">
>>     <field column="id" name="id" template="item-${item.id}" />
>> ...
>> </document>
>>
>> Only problem is that delta import fails to perform delete to the
>> index. It seems that TemplateTransformer is not used when performing
>> delete so delete by id doesn't work.
>>
>>
>>
>> 2011/1/4 yu shen <shenyu...@gmail.com>:
>>> Hi All,
>>>
>>> I have a dataimporthandler config file as below. It contains multiple
>>> entities:
>>> <dataConfig>
>>>        <dataSource name="jdbc" driver="com.mysql.jdbc.Driver"
>>>
>>> url="jdbc:mysql://localhost:1521/changan?useUnicode=true&amp;characterEncoding=utf8&amp;autoReconnect=true"...
>>> />
>>>        <document>
>>>                <entity name="item" dataSource="jdbc" pk="id" query="...">
>>>                <entity name="company" dataSource="jdbc" pk="id" query="">
>>>                ....
>>>        </document>
>>> </dataConfig>
>>>
>>> All data are from a database. Problem is item/company and other entity all
>>> have the field 'id', with value start from 1 to n. In this case,
>>> item/company etc. will step into each other.
>>> Is there a way to prevent is from happening. Such as designate different
>>> entity to different partition.
>>>
>>> One way I can think of is to seperate different entity to different
>>> instance, which is not ideal solution IMO.
>>>
>>> Would some one point me to a reference? And also give some instructions?
>>>
>>
>

Reply via email to