Solr User Group,
 
         I would like to return a hierarchical data relationship when somebody 
queries for a parent doc in solr. This sort of relationship doesn't currently 
exist in our core as the use-case has been to search for a specific document 
only. However, here's kind of an example of what's being asked: (not the same 
kind of relationship though, but a smiliar concept. However, there will always 
be only 1 parent to many children)
 
User search's for a parent value and also gets child docs as part of the 
response (not child names as multi-valued fields)
 
For example, say: select?qt=parentvalueearch&q=[parentValue]
 
 <result name="response" numFound="3" start="0">
  <doc>  
  <str name="id">1</str> 
  <str name="parentValue">[parentValue]</str>  
  <str name="type">parent</str> 
  <str name="firstname">John</str> 
  <str name="lastname">Doe</str> 
  <str name="gender">M</str> 
  <doc>
  <doc>  
  <str name="id">2</str> 
  <str name="type">child</str> 
  <str name="firstname">Chris</str> 
  <str name="lastname">Doe</str> 
  <str name="gender">M</str> 
  <doc>
  <doc>  
  <str name="id">3</str> 
  <str name="type">child</str> 
  <str name="firstname">Stacy</str> 
  <str name="lastname">Doe</str> 
  <str name="gender">F</str> 
  <doc>
</result>
 
At first I was thinking I could just add a field within each child doc to 
represent the parentValue, however, this family relationship is a bit more 
complex as children can be associated to many different parents (parent docs) 
so I don't want to tie the relationship off the child. On the flip side, it 
seems, I could have a multi-valued field with all the childnames within the 
parent doc and then requery the core for the child docs and append them to the 
response...the caveat there is this parent may have a few hundred children and 
not sure if a multi-valued field would make sense to store the children 
references...also this approach would dramatically increase the response time 
from on average 20ms to ~4sec assumming a parent has 200 children. 
 
Anybody solve for a similiar issue or have thoughts on best way to tackle this 
with version 3.6? Also could Solr Joins introduced in 4.X address this issue? 
(Not too familiar with it but seems to be related)
 
Thanks in advance!
Mike

Reply via email to