Note that there are some explanatory texts on larger screens.

plurals
  1. POSolr - nested entity with multiple values
    text
    copied!<p>Once more.. I have 2 tables 'blog' and 'comment'. A blog can contains n comments (blog --1:n-- comment). Up to date I use following select to insert the data into solr index:</p> <pre><code> &lt;entity name="blog" dataSource="mssqlDatasource" pk="id" transformer="ClobTransformer" query="SELECT b.id, b.market, b.title AS blogTitle, b.message AS blogMessage, c.message AS commentMessage, c.secondColumn FROM blog b LEFT JOIN comment c ON b.id = c.source_id AND c.source_type = 'blog'"&gt; &lt;field column="blogMessage" name="blogMessage" clob="true" /&gt; &lt;field column="commentMessage" name="commentMessage" clob="true" /&gt; &lt;/entity&gt; </code></pre> <p>The index result looks like:</p> <pre><code> &lt;doc&gt; &lt;str name="id"&gt;1&lt;/str&gt; &lt;str name="market"&gt;12&lt;/str&gt; &lt;str name="title"&gt;blog of title 1&lt;/str&gt; &lt;str name="blogMessage"&gt;message of blog 1&lt;/str&gt; &lt;str name="commentMessage"&gt;message of comment&lt;/str&gt; &lt;str name="scondColumn"&gt;Im the second column from comment&lt;/str&gt; &lt;/doc&gt; &lt;doc&gt; &lt;str name="id"&gt;1&lt;/str&gt; &lt;str name="market"&gt;12&lt;/str&gt; &lt;str name="title"&gt;blog of title 1&lt;/str&gt; &lt;str name="blogMessage"&gt;message of blog 1&lt;/str&gt; &lt;str name="commentMessage"&gt;message of comment - Im the second comment&lt;/str&gt; &lt;str name="scondColumn"&gt;Im the second column from comment&lt;/str&gt; &lt;/doc&gt; </code></pre> <p>I would say this is stupid because I got too many index data with the same blog just the comments are different. Is it possible to set 'comments' as 'subentity' like following:</p> <pre><code> &lt;entity name="blog" dataSource="mssqlDatasource" pk="id" transformer="ClobTransformer" query="SELECT b.id, b.market, b.title AS blogTitle, b.message AS blogMessage FROM blog b"&gt; &lt;field column="blogMessage" name="blogMessage" clob="true" /&gt; &lt;entity name="comment" dataSource="mssqlDatasource" pk="id" transformer="ClobTransformer" query="SELECT c.message as commentMessage, c.secondColumn FROM comment c WHERE c.source_id = ${blog.id}"&gt; &lt;field column="commentMessage" name="commentMessage" clob="true" /&gt; &lt;/entity&gt; &lt;/entity&gt; </code></pre> <p>Is that possible? How would the result looks like (cant test it until monday)?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload