lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Shamik Bandopadhyay <sham...@gmail.com>
Subject Return only parent on child query match (w/o block-join)
Date Tue, 19 Apr 2016 17:29:40 GMT
Hi,

   I have a set of documents indexed which has a pseudo parent-child
relationship. Each child document had a reference to the parent document.
Due to document availability complexity (and the condition of updating both
parent-child documents at the time of indexing), I'm not able to use
explicit block-join.Instead of a nested structure, they are all flat.
Here's an 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 is if I search "title2", the result should bring back the
following two docs, 1 matching the parent and one based on a 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, I could have used Block Join Parent Query Parser,
q={!parent which="content_type:parentDocument"}title:title2

Transforming result documents is an alternate but it has the reverse
support through ChildDocTransformerFactory

Just wondering if there's a way to address query in a different way. Any
pointers will be appreciated.

-Thanks,
Shamik

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message