You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Juan Botero <ju...@nanthealth.com> on 2016/10/03 16:38:44 UTC

Multi-level nesting query inconsistency

I am fairly new to Solr, so is possible I am writing the query wrong (I have Solr 4.10)

On this data:
[{
"id": -1666,
"otype": "ao",
    "parent_id": -1,
    "parent_type": "root",
"name": "JOSHUA N AARON MD PA",
"account_number": "002812300",
"tax_id": "50042772325",
"group_npi": 134630688333,
"taxonomy": "364SP0808AAX",
"start_date": "2001-04-01T00:00:00.00Z",
"end_date": "2139-12-31T00:00:00.00Z",
"_childDocuments_": [{
"otype": "p",
"parent_id": -1666,
"parent_type": "ao",
"id": 271,
"plan_id": "IBC",
"plan_url_identifier": "ibc"
}, {
"otype": "a",
"parent_id": -1666,
"parent_type": "ao",
"id": -88,
"line1": "216 E PULASKI STE 235",
"city": "Elkton",
"state": "MD",
"zip_code": "21921",
"_childDocuments_": [{
"otype": "ph",
            "parent_id": -88,
            "parent_type": "a",
"id": 1,
"number": "5556201984"
}, {
"otype": "ph",
            "parent_id": -88,
            "parent_type": "a",
"id": 2,
"number":"5558696114"
}]
}, {
"id": -1988,
"otype": "ap",
        "parent_id": -1666,
        "parent_type": "ao",
"plan_provider_id": "00283621227",
"is_pcp": false,
"is_specialist": false,
"start_date": "2001-04-01T00:00:00.00Z",
"end_date": "2014-05-01T00:00:00.00Z",
"_childDocuments_": [{
"id": -819,
"otype": "pf",
            "parent_id": -1988,
            "parent_type": "ap",
"npi": 139670334111,
"_childDocuments_": [{
"otype": "n",
                "parent_id": -819,
                "parent_type": "pf",
"id": 1,
"prefix": "Dr.",
"first": "Frank",
"middle": "N",
"last": "Aaron"
}],
"organization_name": "Frank N Aaron",
"date_of_birth": "1963-03-18T00:00:00.00Z",
"gender_code": "M",
"is_individual": true
}]
}, {
"id": -1987,
"otype": "ap",
        "parent_id": -1666,
        "parent_type": "ao",
"plan_provider_id": "00283621007",
"is_pcp": false,
"is_specialist": false,
"start_date": "2001-04-01T00:00:00.00Z",
"end_date": "2014-05-01T00:00:00.00Z",
"_childDocuments_": [{
"id": -815,
"otype": "pf",
            "parent_id": -1987,
            "parent_type": "ap",
"npi": 139670335001,
"_childDocuments_": [{
"otype": "n",
                "parent_id": -815,
                "parent_type": "pf",
"id": 1,
"prefix": "Dr.",
"first": "Joshua",
"middle": "N",
"last": "Aaron"
}],
"organization_name": "Joshua N Aaron",
"date_of_birth": "1963-03-18T00:00:00.00Z",
"gender_code": "M",
"is_individual": true
}]
}]
}]

This query:
q=otype:pf&fl=*,[docid],[child parentFilter=otype:pf limit=500]

returns different documents in the childocuments array for each doc in result, 2 oype:pf in total. But they have the same structure in the datasource. I expected each to have one child,  the otype:n document, but each has a different set of children and both more than intended, why?

CONFIDENTIALITY NOTICE
This e-mail message and any attachments are only for the use of the intended recipient and may contain information that is privileged, confidential or exempt from disclosure under applicable law. If you are not the intended recipient, any disclosure, distribution or other use of this e-mail message or attachments is prohibited. If you have received this e-mail message in error, please delete and notify the sender immediately. Thank you.

RE: Multi-level nesting query inconsistency

Posted by Juan Botero <ju...@nanthealth.com>.
Hi, thank you.

1. So why do I get those back? They are not even 'legitimate' grandchildren
2. If I do localhost:8983/solr/nested_object_testing/query?debug=query&q=otype:pf&fl=*,[docid],[child parentFilter=otype:pf limit=500 childFilter='otype:(a p ap)'] --> I get other children except name document, but if I do localhost:8983/solr/nested_object_testing/query?debug=query&q=otype:pf&fl=*,[docid],[child parentFilter=otype:pf limit=500 childFilter=otype:n] --> I do just get name documents, should 'childFilter' just include what I need?
3. I have not been able to write a working [subquery], could you help me out and write anyone for me with this data.

-----Original Message-----
From: Mikhail Khludnev [mailto:mkhl@apache.org]
Sent: Monday, October 03, 2016 1:11 PM
To: solr-user
Subject: Re: Multi-level nesting query inconsistency

Hello,
you can strip grandchildren with
[child parentFilter=otype:pf limit=500 childFilter='otype:(a p ap)'] If you need to get three level nesting you might probably check [subquery], but I suppose it's easier to recover hierarchy from what you have rigth now.

On Mon, Oct 3, 2016 at 7:38 PM, Juan Botero <ju...@nanthealth.com>
wrote:

> I am fairly new to Solr, so is possible I am writing the query wrong
> (I have Solr 4.10)
>
> On this data:
> [{
> "id": -1666,
> "otype": "ao",
>     "parent_id": -1,
>     "parent_type": "root",
> "name": "JOSHUA N AARON MD PA",
> "account_number": "002812300",
> "tax_id": "50042772325",
> "group_npi": 134630688333,
> "taxonomy": "364SP0808AAX",
> "start_date": "2001-04-01T00:00:00.00Z",
> "end_date": "2139-12-31T00:00:00.00Z",
> "_childDocuments_": [{
> "otype": "p",
> "parent_id": -1666,
> "parent_type": "ao",
> "id": 271,
> "plan_id": "IBC",
> "plan_url_identifier": "ibc"
> }, {
> "otype": "a",
> "parent_id": -1666,
> "parent_type": "ao",
> "id": -88,
> "line1": "216 E PULASKI STE 235",
> "city": "Elkton",
> "state": "MD",
> "zip_code": "21921",
> "_childDocuments_": [{
> "otype": "ph",
>             "parent_id": -88,
>             "parent_type": "a",
> "id": 1,
> "number": "5556201984"
> }, {
> "otype": "ph",
>             "parent_id": -88,
>             "parent_type": "a",
> "id": 2,
> "number":"5558696114"
> }]
> }, {
> "id": -1988,
> "otype": "ap",
>         "parent_id": -1666,
>         "parent_type": "ao",
> "plan_provider_id": "00283621227",
> "is_pcp": false,
> "is_specialist": false,
> "start_date": "2001-04-01T00:00:00.00Z",
> "end_date": "2014-05-01T00:00:00.00Z",
> "_childDocuments_": [{
> "id": -819,
> "otype": "pf",
>             "parent_id": -1988,
>             "parent_type": "ap",
> "npi": 139670334111,
> "_childDocuments_": [{
> "otype": "n",
>                 "parent_id": -819,
>                 "parent_type": "pf",
> "id": 1,
> "prefix": "Dr.",
> "first": "Frank",
> "middle": "N",
> "last": "Aaron"
> }],
> "organization_name": "Frank N Aaron",
> "date_of_birth": "1963-03-18T00:00:00.00Z",
> "gender_code": "M",
> "is_individual": true
> }]
> }, {
> "id": -1987,
> "otype": "ap",
>         "parent_id": -1666,
>         "parent_type": "ao",
> "plan_provider_id": "00283621007",
> "is_pcp": false,
> "is_specialist": false,
> "start_date": "2001-04-01T00:00:00.00Z",
> "end_date": "2014-05-01T00:00:00.00Z",
> "_childDocuments_": [{
> "id": -815,
> "otype": "pf",
>             "parent_id": -1987,
>             "parent_type": "ap",
> "npi": 139670335001,
> "_childDocuments_": [{
> "otype": "n",
>                 "parent_id": -815,
>                 "parent_type": "pf",
> "id": 1,
> "prefix": "Dr.",
> "first": "Joshua",
> "middle": "N",
> "last": "Aaron"
> }],
> "organization_name": "Joshua N Aaron",
> "date_of_birth": "1963-03-18T00:00:00.00Z",
> "gender_code": "M",
> "is_individual": true
> }]
> }]
> }]
>
> This query:
> q=otype:pf&fl=*,[docid],[child parentFilter=otype:pf limit=500]
>
> returns different documents in the childocuments array for each doc in
> result, 2 oype:pf in total. But they have the same structure in the
> datasource. I expected each to have one child,  the otype:n document,
> but each has a different set of children and both more than intended, why?
>
> CONFIDENTIALITY NOTICE
> This e-mail message and any attachments are only for the use of the
> intended recipient and may contain information that is privileged,
> confidential or exempt from disclosure under applicable law. If you
> are not the intended recipient, any disclosure, distribution or other
> use of this e-mail message or attachments is prohibited. If you have
> received this e-mail message in error, please delete and notify the sender immediately.
> Thank you.
>



--
Sincerely yours
Mikhail Khludnev
CONFIDENTIALITY NOTICE
This e-mail message and any attachments are only for the use of the intended recipient and may contain information that is privileged, confidential or exempt from disclosure under applicable law. If you are not the intended recipient, any disclosure, distribution or other use of this e-mail message or attachments is prohibited. If you have received this e-mail message in error, please delete and notify the sender immediately. Thank you.

Re: Multi-level nesting query inconsistency

Posted by Mikhail Khludnev <mk...@apache.org>.
Hello,
you can strip grandchildren with
[child parentFilter=otype:pf limit=500 childFilter='otype:(a p ap)']
If you need to get three level nesting you might probably check [subquery],
but I suppose it's easier to recover hierarchy from what you have rigth
now.

On Mon, Oct 3, 2016 at 7:38 PM, Juan Botero <ju...@nanthealth.com>
wrote:

> I am fairly new to Solr, so is possible I am writing the query wrong (I
> have Solr 4.10)
>
> On this data:
> [{
> "id": -1666,
> "otype": "ao",
>     "parent_id": -1,
>     "parent_type": "root",
> "name": "JOSHUA N AARON MD PA",
> "account_number": "002812300",
> "tax_id": "50042772325",
> "group_npi": 134630688333,
> "taxonomy": "364SP0808AAX",
> "start_date": "2001-04-01T00:00:00.00Z",
> "end_date": "2139-12-31T00:00:00.00Z",
> "_childDocuments_": [{
> "otype": "p",
> "parent_id": -1666,
> "parent_type": "ao",
> "id": 271,
> "plan_id": "IBC",
> "plan_url_identifier": "ibc"
> }, {
> "otype": "a",
> "parent_id": -1666,
> "parent_type": "ao",
> "id": -88,
> "line1": "216 E PULASKI STE 235",
> "city": "Elkton",
> "state": "MD",
> "zip_code": "21921",
> "_childDocuments_": [{
> "otype": "ph",
>             "parent_id": -88,
>             "parent_type": "a",
> "id": 1,
> "number": "5556201984"
> }, {
> "otype": "ph",
>             "parent_id": -88,
>             "parent_type": "a",
> "id": 2,
> "number":"5558696114"
> }]
> }, {
> "id": -1988,
> "otype": "ap",
>         "parent_id": -1666,
>         "parent_type": "ao",
> "plan_provider_id": "00283621227",
> "is_pcp": false,
> "is_specialist": false,
> "start_date": "2001-04-01T00:00:00.00Z",
> "end_date": "2014-05-01T00:00:00.00Z",
> "_childDocuments_": [{
> "id": -819,
> "otype": "pf",
>             "parent_id": -1988,
>             "parent_type": "ap",
> "npi": 139670334111,
> "_childDocuments_": [{
> "otype": "n",
>                 "parent_id": -819,
>                 "parent_type": "pf",
> "id": 1,
> "prefix": "Dr.",
> "first": "Frank",
> "middle": "N",
> "last": "Aaron"
> }],
> "organization_name": "Frank N Aaron",
> "date_of_birth": "1963-03-18T00:00:00.00Z",
> "gender_code": "M",
> "is_individual": true
> }]
> }, {
> "id": -1987,
> "otype": "ap",
>         "parent_id": -1666,
>         "parent_type": "ao",
> "plan_provider_id": "00283621007",
> "is_pcp": false,
> "is_specialist": false,
> "start_date": "2001-04-01T00:00:00.00Z",
> "end_date": "2014-05-01T00:00:00.00Z",
> "_childDocuments_": [{
> "id": -815,
> "otype": "pf",
>             "parent_id": -1987,
>             "parent_type": "ap",
> "npi": 139670335001,
> "_childDocuments_": [{
> "otype": "n",
>                 "parent_id": -815,
>                 "parent_type": "pf",
> "id": 1,
> "prefix": "Dr.",
> "first": "Joshua",
> "middle": "N",
> "last": "Aaron"
> }],
> "organization_name": "Joshua N Aaron",
> "date_of_birth": "1963-03-18T00:00:00.00Z",
> "gender_code": "M",
> "is_individual": true
> }]
> }]
> }]
>
> This query:
> q=otype:pf&fl=*,[docid],[child parentFilter=otype:pf limit=500]
>
> returns different documents in the childocuments array for each doc in
> result, 2 oype:pf in total. But they have the same structure in the
> datasource. I expected each to have one child,  the otype:n document, but
> each has a different set of children and both more than intended, why?
>
> CONFIDENTIALITY NOTICE
> This e-mail message and any attachments are only for the use of the
> intended recipient and may contain information that is privileged,
> confidential or exempt from disclosure under applicable law. If you are not
> the intended recipient, any disclosure, distribution or other use of this
> e-mail message or attachments is prohibited. If you have received this
> e-mail message in error, please delete and notify the sender immediately.
> Thank you.
>



-- 
Sincerely yours
Mikhail Khludnev