在 Solr DIH data-config.xml 中,使用 JOIN 在主实体中查询尽可能多的字段是否更好,例如:
<entity name="Lists"
pk="l.list_id"
query="SELECT l.list_id AS id, l.user_id, lo.is_votable FROM lists l
INNER JOIN list_options lo ON lo.list_id = l.list_id">
或使用单独的子实体,例如:
<entity name="Lists"
pk="l.list_id"
query="SELECT l.list_id AS id, l.user_id FROM lists l">
<entity name="ListOptions"
query="SELECT lo.is_votable FROM list_options lo
WHERE lo.list_id=${Lists.id}" />
</entity>