Searching a nested structure. Can not retrieve parents with all corresponding childs

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Searching a nested structure. Can not retrieve parents with all corresponding childs

Marco Ibscher
Hi there,

I have problems retrieving data in the nested structure in that it is indexed in solr 8.2:

I have a product database with products as the parent element and size/color combinations as the child elements. The data is imported with the data import handler:

<dataConfig>
    <dataSource
       ...
    />
    <!-- product import -->
    <document>
        <!-- entity = table -->
        <entity name="skn" pk="SKN" rootEntity="true" query="select * from skn">
            <field column="SKN" name="id" />
            <field column="doc_type" name="doc_type" />
            <field column="SEARCHDESCRIPTION" name="SEARCHDESCRIPTION" />
            <entity name="sku" child="true" query="select * from sku where SKN = '${skn.SKN}'">
                <field column="SKU" name="id" />
                <field column="doc_type" name="doc_type" />
                <field column="variant1" name="variant1" />
                <field column="variant2" name="variant2" />
                <field column="v1_long" name="v1_long" />
                <field column="v2_long" name="v2_long" />
                <field column="v1_type" name="v1_type" />
                <field column="v2_type" name="v2_type" />
            </entity>
        </entity>
    <propertyWriter
        dateFormat="yyyy-MM-dd HH:mm:ss"
        type="SimplePropertiesWriter"
        directory="conf"
        filename="dataimport.properties"
        locale="de-DE"
    />
    </document>
</dataConfig>
I can get all childs for a certain parent or all parents for a certain child, using the Block Join Query Parser (so the nested structure is working). But I cannot retrive parents with the corresponding childs.

I tried the following query:

q={!parent which="id:1"}&fl=*,[child]&rows=200
It returns the parent document but not the corresponding child documents. I dont't get any error message. I also checked the log file.

I also tried adding a childFilter or a parentFilter:

q={!parent which=doc_type:parent}&fl=id,[child parentFilter=doc_type:parent childFilter=doc_type:child]&rows=200

Using the parentFilter ends with the error message "Parent filter should not be sent when the schema is nested". The childFilter does not change the result (all parents, no childs).

Important schema fields:

  <fieldType name="_nest_path_" class="solr.NestPathField" maxCharsForDocValues="-1" omitNorms="true" omitTermFreqAndPositions="true" stored="false"/>

  <field name="_nest_path_" type="_nest_path_"/>
  <field name="_root_" type="string" docValues="false" indexed="true" stored="false"/>
  <field name="_text_" type="text_general" multiValued="true" indexed="true" stored="false"/>
  <field name="_version_" type="plong" indexed="false" stored="false"/>
  <field name="doc_type" type="text_de" uninvertible="true" indexed="true" stored="true"/>
  <field name="id" type="string" multiValued="false" indexed="true" required="true" stored="true"/>
  <field name="name" type="text_de" uninvertible="true" indexed="true" stored="true"/>
  <field name="root" type="pints" uninvertible="true" indexed="true" stored="true"/>
  <field name="searchdescription" type="text_de" uninvertible="true" indexed="true" stored="true"/>
  <field name="title" type="text_de" uninvertible="true" indexed="true" stored="true"/>
  <field name="v1_long" type="text_de" uninvertible="true" indexed="true" stored="true"/>
  <field name="v1_type" type="text_de" uninvertible="true" indexed="true" stored="true"/>
  <field name="v2_long" type="text_de" uninvertible="true" indexed="true" stored="true"/>
  <field name="v2_type" type="text_de" uninvertible="true" indexed="true" stored="true"/>
  <field name="variant1" type="text_de" uninvertible="true" indexed="true" stored="true"/>
  <field name="variant2" type="text_de" uninvertible="true" indexed="true" stored="true"/>

Can anyone help? I also posted this problem on stackoverflow: https://stackoverflow.com/questions/59162038/searching-a-nested-structure-can-not-retirve-parents-with-all-corresponding-chi

Thank you.

Marco
Reply | Threaded
Open this post in threaded view
|

Aw: Searching a nested structure. Can not retrieve parents with all corresponding childs

Marco Ibscher
Hi there,
 
on stackoverflow I got the advice to delete the _nest_path_ field. Without it I can use the parent filter without getting the "Parent filter should not be sent when the schema is nested" error mesage. For example:
 
q={!parent which=doc_type:parent}&fl=id,[child parentFilter=doc_type:parent childFilter=doc_type:child]&rows=200
 

I am still confused why it does not work with the _nest_path_ field and thankful for an advice, but right now I can work with this "solution".
 
Best regards
Marco

Gesendet: Mittwoch, 04. Dezember 2019 um 16:42 Uhr
Von: "Marco Ibscher" <[hidden email]>
An: [hidden email]
Betreff: Searching a nested structure. Can not retrieve parents with all corresponding childs
Hi there,

I have problems retrieving data in the nested structure in that it is indexed in solr 8.2:

I have a product database with products as the parent element and size/color combinations as the child elements. The data is imported with the data import handler:

<dataConfig>
<dataSource
...
/>
<!-- product import -->
<document>
<!-- entity = table -->
<entity name="skn" pk="SKN" rootEntity="true" query="select * from skn">
<field column="SKN" name="id" />
<field column="doc_type" name="doc_type" />
<field column="SEARCHDESCRIPTION" name="SEARCHDESCRIPTION" />
<entity name="sku" child="true" query="select * from sku where SKN = '${skn.SKN}'">
<field column="SKU" name="id" />
<field column="doc_type" name="doc_type" />
<field column="variant1" name="variant1" />
<field column="variant2" name="variant2" />
<field column="v1_long" name="v1_long" />
<field column="v2_long" name="v2_long" />
<field column="v1_type" name="v1_type" />
<field column="v2_type" name="v2_type" />
</entity>
</entity>
<propertyWriter
dateFormat="yyyy-MM-dd HH:mm:ss"
type="SimplePropertiesWriter"
directory="conf"
filename="dataimport.properties"
locale="de-DE"
/>
</document>
</dataConfig>
I can get all childs for a certain parent or all parents for a certain child, using the Block Join Query Parser (so the nested structure is working). But I cannot retrive parents with the corresponding childs.

I tried the following query:

q={!parent which="id:1"}&fl=*,[child]&rows=200
It returns the parent document but not the corresponding child documents. I dont't get any error message. I also checked the log file.

I also tried adding a childFilter or a parentFilter:

q={!parent which=doc_type:parent}&fl=id,[child parentFilter=doc_type:parent childFilter=doc_type:child]&rows=200

Using the parentFilter ends with the error message "Parent filter should not be sent when the schema is nested". The childFilter does not change the result (all parents, no childs).

Important schema fields:

<fieldType name="_nest_path_" class="solr.NestPathField" maxCharsForDocValues="-1" omitNorms="true" omitTermFreqAndPositions="true" stored="false"/>

<field name="_nest_path_" type="_nest_path_"/>
<field name="_root_" type="string" docValues="false" indexed="true" stored="false"/>
<field name="_text_" type="text_general" multiValued="true" indexed="true" stored="false"/>
<field name="_version_" type="plong" indexed="false" stored="false"/>
<field name="doc_type" type="text_de" uninvertible="true" indexed="true" stored="true"/>
<field name="id" type="string" multiValued="false" indexed="true" required="true" stored="true"/>
<field name="name" type="text_de" uninvertible="true" indexed="true" stored="true"/>
<field name="root" type="pints" uninvertible="true" indexed="true" stored="true"/>
<field name="searchdescription" type="text_de" uninvertible="true" indexed="true" stored="true"/>
<field name="title" type="text_de" uninvertible="true" indexed="true" stored="true"/>
<field name="v1_long" type="text_de" uninvertible="true" indexed="true" stored="true"/>
<field name="v1_type" type="text_de" uninvertible="true" indexed="true" stored="true"/>
<field name="v2_long" type="text_de" uninvertible="true" indexed="true" stored="true"/>
<field name="v2_type" type="text_de" uninvertible="true" indexed="true" stored="true"/>
<field name="variant1" type="text_de" uninvertible="true" indexed="true" stored="true"/>
<field name="variant2" type="text_de" uninvertible="true" indexed="true" stored="true"/>

Can anyone help? I also posted this problem on stackoverflow: https://stackoverflow.com/questions/59162038/searching-a-nested-structure-can-not-retirve-parents-with-all-corresponding-chi

Thank you.

Marco