Relations are indexed using multi-level objects in DIH. Check out the DIH page on the Solr wiki page.
There are also some basic examples of this included in Solr distributions in the DIH examples / examples.
There is a limitation here, although solr does not (currently) support the relationship between index documents, so you have to find a workaround to index this. For example, simply storing the displayed data in a non-indexed field (which may require very frequent reindexing):
<document> <entity name="hotel" query="select * from hotel"> <field column="id" name="hotel_id" /> <field column="hotel_name" name="hotel_name" /> <entity name="hotel_category_display" query="SELECT STATEMENT THAT RETURNS JSON REPRESENTATION"> <field column="category" name="category" /> </entity> </document>
Or, saving only the category identifier and search (either by the database, or by individual index categories, and by searching in Solr):
<entity name="hotel_category_display" query="SELECT STATEMENT THAT RETURNS JSON REPRESENTATION"> <field column="category" name="category" /> </entity>
Karl Johansson
source share