Solr DataImportHandler - JOIN against a single object

In Solr DIH data-config.xml it is better to extract as many fields as possible, with a query in the main entity with JOIN as follows:

<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">

or use a separate sub-object, for example:

<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>
+5
source share
1 answer

A few pointers that can help you decide: -

  • Subjects process the request for each of the records and, therefore, will be slower in performance if you have a huge collection.
  • If you have a one-to-one mapping, you can use a connection so that you get all fields with a single query.
  • , , , , . ( , , )
+7

All Articles