Search code examples
joinsolrrelational

Get joined data in result for Solr Join Query


I have the following json files:

[{
 "entity_id":"A1",
 "entity_desc":"cat",
  "relation_id": "A2",
 "relation_type":"kind of"
  },

{
 "entity id":"A2",
 "entity_desc":"Animal",
  "relation_id": "A9",
  "relation_type":"xyz"
} ,
]

I have indexed them by solr and now I want to use the join query to get the result:

cat "is kind of" Animal.

How to map the relation_id in document 1 to relation_id in document 2?

Thanks in advance


Solution

  • It is not possible to get results from both entities. You can only restrict your query by the joined entities.

    Here a quotation from the solr wiki:

    Joins in Solr are not really equivalent to SQL Joins because no information about the table being joined "from" is carried forward into the final result. A more appropriate SQL analogy would be an "inner query".