lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mikhail Khludnev <m...@apache.org>
Subject Re: Child=true does not work for data import handler
Date Tue, 07 Aug 2018 04:46:47 GMT
It never works like you expect. You need to search for parents and then
hook up [child]. I see some improvements are coming, but now that is.

On Mon, Aug 6, 2018 at 9:11 PM omprab@rediffmail.com <omkar.prabhu@gmail.com>
wrote:

> Thanks Mikhail verbose did help. _root_ field was missing in schema also in
> make some changes in child entity. Like i created id as alias to emp_id (
> in
> child query) which is id column of parent table.
>
>                 <entity name="parent" pk="id" datasource="ds-1"
> query="SELECT id,name
> FROM emp">
>                                 <field column="id" name="id" />
>                                 <field column="name" name="name" />
>                                         <entity child='true'
> name="child"  query="SELECT dept,emp_id as id
> FROM emp_details where emp_id='${parent.id}' ">
>                                                         <field
> column="dept" name="dept" />
>                                         </entity>
>                 </entity>
>
>
> Data seems to be returning correctly as below. but it show child documents
> and parent documents are shown as individual document. i was expecting 2
> documents and 2 child document for each doc.
> Any inputs will be helpful
>
>
>  "response":{"numFound":6,"start":0,"docs":[
>       {
>         "dept":"IT",
>         "id":"1",
>         "_version_":1608073809653399552},
>       {
>         "dept":"Data",
>         "id":"1",
>         "_version_":1608073809653399552},
>       {
>         "name":"omkar",
>         "id":"1",
>         "_version_":1608073809653399552},
>       {
>         "dept":"ITI",
>         "id":"2",
>         "_version_":1608073809667031040},
>       {
>         "dept":"Entry",
>         "id":"2",
>         "_version_":1608073809667031040},
>       {
>         "name":"ashwin",
>         "id":"2",
>         "_version_":1608073809667031040}]
>   }}
>
>
>
> --
> Sent from: http://lucene.472066.n3.nabble.com/Solr-User-f472068.html
>


-- 
Sincerely yours
Mikhail Khludnev

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message