lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Preeti Bhat <preeti.b...@shoregrp.com>
Subject RE: Return specific field from child documents.
Date Tue, 31 Jan 2017 07:30:02 GMT
Hi Mikhail,

I was trying to restrict the data from child documents due to one of the request of the client
where they would need the specific fields as output. The below query gives me the firstName
and Last Name as expected but not the email which is part of the child document.
http://localhost:8984/solr/Contact/select?fl=FirstName,LastName,email,%20[child%20parentFilter=content_type:parent%20]&indent=on&q={!parent%20which=%22content_type:parent%22}%20email:%22temper.t@tempest.com%22&wt=json

I did try the sub query, but its returning only the parent document. Not sure if I am missing
something here.

http://localhost:8984/solr/Contact/select??fl=id,FirstName,email,emp:[subquery]&emp.rows=10&emp.fl=email&emp.q={!term%20f=contact_id%20v=$row.id}&indent=on&q=%7b!parent%20which=%22content_type:parent%22%7d%20email:%22temper.t@tempest.com%22&wt=json&expandMacros=true

I am expecting the result to be something like this. Could you please advise.
{
        "FirstName":"temptest",
        "LastName":"temper",
"_childDocuments_":[
{ "email":["temper.t@tempest.com"]
},
{"email":["temper.ttttt@tempt.com"]
}
]
}

Thanks and Regards,
Preeti Bhat

-----Original Message-----
From: Mikhail Khludnev [mailto:mkhl@apache.org]
Sent: Monday, January 30, 2017 5:49 PM
To: solr-user
Subject: Re: Return specific field from child documents.

Hello,

You hardly get any gain limiting child field output. You can do that with [subquery] result
transformer.

On Mon, Jan 30, 2017 at 11:09 AM, Preeti Bhat <preeti.bhat@shoregrp.com>
wrote:

> Hi All,
>
> I am trying out the nested documents concept for SOLR. I am able to
> show the specific field for the parent document like
> "FirstName","LastName" but I am not able to show the specific field in fl for child.
>
> I would like to retrieve the email from the _childDocuments. Could
> someone please advise.
>
> Q=+FirstName:"etr4tr" {!parent which="content_type:parent"}
> Fl=FirstName,LastName,email, [child parentFilter=content_type:parent ]
>
>   "response":{"numFound":1,"start":0,"docs":[
>       {
>         "FirstName":"etr4tr",
>         "LastName":"wrer6t",
>         "_childDocuments_":[
>         {
>           "id":"3556|12",
>           "company_id":["12"],
>           "email":["ehrijw.egru@bbbbb.com"],
>           "isPrimary":["true"]},
>         {
>           "id":"3556|45",
>           "company_id":["45"],
>           "email":["ehrijw.eer54gru@ccc.com"]}]}]
>   }}
>
>
> Thanks and Regards,
> Preeti Bhat
>
>
>
> NOTICE TO RECIPIENTS: This communication may contain confidential
> and/or privileged information. If you are not the intended recipient
> (or have received this communication in error) please notify the
> sender and it-support@shoregrp.com immediately, and destroy this
> communication. Any unauthorized copying, disclosure or distribution of
> the material in this communication is strictly forbidden. Any views or
> opinions presented in this email are solely those of the author and do
> not necessarily represent those of the company. Finally, the recipient
> should check this email and any attachments for the presence of
> viruses. The company accepts no liability for any damage caused by any virus transmitted
by this email.
>
>
>


--
Sincerely yours
Mikhail Khludnev

NOTICE TO RECIPIENTS: This communication may contain confidential and/or privileged information.
If you are not the intended recipient (or have received this communication in error) please
notify the sender and it-support@shoregrp.com immediately, and destroy this communication.
Any unauthorized copying, disclosure or distribution of the material in this communication
is strictly forbidden. Any views or opinions presented in this email are solely those of the
author and do not necessarily represent those of the company. Finally, the recipient should
check this email and any attachments for the presence of viruses. The company accepts no liability
for any damage caused by any virus transmitted by this email.


Mime
View raw message