On Thu, Dec 10, 2015 at 1:26 PM, Bogdan Marinescu <
bogdan.marine...@awinta.com> wrote:

> Problem is I was manually exporting data from a database and converting it
> into sol'r docs and writing it to sol'r. No checks were performed if the
> converted doc had children or not so I can't really tell if I was doing it
> in this order or reversed (first the parent and child and then only the
> childless parent).
>

Empty child doc can be added into childless parent by
http://wiki.apache.org/solr/ScriptUpdateProcessor.


>
> I'm not entirely sure that sol'r would append the child to the already
> existing parent but I can check that out.
>
> As for the delete, I'm using deleteByQuery(_root_:parentID). This works
> fine because the id of the parent is placed in the _root_ of the children.
>
> I wouldn't use the child query as that performs a ToBlockJoinQuery and
> I've had problems with that before (if you recall SOLR-6700 <
> https://issues.apache.org/jira/browse/SOLR-6700>)
>
> I'll try your workaround suggestion and hopefully this will be fixed so I
> don't have to worry about the order I add the parents and children to sol'r
> :)
>
> Thanks
>
>
>
> On 12/10/2015 11:14 AM, Mikhail Khludnev wrote:
>
>> On Thu, Dec 10, 2015 at 12:38 PM, Bogdan Marinescu <
>> bogdan.marine...@awinta.com> wrote:
>>
>> I'm interested in the workaround.
>>>
>>
>> If you add the childless document first and afterwards the child, then
>>
>>> sol'r should append the child to the already existing document (or rather
>>> delete the existing one as the new one has newer data).
>>>
>>> I'd suggest to add empty child doc into every empty parent.
>>
>> I've faced this problem where I was just deleting the parent by id and I
>>
>>> had lots of orphan documents just laying around.
>>>
>>> deleteByQuery should be amended <uniqKey>:999 should be turned to
>> _root_:999, the you need to do instead of deleteById.
>> If you have deleteByQuery(Brand:Nike) (matching parents), it needs to be
>> turned to deleteByQuery(Brand:Nike {!child of=parent:true}Brand:Nike)
>>
>>
>


-- 
Sincerely yours
Mikhail Khludnev
Principal Engineer,
Grid Dynamics

<http://www.griddynamics.com>
<mkhlud...@griddynamics.com>

Reply via email to