LifeInstructor
LifeInstructor

Reputation: 1610

Solr search in the nested all childs of the parent element, Nested Query, Block join.

I am struggling with the question. How can I search in the nested all childs of the parent element in Solr version 7.2. Searching in the single field I was able but in all fields no solution. I have read all documentation but exact solution doesn't existed can anybody help me with this?

my query is following:

 q={!parent which="doc_content_type:parentDocument"}"person"&fl=*, [child 
 parentFilter=doc_content_type:parentDocument limit=1000]

<hmd:emailAddresses>
    <hmd:emailAddress>[email protected]</hmd:emailAddress>
</hmd:emailAddresses>
<hmd:mailstop>88 ui</hmd:mailstop>
<hmd:description>
    <hmd:aboutMe></hmd:aboutMe>
</hmd:description>
<hmd:names>
    <hmd:fullName>Person Username Name</hmd:fullName>
    <hmd:firstAndMiddleName>UserMiddlename UserName</hmd:firstAndMiddleName>
    <hmd:firstName>Name person</hmd:firstName>
    <hmd:middleName/>
    <hmd:lastName>Lastname</hmd:lastName>
    <hmd:alternateNames>
        <hmd:alternateName type="">Some alt name person</hmd:alternateName>
    </hmd:alternateNames>
</hmd:names>
</hmd:person>

Also I have experimented with other ways also with child of instead of parent which:

   q={!child of="doc_content_type:parentDocument"}"person"&fl=*, [child 
   parentFilter=doc_content_type:parentDocument limit=1000]

I expect that the result to be all "person" containing child elements and not only by given field. Please note that I have multiple fields for search ~500

Upvotes: 1

Views: 258

Answers (1)

MatsLindh
MatsLindh

Reputation: 52882

The solution is usually to make Solr copy all the content from the fields into a single field - and then search against that. You can do this with a copyField instruction that matches all fields:

<copyField source="*" dest="all_text" />

You then query all_text instead of the other fields.

Upvotes: 0

Related Questions