java - Solr return only parent document on child query match -


i have set of documents indexed has pseudo parent-child relationship. each child document had reference parent document. due availability complexity, these documents not being indexed support block-join, i.e. instead of nested structure, flat. here's example:

<doc>   <field name="id">1</field>   <field name="title">parent title</field>   <field name="doc_id">123</field>  </doc> <doc>   <field name="id">2</field>   <field name="title">child title1</field>   <field name="parent_doc_id">123</field> </doc> <doc>   <field name="id">3</field>   <field name="title">child title2</field>   <field name="parent_doc_id">123</field> </doc> <doc>   <field name="id">4</field>   <field name="title">misc title2</field> </doc> 

what i'm looking if search "title2", result should bring following 2 docs, 1 matching parent , 1 based on regular match.

<doc>   <field name="id">1</field>   <field name="title">parent title</field>   <field name="doc_id">123</field>  </doc> <doc>   <field name="id">4</field>   <field name="title">misc title2</field> </doc> 

with block-join support, have used block join parent query parser,

q={!parent which="content_type:parentdocument"}title:title2 

transforming result documents alternate has reverse support through childdoctransformerfactory.

just wondering if there's way address query in different way. pointers appreciated.

if use solr 6, might able expand results include parent records using graph query parser.


Comments

Popular posts from this blog

Ansible - ERROR! the field 'hosts' is required but was not set -

customize file_field button ruby on rails -

SoapUI on windows 10 - high DPI/4K scaling issue -